-extern source_position_t builtin_source_position;
-
-typedef struct {
- int type;
- union {
- symbol_t *symbol;
- long long intvalue;
- long double floatvalue;
- string_t string;
- wide_string_t wide_string;
- } v;
- type_t *datatype;
- source_position_t source_position;
-} token_t;
+extern const source_position_t builtin_source_position;
+
+typedef struct token_base_t token_base_t;
+typedef struct identifier_t identifier_t;
+typedef struct string_literal_t string_literal_t;
+typedef struct number_literal_t number_literal_t;
+typedef union token_t token_t;
+
+struct token_base_t {
+ int kind;
+ source_position_t source_position;
+};
+
+struct identifier_t {
+ token_base_t base;
+ symbol_t *symbol;
+};
+
+struct string_literal_t {
+ token_base_t base;
+ string_t string;
+};
+
+struct number_literal_t {
+ token_base_t base;
+ string_t number;
+ string_t suffix;
+};
+
+union token_t {
+ int kind;
+ token_base_t base;
+ identifier_t identifier;
+ string_literal_t string;
+ number_literal_t number;
+};