Adjusted array literal definition
This commit is contained in:
parent
271470ff39
commit
47c9710905
|
|
@ -31,6 +31,26 @@ typedef enum {
|
||||||
TOKEN_TYPE_TUPLE,
|
TOKEN_TYPE_TUPLE,
|
||||||
} TokenType;
|
} TokenType;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ARRAY_IDENTIFIER,
|
||||||
|
ARRAY_I64,
|
||||||
|
ARRAY_I32,
|
||||||
|
ARRAY_I16,
|
||||||
|
ARRAY_I8,
|
||||||
|
ARRAY_U64,
|
||||||
|
ARRAY_U32,
|
||||||
|
ARRAY_U16,
|
||||||
|
ARRAY_U8,
|
||||||
|
ARRAY_FLOAT,
|
||||||
|
ARRAY_DOUBLE,
|
||||||
|
ARRAY_STRING,
|
||||||
|
ARRAY_BOOLEAN,
|
||||||
|
ARRAY_ARRAY,
|
||||||
|
ARRAY_TOKEN_STRING,
|
||||||
|
ARRAY_TYPE_TUPLE,
|
||||||
|
ARRAY_STRUCT_INLINE,
|
||||||
|
} ArrayType;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
@ -58,22 +78,6 @@ typedef struct {
|
||||||
size_t length;
|
size_t length;
|
||||||
} StringLiteral;
|
} StringLiteral;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
TokenType type;
|
|
||||||
union {
|
|
||||||
Identifier *identifiers; // type == TOKEN_IDENTIFIER
|
|
||||||
IntegerLiteral *integer_literals; // type == TOKEN_INTEGER
|
|
||||||
float *float_literals; // type == TOKEN_FLOAT
|
|
||||||
double *double_literals; // type == TOKEN_DOUBLE
|
|
||||||
StringLiteral *string_literals; // type == TOKEN_STRING
|
|
||||||
uint8_t *boolean_literals; // type == TOKEN_BOOLEAN
|
|
||||||
ArrayLiteral *array_literals; // type == TOKEN_ARRAY
|
|
||||||
TokenString *token_strings; // type == TOKEN_TOKEN_STRING
|
|
||||||
TypeTuple *type_tuples; // type == TOKEN_TYPE_TUPLE
|
|
||||||
};
|
|
||||||
size_t length;
|
|
||||||
} ArrayLiteral;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const Token *tokens;
|
const Token *tokens;
|
||||||
size_t length;
|
size_t length;
|
||||||
|
|
@ -86,6 +90,28 @@ typedef struct {
|
||||||
size_t output_length;
|
size_t output_length;
|
||||||
} TypeTuple;
|
} TypeTuple;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
TokenString values;
|
||||||
|
Identifier name;
|
||||||
|
} StructInline;
|
||||||
|
|
||||||
|
typedef struct ArrayLiteral {
|
||||||
|
ArrayType type;
|
||||||
|
union {
|
||||||
|
Identifier *identifiers; // type == ARRAY_IDENTIFIER
|
||||||
|
uint64_t *integer_literals; // type in { ARRAY_I64, ARRAY_I32, ARRAY_I16, ARRAY_I8, ARRAY_U64, ARRAY_U32, ARRAY_U16, ARRAY_U8, }
|
||||||
|
float *float_literals; // type == ARRAY_FLOAT
|
||||||
|
double *double_literals; // type == ARRAY_DOUBLE
|
||||||
|
StringLiteral *string_literals; // type == ARRAY_STRING
|
||||||
|
uint8_t *boolean_literals; // type == ARRAY_BOOLEAN
|
||||||
|
ArrayLiteral *array_literals; // type == ARRAY_ARRAY
|
||||||
|
TokenString *token_strings; // type == ARRAY_TOKEN_STRING
|
||||||
|
TypeTuple *type_tuples; // type == ARRAY_TYPE_TUPLE
|
||||||
|
StructInline *type_tuples; // type == ARRAY_STRUCT_INLINE
|
||||||
|
};
|
||||||
|
size_t length;
|
||||||
|
} ArrayLiteral;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TokenType type;
|
TokenType type;
|
||||||
union {
|
union {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue