@@ -35,6 +35,7 @@ typedef uint16_t TSStateId;
3535typedef struct {
3636 bool visible : 1;
3737 bool named : 1;
38+ bool supertype: 1;
3839} TSSymbolMetadata;
3940
4041typedef struct TSLexer TSLexer;
@@ -62,13 +63,13 @@ typedef struct {
6263 TSStateId state;
6364 bool extra : 1;
6465 bool repetition : 1;
65- };
66+ } shift ;
6667 struct {
6768 TSSymbol symbol;
6869 int16_t dynamic_precedence;
6970 uint8_t child_count;
7071 uint8_t production_id;
71- };
72+ } reduce ;
7273 } params;
7374 TSParseActionType type : 4;
7475} TSParseAction;
@@ -83,7 +84,7 @@ typedef union {
8384 struct {
8485 uint8_t count;
8586 bool reusable : 1;
86- };
87+ } entry ;
8788} TSParseActionEntry;
8889
8990struct TSLanguage {
@@ -119,6 +120,8 @@ struct TSLanguage {
119120 const uint16_t *small_parse_table;
120121 const uint32_t *small_parse_table_map;
121122 const TSSymbol *public_symbol_map;
123+ const uint16_t *alias_map;
124+ uint32_t state_count;
122125};
123126
124127/*
@@ -167,22 +170,28 @@ struct TSLanguage {
167170
168171#define ACTIONS(id) id
169172
170- #define SHIFT(state_value) \
171- { \
172- { \
173- .type = TSParseActionTypeShift, \
174- .params = {.state = state_value}, \
175- } \
173+ #define SHIFT(state_value) \
174+ { \
175+ { \
176+ .params = { \
177+ .shift = { \
178+ .state = state_value \
179+ } \
180+ }, \
181+ .type = TSParseActionTypeShift \
182+ } \
176183 }
177184
178185#define SHIFT_REPEAT(state_value) \
179186 { \
180187 { \
181- .type = TSParseActionTypeShift, \
182188 .params = { \
183- .state = state_value, \
184- .repetition = true \
189+ .shift = { \
190+ .state = state_value, \
191+ .repetition = true \
192+ } \
185193 }, \
194+ .type = TSParseActionTypeShift \
186195 } \
187196 }
188197
@@ -194,20 +203,26 @@ struct TSLanguage {
194203#define SHIFT_EXTRA() \
195204 { \
196205 { \
197- .type = TSParseActionTypeShift, \
198- .params = {.extra = true} \
206+ .params = { \
207+ .shift = { \
208+ .extra = true \
209+ } \
210+ }, \
211+ .type = TSParseActionTypeShift \
199212 } \
200213 }
201214
202215#define REDUCE(symbol_val, child_count_val, ...) \
203216 { \
204217 { \
205- .type = TSParseActionTypeReduce, \
206218 .params = { \
207- .symbol = symbol_val, \
208- .child_count = child_count_val, \
209- __VA_ARGS__ \
210- } \
219+ .reduce = { \
220+ .symbol = symbol_val, \
221+ .child_count = child_count_val, \
222+ __VA_ARGS__ \
223+ }, \
224+ }, \
225+ .type = TSParseActionTypeReduce \
211226 } \
212227 }
213228
0 commit comments