Do not use multiple unnamed structs inside of unions
This commit is contained in:
parent
c393591e1d
commit
780e9cecc9
6 changed files with 56 additions and 42 deletions
|
|
@ -62,13 +62,13 @@ typedef struct {
|
|||
TSStateId state;
|
||||
bool extra : 1;
|
||||
bool repetition : 1;
|
||||
};
|
||||
} shift;
|
||||
struct {
|
||||
TSSymbol symbol;
|
||||
int16_t dynamic_precedence;
|
||||
uint8_t child_count;
|
||||
uint8_t production_id;
|
||||
};
|
||||
} reduce;
|
||||
} params;
|
||||
TSParseActionType type : 4;
|
||||
} TSParseAction;
|
||||
|
|
@ -83,7 +83,7 @@ typedef union {
|
|||
struct {
|
||||
uint8_t count;
|
||||
bool reusable : 1;
|
||||
};
|
||||
} entry;
|
||||
} TSParseActionEntry;
|
||||
|
||||
struct TSLanguage {
|
||||
|
|
@ -167,22 +167,28 @@ struct TSLanguage {
|
|||
|
||||
#define ACTIONS(id) id
|
||||
|
||||
#define SHIFT(state_value) \
|
||||
{ \
|
||||
{ \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.params = {.state = state_value}, \
|
||||
} \
|
||||
#define SHIFT(state_value) \
|
||||
{ \
|
||||
{ \
|
||||
.params = { \
|
||||
.shift = { \
|
||||
.state = state_value \
|
||||
} \
|
||||
}, \
|
||||
.type = TSParseActionTypeShift \
|
||||
} \
|
||||
}
|
||||
|
||||
#define SHIFT_REPEAT(state_value) \
|
||||
{ \
|
||||
{ \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.params = { \
|
||||
.state = state_value, \
|
||||
.repetition = true \
|
||||
.shift = { \
|
||||
.state = state_value, \
|
||||
.repetition = true \
|
||||
} \
|
||||
}, \
|
||||
.type = TSParseActionTypeShift \
|
||||
} \
|
||||
}
|
||||
|
||||
|
|
@ -194,20 +200,26 @@ struct TSLanguage {
|
|||
#define SHIFT_EXTRA() \
|
||||
{ \
|
||||
{ \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.params = {.extra = true} \
|
||||
.params = { \
|
||||
.shift = { \
|
||||
.extra = true \
|
||||
} \
|
||||
}, \
|
||||
.type = TSParseActionTypeShift \
|
||||
} \
|
||||
}
|
||||
|
||||
#define REDUCE(symbol_val, child_count_val, ...) \
|
||||
{ \
|
||||
{ \
|
||||
.type = TSParseActionTypeReduce, \
|
||||
.params = { \
|
||||
.symbol = symbol_val, \
|
||||
.child_count = child_count_val, \
|
||||
__VA_ARGS__ \
|
||||
} \
|
||||
.reduce = { \
|
||||
.symbol = symbol_val, \
|
||||
.child_count = child_count_val, \
|
||||
__VA_ARGS__ \
|
||||
}, \
|
||||
}, \
|
||||
.type = TSParseActionTypeReduce \
|
||||
} \
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue