Remove some macros from public parser header
This commit is contained in:
parent
d3204d3526
commit
c0a3f8d39c
6 changed files with 25 additions and 36 deletions
|
|
@ -23,7 +23,7 @@ enum {
|
|||
ts_aux_sym_7,
|
||||
};
|
||||
|
||||
SYMBOL_NAMES = {
|
||||
static const char *ts_symbol_names[] = {
|
||||
[ts_builtin_sym_document] = "DOCUMENT",
|
||||
[ts_sym_expression] = "expression",
|
||||
[ts_sym_sum] = "sum",
|
||||
|
|
@ -46,7 +46,7 @@ SYMBOL_NAMES = {
|
|||
[ts_aux_sym_7] = "')'",
|
||||
};
|
||||
|
||||
HIDDEN_SYMBOLS = {
|
||||
static const int ts_hidden_symbol_flags[SYMBOL_COUNT] = {
|
||||
[ts_aux_sym_1] = 1,
|
||||
[ts_aux_sym_2] = 1,
|
||||
[ts_aux_sym_3] = 1,
|
||||
|
|
@ -56,7 +56,7 @@ HIDDEN_SYMBOLS = {
|
|||
[ts_aux_sym_7] = 1,
|
||||
};
|
||||
|
||||
LEX_FN() {
|
||||
static TSTree *ts_lex(TSLexer *lexer, TSStateId lex_state) {
|
||||
START_LEXER();
|
||||
switch (lex_state) {
|
||||
case 1:
|
||||
|
|
@ -230,7 +230,7 @@ LEX_FN() {
|
|||
}
|
||||
}
|
||||
|
||||
LEX_STATES = {
|
||||
static TSStateId ts_lex_states[STATE_COUNT] = {
|
||||
[0] = 1,
|
||||
[1] = 6,
|
||||
[2] = 6,
|
||||
|
|
@ -268,7 +268,7 @@ LEX_STATES = {
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
|
||||
PARSE_TABLE = {
|
||||
static const TSParseAction ts_parse_actions[STATE_COUNT][SYMBOL_COUNT] = {
|
||||
[0] = {
|
||||
[ts_sym_expression] = SHIFT(1),
|
||||
[ts_sym_sum] = SHIFT(2),
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ enum {
|
|||
ts_aux_sym_23,
|
||||
};
|
||||
|
||||
SYMBOL_NAMES = {
|
||||
static const char *ts_symbol_names[] = {
|
||||
[ts_builtin_sym_document] = "DOCUMENT",
|
||||
[ts_sym_program] = "program",
|
||||
[ts_sym_package_directive] = "package_directive",
|
||||
|
|
@ -182,7 +182,7 @@ SYMBOL_NAMES = {
|
|||
[ts_aux_sym_23] = "'!'",
|
||||
};
|
||||
|
||||
HIDDEN_SYMBOLS = {
|
||||
static const int ts_hidden_symbol_flags[SYMBOL_COUNT] = {
|
||||
[ts_sym__func_signature] = 1,
|
||||
[ts_sym__line_break] = 1,
|
||||
[ts_sym__identifier] = 1,
|
||||
|
|
@ -238,7 +238,7 @@ HIDDEN_SYMBOLS = {
|
|||
[ts_aux_sym_23] = 1,
|
||||
};
|
||||
|
||||
LEX_FN() {
|
||||
static TSTree *ts_lex(TSLexer *lexer, TSStateId lex_state) {
|
||||
START_LEXER();
|
||||
switch (lex_state) {
|
||||
case 1:
|
||||
|
|
@ -2243,7 +2243,7 @@ LEX_FN() {
|
|||
}
|
||||
}
|
||||
|
||||
LEX_STATES = {
|
||||
static TSStateId ts_lex_states[STATE_COUNT] = {
|
||||
[0] = 1,
|
||||
[1] = 12,
|
||||
[2] = 14,
|
||||
|
|
@ -2621,7 +2621,7 @@ LEX_STATES = {
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
|
||||
PARSE_TABLE = {
|
||||
static const TSParseAction ts_parse_actions[STATE_COUNT][SYMBOL_COUNT] = {
|
||||
[0] = {
|
||||
[ts_sym_program] = SHIFT(1),
|
||||
[ts_sym_package_directive] = SHIFT(2),
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ enum {
|
|||
ts_aux_sym_36,
|
||||
};
|
||||
|
||||
SYMBOL_NAMES = {
|
||||
static const char *ts_symbol_names[] = {
|
||||
[ts_builtin_sym_document] = "DOCUMENT",
|
||||
[ts_sym_program] = "program",
|
||||
[ts_sym_statement] = "statement",
|
||||
|
|
@ -226,7 +226,7 @@ SYMBOL_NAMES = {
|
|||
[ts_aux_sym_36] = "']'",
|
||||
};
|
||||
|
||||
HIDDEN_SYMBOLS = {
|
||||
static const int ts_hidden_symbol_flags[SYMBOL_COUNT] = {
|
||||
[ts_sym__line_break] = 1,
|
||||
[ts_aux_sym_program_repeat0] = 1,
|
||||
[ts_aux_sym_statement_block_repeat0] = 1,
|
||||
|
|
@ -295,7 +295,7 @@ HIDDEN_SYMBOLS = {
|
|||
[ts_aux_sym_36] = 1,
|
||||
};
|
||||
|
||||
LEX_FN() {
|
||||
static TSTree *ts_lex(TSLexer *lexer, TSStateId lex_state) {
|
||||
START_LEXER();
|
||||
switch (lex_state) {
|
||||
case 1:
|
||||
|
|
@ -9378,7 +9378,7 @@ LEX_FN() {
|
|||
}
|
||||
}
|
||||
|
||||
LEX_STATES = {
|
||||
static TSStateId ts_lex_states[STATE_COUNT] = {
|
||||
[0] = 1,
|
||||
[1] = 111,
|
||||
[2] = 1,
|
||||
|
|
@ -11596,7 +11596,7 @@ LEX_STATES = {
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
|
||||
PARSE_TABLE = {
|
||||
static const TSParseAction ts_parse_actions[STATE_COUNT][SYMBOL_COUNT] = {
|
||||
[0] = {
|
||||
[ts_sym_program] = SHIFT(1),
|
||||
[ts_sym_statement] = SHIFT(2),
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ enum {
|
|||
ts_aux_sym_6,
|
||||
};
|
||||
|
||||
SYMBOL_NAMES = {
|
||||
static const char *ts_symbol_names[] = {
|
||||
[ts_builtin_sym_document] = "DOCUMENT",
|
||||
[ts_sym_value] = "value",
|
||||
[ts_sym_object] = "object",
|
||||
|
|
@ -44,7 +44,7 @@ SYMBOL_NAMES = {
|
|||
[ts_aux_sym_6] = "']'",
|
||||
};
|
||||
|
||||
HIDDEN_SYMBOLS = {
|
||||
static const int ts_hidden_symbol_flags[SYMBOL_COUNT] = {
|
||||
[ts_aux_sym_object_repeat0] = 1,
|
||||
[ts_aux_sym_array_repeat0] = 1,
|
||||
[ts_aux_sym_1] = 1,
|
||||
|
|
@ -55,7 +55,7 @@ HIDDEN_SYMBOLS = {
|
|||
[ts_aux_sym_6] = 1,
|
||||
};
|
||||
|
||||
LEX_FN() {
|
||||
static TSTree *ts_lex(TSLexer *lexer, TSStateId lex_state) {
|
||||
START_LEXER();
|
||||
switch (lex_state) {
|
||||
case 1:
|
||||
|
|
@ -362,7 +362,7 @@ LEX_FN() {
|
|||
}
|
||||
}
|
||||
|
||||
LEX_STATES = {
|
||||
static TSStateId ts_lex_states[STATE_COUNT] = {
|
||||
[0] = 1,
|
||||
[1] = 24,
|
||||
[2] = 24,
|
||||
|
|
@ -428,7 +428,7 @@ LEX_STATES = {
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
|
||||
PARSE_TABLE = {
|
||||
static const TSParseAction ts_parse_actions[STATE_COUNT][SYMBOL_COUNT] = {
|
||||
[0] = {
|
||||
[ts_sym_value] = SHIFT(1),
|
||||
[ts_sym_object] = SHIFT(2),
|
||||
|
|
|
|||
|
|
@ -78,17 +78,6 @@ struct TSLanguage {
|
|||
TSTree *(*lex_fn)(TSLexer *, TSStateId);
|
||||
};
|
||||
|
||||
#define SYMBOL_NAMES static const char *ts_symbol_names[]
|
||||
|
||||
#define HIDDEN_SYMBOLS static const int ts_hidden_symbol_flags[SYMBOL_COUNT]
|
||||
|
||||
#define LEX_STATES static TSStateId ts_lex_states[STATE_COUNT]
|
||||
|
||||
#define PARSE_TABLE \
|
||||
static const TSParseAction ts_parse_actions[STATE_COUNT][SYMBOL_COUNT]
|
||||
|
||||
#define LEX_FN() static TSTree *ts_lex(TSLexer *lexer, TSStateId lex_state)
|
||||
|
||||
#define DEBUG_LEX(...) \
|
||||
if (lexer->debug) { \
|
||||
fprintf(stderr, "LEX " __VA_ARGS__); \
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class CCodeGenerator {
|
|||
}
|
||||
|
||||
void symbol_names_list() {
|
||||
line("SYMBOL_NAMES = {");
|
||||
line("static const char *ts_symbol_names[] = {");
|
||||
indent([&]() {
|
||||
for (auto symbol : parse_table.symbols)
|
||||
line("[" + symbol_id(symbol) + "] = \"" + symbol_name(symbol) + "\",");
|
||||
|
|
@ -99,7 +99,7 @@ class CCodeGenerator {
|
|||
}
|
||||
|
||||
void hidden_symbols_list() {
|
||||
line("HIDDEN_SYMBOLS = {");
|
||||
line("static const int ts_hidden_symbol_flags[SYMBOL_COUNT] = {");
|
||||
indent([&]() {
|
||||
for (auto &symbol : parse_table.symbols)
|
||||
if (!symbol.is_built_in() &&
|
||||
|
|
@ -111,7 +111,7 @@ class CCodeGenerator {
|
|||
}
|
||||
|
||||
void lex_function() {
|
||||
line("LEX_FN() {");
|
||||
line("static TSTree *ts_lex(TSLexer *lexer, TSStateId lex_state) {");
|
||||
indent([&]() {
|
||||
line("START_LEXER();");
|
||||
switch_on_lex_state();
|
||||
|
|
@ -121,7 +121,7 @@ class CCodeGenerator {
|
|||
}
|
||||
|
||||
void lex_states_list() {
|
||||
line("LEX_STATES = {");
|
||||
line("static TSStateId ts_lex_states[STATE_COUNT] = {");
|
||||
indent([&]() {
|
||||
size_t state_id = 0;
|
||||
for (auto &state : parse_table.states)
|
||||
|
|
@ -137,7 +137,7 @@ class CCodeGenerator {
|
|||
line("#pragma GCC diagnostic push");
|
||||
line("#pragma GCC diagnostic ignored \"-Wmissing-field-initializers\"");
|
||||
line();
|
||||
line("PARSE_TABLE = {");
|
||||
line("static const TSParseAction ts_parse_actions[STATE_COUNT][SYMBOL_COUNT] = {");
|
||||
|
||||
indent([&]() {
|
||||
for (auto &state : parse_table.states) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue