update regex

This commit is contained in:
JellyApple102 2021-09-29 11:01:10 -04:00
parent 3f9d50fe9b
commit 80ec7d3a8a
4 changed files with 361 additions and 291 deletions

View File

@ -30,7 +30,8 @@ module.exports = grammar({
$.string, $.string,
), ),
declaration: $ => /[A-Z_0-9]+/, // same as `reference`, different rule to give it different highlighting group
declaration: $ => /(?:VOLUME_mB)|(?:!?[0-9]*[A-Z][A-Z_0-9]*)/,
number: $ => /-?[0-9]+/, number: $ => /-?[0-9]+/,

View File

@ -102,7 +102,7 @@
}, },
"declaration": { "declaration": {
"type": "PATTERN", "type": "PATTERN",
"value": "[A-Z_0-9]+" "value": "(?:VOLUME_mB)|(?:!?[0-9]*[A-Z][A-Z_0-9]*)"
}, },
"number": { "number": {
"type": "PATTERN", "type": "PATTERN",

View File

@ -14,6 +14,11 @@
] ]
} }
}, },
{
"type": "declaration",
"named": true,
"fields": {}
},
{ {
"type": "parameter_list", "type": "parameter_list",
"named": true, "named": true,
@ -45,6 +50,11 @@
] ]
} }
}, },
{
"type": "reference",
"named": true,
"fields": {}
},
{ {
"type": "source_file", "type": "source_file",
"named": true, "named": true,
@ -76,18 +86,10 @@
"type": "comment", "type": "comment",
"named": true "named": true
}, },
{
"type": "declaration",
"named": true
},
{ {
"type": "number", "type": "number",
"named": true "named": true
}, },
{
"type": "reference",
"named": true
},
{ {
"type": "separator", "type": "separator",
"named": true "named": true

View File

@ -6,11 +6,11 @@
#endif #endif
#define LANGUAGE_VERSION 13 #define LANGUAGE_VERSION 13
#define STATE_COUNT 15 #define STATE_COUNT 17
#define LARGE_STATE_COUNT 2 #define LARGE_STATE_COUNT 2
#define SYMBOL_COUNT 16 #define SYMBOL_COUNT 17
#define ALIAS_COUNT 0 #define ALIAS_COUNT 0
#define TOKEN_COUNT 9 #define TOKEN_COUNT 8
#define EXTERNAL_TOKEN_COUNT 0 #define EXTERNAL_TOKEN_COUNT 0
#define FIELD_COUNT 0 #define FIELD_COUNT 0
#define MAX_ALIAS_SEQUENCE_LENGTH 3 #define MAX_ALIAS_SEQUENCE_LENGTH 3
@ -19,28 +19,28 @@
enum { enum {
anon_sym_LBRACK = 1, anon_sym_LBRACK = 1,
anon_sym_RBRACK = 2, anon_sym_RBRACK = 2,
sym_declaration = 3, aux_sym_declaration_token1 = 3,
sym_number = 4, sym_number = 4,
sym_reference = 5, sym_string = 5,
sym_string = 6, sym_separator = 6,
sym_separator = 7, sym_comment = 7,
sym_comment = 8, sym_source_file = 8,
sym_source_file = 9, sym__statement = 9,
sym__statement = 10, sym_bracket_statement = 10,
sym_bracket_statement = 11, sym_parameter_list = 11,
sym_parameter_list = 12, sym__parameter = 12,
sym__parameter = 13, sym_declaration = 13,
aux_sym_source_file_repeat1 = 14, sym_reference = 14,
aux_sym_parameter_list_repeat1 = 15, aux_sym_source_file_repeat1 = 15,
aux_sym_parameter_list_repeat1 = 16,
}; };
static const char * const ts_symbol_names[] = { static const char * const ts_symbol_names[] = {
[ts_builtin_sym_end] = "end", [ts_builtin_sym_end] = "end",
[anon_sym_LBRACK] = "[", [anon_sym_LBRACK] = "[",
[anon_sym_RBRACK] = "]", [anon_sym_RBRACK] = "]",
[sym_declaration] = "declaration", [aux_sym_declaration_token1] = "declaration_token1",
[sym_number] = "number", [sym_number] = "number",
[sym_reference] = "reference",
[sym_string] = "string", [sym_string] = "string",
[sym_separator] = "separator", [sym_separator] = "separator",
[sym_comment] = "comment", [sym_comment] = "comment",
@ -49,6 +49,8 @@ static const char * const ts_symbol_names[] = {
[sym_bracket_statement] = "bracket_statement", [sym_bracket_statement] = "bracket_statement",
[sym_parameter_list] = "parameter_list", [sym_parameter_list] = "parameter_list",
[sym__parameter] = "_parameter", [sym__parameter] = "_parameter",
[sym_declaration] = "declaration",
[sym_reference] = "reference",
[aux_sym_source_file_repeat1] = "source_file_repeat1", [aux_sym_source_file_repeat1] = "source_file_repeat1",
[aux_sym_parameter_list_repeat1] = "parameter_list_repeat1", [aux_sym_parameter_list_repeat1] = "parameter_list_repeat1",
}; };
@ -57,9 +59,8 @@ static const TSSymbol ts_symbol_map[] = {
[ts_builtin_sym_end] = ts_builtin_sym_end, [ts_builtin_sym_end] = ts_builtin_sym_end,
[anon_sym_LBRACK] = anon_sym_LBRACK, [anon_sym_LBRACK] = anon_sym_LBRACK,
[anon_sym_RBRACK] = anon_sym_RBRACK, [anon_sym_RBRACK] = anon_sym_RBRACK,
[sym_declaration] = sym_declaration, [aux_sym_declaration_token1] = aux_sym_declaration_token1,
[sym_number] = sym_number, [sym_number] = sym_number,
[sym_reference] = sym_reference,
[sym_string] = sym_string, [sym_string] = sym_string,
[sym_separator] = sym_separator, [sym_separator] = sym_separator,
[sym_comment] = sym_comment, [sym_comment] = sym_comment,
@ -68,6 +69,8 @@ static const TSSymbol ts_symbol_map[] = {
[sym_bracket_statement] = sym_bracket_statement, [sym_bracket_statement] = sym_bracket_statement,
[sym_parameter_list] = sym_parameter_list, [sym_parameter_list] = sym_parameter_list,
[sym__parameter] = sym__parameter, [sym__parameter] = sym__parameter,
[sym_declaration] = sym_declaration,
[sym_reference] = sym_reference,
[aux_sym_source_file_repeat1] = aux_sym_source_file_repeat1, [aux_sym_source_file_repeat1] = aux_sym_source_file_repeat1,
[aux_sym_parameter_list_repeat1] = aux_sym_parameter_list_repeat1, [aux_sym_parameter_list_repeat1] = aux_sym_parameter_list_repeat1,
}; };
@ -85,18 +88,14 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = true, .visible = true,
.named = false, .named = false,
}, },
[sym_declaration] = { [aux_sym_declaration_token1] = {
.visible = true, .visible = false,
.named = true, .named = false,
}, },
[sym_number] = { [sym_number] = {
.visible = true, .visible = true,
.named = true, .named = true,
}, },
[sym_reference] = {
.visible = true,
.named = true,
},
[sym_string] = { [sym_string] = {
.visible = true, .visible = true,
.named = true, .named = true,
@ -129,6 +128,14 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = false, .visible = false,
.named = true, .named = true,
}, },
[sym_declaration] = {
.visible = true,
.named = true,
},
[sym_reference] = {
.visible = true,
.named = true,
},
[aux_sym_source_file_repeat1] = { [aux_sym_source_file_repeat1] = {
.visible = false, .visible = false,
.named = false, .named = false,
@ -152,243 +159,269 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
eof = lexer->eof(lexer); eof = lexer->eof(lexer);
switch (state) { switch (state) {
case 0: case 0:
if (eof) ADVANCE(7); if (eof) ADVANCE(6);
if (lookahead == '!') ADVANCE(3);
if (lookahead == '-') ADVANCE(4); if (lookahead == '-') ADVANCE(4);
if (lookahead == ':') ADVANCE(28); if (lookahead == ':') ADVANCE(32);
if (lookahead == '[') ADVANCE(8); if (lookahead == 'V') ADVANCE(16);
if (lookahead == ']') ADVANCE(9); if (lookahead == '[') ADVANCE(7);
if (lookahead == ']') ADVANCE(8);
if (lookahead == '\t' || if (lookahead == '\t' ||
lookahead == '\n' || lookahead == '\n' ||
lookahead == '\r' || lookahead == '\r' ||
lookahead == ' ') SKIP(0) lookahead == ' ') SKIP(0)
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(10); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(25);
if (('A' <= lookahead && lookahead <= 'Z') || if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(24);
lookahead == '_') ADVANCE(11);
END_STATE(); END_STATE();
case 1: case 1:
if (lookahead == ' ') ADVANCE(25); if (lookahead == ' ') ADVANCE(29);
if (lookahead == '!') ADVANCE(5); if (lookahead == '!') ADVANCE(3);
if (lookahead == '-') ADVANCE(26); if (lookahead == '-') ADVANCE(30);
if (lookahead == ':') ADVANCE(28); if (lookahead == ':') ADVANCE(32);
if (lookahead == 'V') ADVANCE(19); if (lookahead == 'V') ADVANCE(17);
if (lookahead == ']') ADVANCE(9); if (lookahead == ']') ADVANCE(8);
if (lookahead == '\t' || if (lookahead == '\t' ||
lookahead == '\n' || lookahead == '\n' ||
lookahead == '\r') SKIP(1) lookahead == '\r') SKIP(1)
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(13); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(27);
if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(21); if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(20);
if (lookahead == '\'' || if (lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') || (',' <= lookahead && lookahead <= '/') ||
lookahead == '=' || lookahead == '=' ||
lookahead == '\\' || lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
END_STATE(); END_STATE();
case 2: case 2:
if (lookahead == 'B') ADVANCE(15); if (lookahead == 'B') ADVANCE(9);
END_STATE(); END_STATE();
case 3: case 3:
if (lookahead == '\t' || if (('0' <= lookahead && lookahead <= '9')) ADVANCE(3);
lookahead == '\n' ||
lookahead == '\r' ||
lookahead == ' ') SKIP(3)
if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_') ADVANCE(11);
END_STATE();
case 4:
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(12);
END_STATE();
case 5:
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(5);
if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(24); if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(24);
END_STATE(); END_STATE();
case 6: case 4:
if (eof) ADVANCE(7); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(26);
if (lookahead == '[') ADVANCE(8); END_STATE();
case 5:
if (eof) ADVANCE(6);
if (lookahead == '[') ADVANCE(7);
if (lookahead == '\t' || if (lookahead == '\t' ||
lookahead == '\n' || lookahead == '\n' ||
lookahead == '\r' || lookahead == '\r' ||
lookahead == ' ') SKIP(6) lookahead == ' ') SKIP(5)
if (lookahead != 0 && if (lookahead != 0 &&
lookahead != ']') ADVANCE(29); lookahead != ']') ADVANCE(33);
END_STATE(); END_STATE();
case 7: case 6:
ACCEPT_TOKEN(ts_builtin_sym_end); ACCEPT_TOKEN(ts_builtin_sym_end);
END_STATE(); END_STATE();
case 8: case 7:
ACCEPT_TOKEN(anon_sym_LBRACK); ACCEPT_TOKEN(anon_sym_LBRACK);
END_STATE(); END_STATE();
case 9: case 8:
ACCEPT_TOKEN(anon_sym_RBRACK); ACCEPT_TOKEN(anon_sym_RBRACK);
END_STATE(); END_STATE();
case 9:
ACCEPT_TOKEN(aux_sym_declaration_token1);
END_STATE();
case 10: case 10:
ACCEPT_TOKEN(sym_declaration); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(10); if (lookahead == 'E') ADVANCE(22);
if (('A' <= lookahead && lookahead <= 'Z') || if (('0' <= lookahead && lookahead <= '9') ||
lookahead == '_') ADVANCE(11); ('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_') ADVANCE(24);
END_STATE(); END_STATE();
case 11: case 11:
ACCEPT_TOKEN(sym_declaration); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (lookahead == 'E') ADVANCE(21);
if (lookahead == '_') ADVANCE(24);
if (lookahead == ' ' ||
lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') ||
lookahead == '=' ||
lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
if (('0' <= lookahead && lookahead <= '9') || if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z') || ('A' <= lookahead && lookahead <= 'Z')) ADVANCE(20);
lookahead == '_') ADVANCE(11);
END_STATE(); END_STATE();
case 12: case 12:
ACCEPT_TOKEN(sym_number); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(12); if (lookahead == 'L') ADVANCE(18);
if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_') ADVANCE(24);
END_STATE(); END_STATE();
case 13: case 13:
ACCEPT_TOKEN(sym_number); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(13); if (lookahead == 'L') ADVANCE(19);
if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(21); if (lookahead == '_') ADVANCE(24);
if (lookahead == ' ' || if (lookahead == ' ' ||
lookahead == '\'' || lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') || (',' <= lookahead && lookahead <= '/') ||
lookahead == '=' || lookahead == '=' ||
lookahead == '\\' || lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z')) ADVANCE(20);
END_STATE(); END_STATE();
case 14: case 14:
ACCEPT_TOKEN(sym_number); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(14); if (lookahead == 'M') ADVANCE(10);
if (lookahead == ' ' || if (('0' <= lookahead && lookahead <= '9') ||
lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') ||
lookahead == '=' ||
('A' <= lookahead && lookahead <= 'Z') || ('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '\\' || lookahead == '_') ADVANCE(24);
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27);
END_STATE(); END_STATE();
case 15: case 15:
ACCEPT_TOKEN(sym_reference); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (lookahead == 'M') ADVANCE(11);
if (lookahead == '_') ADVANCE(24);
if (lookahead == ' ' ||
lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') ||
lookahead == '=' ||
lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z')) ADVANCE(20);
END_STATE(); END_STATE();
case 16: case 16:
ACCEPT_TOKEN(sym_reference); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (lookahead == 'E') ADVANCE(22); if (lookahead == 'O') ADVANCE(12);
if (lookahead == '_') ADVANCE(24);
if (lookahead == ' ' ||
lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') ||
lookahead == '=' ||
lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27);
if (('0' <= lookahead && lookahead <= '9') || if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z')) ADVANCE(21); ('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_') ADVANCE(24);
END_STATE(); END_STATE();
case 17: case 17:
ACCEPT_TOKEN(sym_reference); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (lookahead == 'L') ADVANCE(20); if (lookahead == 'O') ADVANCE(13);
if (lookahead == '_') ADVANCE(24); if (lookahead == '_') ADVANCE(24);
if (lookahead == ' ' || if (lookahead == ' ' ||
lookahead == '\'' || lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') || (',' <= lookahead && lookahead <= '/') ||
lookahead == '=' || lookahead == '=' ||
lookahead == '\\' || lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
if (('0' <= lookahead && lookahead <= '9') || if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z')) ADVANCE(21); ('A' <= lookahead && lookahead <= 'Z')) ADVANCE(20);
END_STATE(); END_STATE();
case 18: case 18:
ACCEPT_TOKEN(sym_reference); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (lookahead == 'M') ADVANCE(16); if (lookahead == 'U') ADVANCE(14);
if (lookahead == '_') ADVANCE(24);
if (lookahead == ' ' ||
lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') ||
lookahead == '=' ||
lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27);
if (('0' <= lookahead && lookahead <= '9') || if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z')) ADVANCE(21); ('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_') ADVANCE(24);
END_STATE(); END_STATE();
case 19: case 19:
ACCEPT_TOKEN(sym_reference); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (lookahead == 'O') ADVANCE(17); if (lookahead == 'U') ADVANCE(15);
if (lookahead == '_') ADVANCE(24); if (lookahead == '_') ADVANCE(24);
if (lookahead == ' ' || if (lookahead == ' ' ||
lookahead == '\'' || lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') || (',' <= lookahead && lookahead <= '/') ||
lookahead == '=' || lookahead == '=' ||
lookahead == '\\' || lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
if (('0' <= lookahead && lookahead <= '9') || if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z')) ADVANCE(21); ('A' <= lookahead && lookahead <= 'Z')) ADVANCE(20);
END_STATE(); END_STATE();
case 20: case 20:
ACCEPT_TOKEN(sym_reference); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (lookahead == 'U') ADVANCE(18);
if (lookahead == '_') ADVANCE(24); if (lookahead == '_') ADVANCE(24);
if (lookahead == ' ' || if (lookahead == ' ' ||
lookahead == '\'' || lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') || (',' <= lookahead && lookahead <= '/') ||
lookahead == '=' || lookahead == '=' ||
lookahead == '\\' || lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
if (('0' <= lookahead && lookahead <= '9') || if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z')) ADVANCE(21); ('A' <= lookahead && lookahead <= 'Z')) ADVANCE(20);
END_STATE(); END_STATE();
case 21: case 21:
ACCEPT_TOKEN(sym_reference); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (lookahead == '_') ADVANCE(24);
if (lookahead == ' ' ||
lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') ||
lookahead == '=' ||
lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27);
if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z')) ADVANCE(21);
END_STATE();
case 22:
ACCEPT_TOKEN(sym_reference);
if (lookahead == '_') ADVANCE(23); if (lookahead == '_') ADVANCE(23);
if (lookahead == ' ' || if (lookahead == ' ' ||
lookahead == '\'' || lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') || (',' <= lookahead && lookahead <= '/') ||
lookahead == '=' || lookahead == '=' ||
lookahead == '\\' || lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
if (('0' <= lookahead && lookahead <= '9') || if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z')) ADVANCE(21); ('A' <= lookahead && lookahead <= 'Z')) ADVANCE(20);
END_STATE();
case 22:
ACCEPT_TOKEN(aux_sym_declaration_token1);
if (lookahead == '_') ADVANCE(23);
if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z')) ADVANCE(24);
END_STATE(); END_STATE();
case 23: case 23:
ACCEPT_TOKEN(sym_reference); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (lookahead == 'm') ADVANCE(2); if (lookahead == 'm') ADVANCE(2);
if (('0' <= lookahead && lookahead <= '9') || if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z') || ('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_') ADVANCE(24); lookahead == '_') ADVANCE(24);
END_STATE(); END_STATE();
case 24: case 24:
ACCEPT_TOKEN(sym_reference); ACCEPT_TOKEN(aux_sym_declaration_token1);
if (('0' <= lookahead && lookahead <= '9') || if (('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z') || ('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_') ADVANCE(24); lookahead == '_') ADVANCE(24);
END_STATE(); END_STATE();
case 25: case 25:
ACCEPT_TOKEN(sym_string); ACCEPT_TOKEN(sym_number);
if (lookahead == ' ') ADVANCE(25); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(25);
if (lookahead == '-') ADVANCE(26); if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(24);
if (lookahead == 'V') ADVANCE(19); END_STATE();
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(13); case 26:
if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(21); ACCEPT_TOKEN(sym_number);
if (lookahead == '\'' || if (('0' <= lookahead && lookahead <= '9')) ADVANCE(26);
END_STATE();
case 27:
ACCEPT_TOKEN(sym_number);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(27);
if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(20);
if (lookahead == ' ' ||
lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') || (',' <= lookahead && lookahead <= '/') ||
lookahead == '=' || lookahead == '=' ||
lookahead == '\\' || lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
END_STATE(); END_STATE();
case 26: case 28:
ACCEPT_TOKEN(sym_string); ACCEPT_TOKEN(sym_number);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(14); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(28);
if (lookahead == ' ' || if (lookahead == ' ' ||
lookahead == '\'' || lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') || (',' <= lookahead && lookahead <= '/') ||
lookahead == '=' || lookahead == '=' ||
('A' <= lookahead && lookahead <= 'Z') || ('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '\\' || lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
END_STATE(); END_STATE();
case 27: case 29:
ACCEPT_TOKEN(sym_string);
if (lookahead == ' ') ADVANCE(29);
if (lookahead == '-') ADVANCE(30);
if (lookahead == 'V') ADVANCE(17);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(27);
if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(20);
if (lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') ||
lookahead == '=' ||
lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
END_STATE();
case 30:
ACCEPT_TOKEN(sym_string);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(28);
if (lookahead == ' ' ||
lookahead == '\'' ||
(',' <= lookahead && lookahead <= '/') ||
lookahead == '=' ||
('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
END_STATE();
case 31:
ACCEPT_TOKEN(sym_string); ACCEPT_TOKEN(sym_string);
if (lookahead == ' ' || if (lookahead == ' ' ||
lookahead == '\'' || lookahead == '\'' ||
@ -396,12 +429,12 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
lookahead == '=' || lookahead == '=' ||
('A' <= lookahead && lookahead <= 'Z') || ('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '\\' || lookahead == '\\' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31);
END_STATE(); END_STATE();
case 28: case 32:
ACCEPT_TOKEN(sym_separator); ACCEPT_TOKEN(sym_separator);
END_STATE(); END_STATE();
case 29: case 33:
ACCEPT_TOKEN(sym_comment); ACCEPT_TOKEN(sym_comment);
if (lookahead != 0 && if (lookahead != 0 &&
lookahead != '\t' && lookahead != '\t' &&
@ -409,7 +442,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
lookahead != '\r' && lookahead != '\r' &&
lookahead != ' ' && lookahead != ' ' &&
lookahead != '[' && lookahead != '[' &&
lookahead != ']') ADVANCE(29); lookahead != ']') ADVANCE(33);
END_STATE(); END_STATE();
default: default:
return false; return false;
@ -418,20 +451,22 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
static const TSLexMode ts_lex_modes[STATE_COUNT] = { static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[0] = {.lex_state = 0}, [0] = {.lex_state = 0},
[1] = {.lex_state = 6}, [1] = {.lex_state = 5},
[2] = {.lex_state = 1}, [2] = {.lex_state = 1},
[3] = {.lex_state = 6}, [3] = {.lex_state = 1},
[4] = {.lex_state = 6}, [4] = {.lex_state = 1},
[5] = {.lex_state = 1}, [5] = {.lex_state = 1},
[6] = {.lex_state = 1}, [6] = {.lex_state = 1},
[7] = {.lex_state = 1}, [7] = {.lex_state = 5},
[8] = {.lex_state = 1}, [8] = {.lex_state = 5},
[9] = {.lex_state = 1}, [9] = {.lex_state = 1},
[10] = {.lex_state = 1}, [10] = {.lex_state = 1},
[11] = {.lex_state = 6}, [11] = {.lex_state = 1},
[12] = {.lex_state = 3}, [12] = {.lex_state = 1},
[13] = {.lex_state = 0}, [13] = {.lex_state = 0},
[14] = {.lex_state = 0}, [14] = {.lex_state = 5},
[15] = {.lex_state = 0},
[16] = {.lex_state = 0},
}; };
static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
@ -439,15 +474,15 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
[ts_builtin_sym_end] = ACTIONS(1), [ts_builtin_sym_end] = ACTIONS(1),
[anon_sym_LBRACK] = ACTIONS(1), [anon_sym_LBRACK] = ACTIONS(1),
[anon_sym_RBRACK] = ACTIONS(1), [anon_sym_RBRACK] = ACTIONS(1),
[sym_declaration] = ACTIONS(1), [aux_sym_declaration_token1] = ACTIONS(1),
[sym_number] = ACTIONS(1), [sym_number] = ACTIONS(1),
[sym_separator] = ACTIONS(1), [sym_separator] = ACTIONS(1),
}, },
[1] = { [1] = {
[sym_source_file] = STATE(13), [sym_source_file] = STATE(15),
[sym__statement] = STATE(3), [sym__statement] = STATE(7),
[sym_bracket_statement] = STATE(3), [sym_bracket_statement] = STATE(7),
[aux_sym_source_file_repeat1] = STATE(3), [aux_sym_source_file_repeat1] = STATE(7),
[ts_builtin_sym_end] = ACTIONS(3), [ts_builtin_sym_end] = ACTIONS(3),
[anon_sym_LBRACK] = ACTIONS(5), [anon_sym_LBRACK] = ACTIONS(5),
[sym_comment] = ACTIONS(7), [sym_comment] = ACTIONS(7),
@ -455,157 +490,189 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
}; };
static const uint16_t ts_small_parse_table[] = { static const uint16_t ts_small_parse_table[] = {
[0] = 5, [0] = 6,
ACTIONS(9), 1, ACTIONS(9), 1,
anon_sym_RBRACK, anon_sym_RBRACK,
ACTIONS(13), 1, ACTIONS(11), 1,
aux_sym_declaration_token1,
ACTIONS(15), 1,
sym_separator, sym_separator,
STATE(4), 1,
aux_sym_parameter_list_repeat1,
ACTIONS(13), 2,
sym_number,
sym_string,
STATE(11), 2,
sym__parameter,
sym_reference,
[21] = 5,
ACTIONS(11), 1,
aux_sym_declaration_token1,
ACTIONS(17), 1,
anon_sym_RBRACK,
STATE(5), 1,
aux_sym_parameter_list_repeat1,
ACTIONS(13), 2,
sym_number,
sym_string,
STATE(11), 2,
sym__parameter,
sym_reference,
[39] = 5,
ACTIONS(11), 1,
aux_sym_declaration_token1,
ACTIONS(17), 1,
anon_sym_RBRACK,
STATE(6), 1, STATE(6), 1,
aux_sym_parameter_list_repeat1, aux_sym_parameter_list_repeat1,
STATE(9), 1, ACTIONS(13), 2,
sym__parameter,
ACTIONS(11), 3,
sym_number, sym_number,
sym_reference,
sym_string, sym_string,
[18] = 4, STATE(11), 2,
sym__parameter,
sym_reference,
[57] = 5,
ACTIONS(11), 1,
aux_sym_declaration_token1,
ACTIONS(19), 1,
anon_sym_RBRACK,
STATE(6), 1,
aux_sym_parameter_list_repeat1,
ACTIONS(13), 2,
sym_number,
sym_string,
STATE(11), 2,
sym__parameter,
sym_reference,
[75] = 5,
ACTIONS(21), 1,
anon_sym_RBRACK,
ACTIONS(23), 1,
aux_sym_declaration_token1,
STATE(6), 1,
aux_sym_parameter_list_repeat1,
ACTIONS(26), 2,
sym_number,
sym_string,
STATE(11), 2,
sym__parameter,
sym_reference,
[93] = 4,
ACTIONS(5), 1, ACTIONS(5), 1,
anon_sym_LBRACK, anon_sym_LBRACK,
ACTIONS(15), 1,
ts_builtin_sym_end,
ACTIONS(17), 1,
sym_comment,
STATE(4), 3,
sym__statement,
sym_bracket_statement,
aux_sym_source_file_repeat1,
[33] = 4,
ACTIONS(19), 1,
ts_builtin_sym_end,
ACTIONS(21), 1,
anon_sym_LBRACK,
ACTIONS(24), 1,
sym_comment,
STATE(4), 3,
sym__statement,
sym_bracket_statement,
aux_sym_source_file_repeat1,
[48] = 4,
ACTIONS(27), 1,
anon_sym_RBRACK,
STATE(7), 1,
aux_sym_parameter_list_repeat1,
STATE(9), 1,
sym__parameter,
ACTIONS(11), 3,
sym_number,
sym_reference,
sym_string,
[63] = 4,
ACTIONS(27), 1,
anon_sym_RBRACK,
STATE(8), 1,
aux_sym_parameter_list_repeat1,
STATE(9), 1,
sym__parameter,
ACTIONS(11), 3,
sym_number,
sym_reference,
sym_string,
[78] = 4,
ACTIONS(29), 1, ACTIONS(29), 1,
anon_sym_RBRACK, ts_builtin_sym_end,
STATE(8), 1,
aux_sym_parameter_list_repeat1,
STATE(9), 1,
sym__parameter,
ACTIONS(11), 3,
sym_number,
sym_reference,
sym_string,
[93] = 4,
ACTIONS(31), 1, ACTIONS(31), 1,
anon_sym_RBRACK, sym_comment,
STATE(8), 1, STATE(8), 3,
aux_sym_parameter_list_repeat1, sym__statement,
STATE(9), 1, sym_bracket_statement,
sym__parameter, aux_sym_source_file_repeat1,
ACTIONS(33), 3, [108] = 4,
sym_number, ACTIONS(33), 1,
sym_reference, ts_builtin_sym_end,
sym_string, ACTIONS(35), 1,
[108] = 2, anon_sym_LBRACK,
ACTIONS(38), 1, ACTIONS(38), 1,
sym_comment,
STATE(8), 3,
sym__statement,
sym_bracket_statement,
aux_sym_source_file_repeat1,
[123] = 1,
ACTIONS(41), 5,
anon_sym_RBRACK,
aux_sym_declaration_token1,
sym_number,
sym_string,
sym_separator, sym_separator,
ACTIONS(36), 4, [131] = 1,
ACTIONS(43), 5,
anon_sym_RBRACK, anon_sym_RBRACK,
aux_sym_declaration_token1,
sym_number, sym_number,
sym_reference,
sym_string, sym_string,
[118] = 1, sym_separator,
ACTIONS(31), 4, [139] = 2,
ACTIONS(47), 1,
sym_separator,
ACTIONS(45), 4,
anon_sym_RBRACK, anon_sym_RBRACK,
aux_sym_declaration_token1,
sym_number, sym_number,
sym_reference,
sym_string, sym_string,
[125] = 1, [149] = 1,
ACTIONS(40), 3, ACTIONS(21), 4,
anon_sym_RBRACK,
aux_sym_declaration_token1,
sym_number,
sym_string,
[156] = 3,
ACTIONS(49), 1,
aux_sym_declaration_token1,
STATE(2), 1,
sym_declaration,
STATE(16), 1,
sym_parameter_list,
[166] = 1,
ACTIONS(51), 3,
ts_builtin_sym_end, ts_builtin_sym_end,
anon_sym_LBRACK, anon_sym_LBRACK,
sym_comment, sym_comment,
[131] = 2, [172] = 1,
ACTIONS(42), 1, ACTIONS(53), 1,
sym_declaration,
STATE(14), 1,
sym_parameter_list,
[138] = 1,
ACTIONS(44), 1,
ts_builtin_sym_end, ts_builtin_sym_end,
[142] = 1, [176] = 1,
ACTIONS(46), 1, ACTIONS(55), 1,
anon_sym_RBRACK, anon_sym_RBRACK,
}; };
static const uint32_t ts_small_parse_table_map[] = { static const uint32_t ts_small_parse_table_map[] = {
[SMALL_STATE(2)] = 0, [SMALL_STATE(2)] = 0,
[SMALL_STATE(3)] = 18, [SMALL_STATE(3)] = 21,
[SMALL_STATE(4)] = 33, [SMALL_STATE(4)] = 39,
[SMALL_STATE(5)] = 48, [SMALL_STATE(5)] = 57,
[SMALL_STATE(6)] = 63, [SMALL_STATE(6)] = 75,
[SMALL_STATE(7)] = 78, [SMALL_STATE(7)] = 93,
[SMALL_STATE(8)] = 93, [SMALL_STATE(8)] = 108,
[SMALL_STATE(9)] = 108, [SMALL_STATE(9)] = 123,
[SMALL_STATE(10)] = 118, [SMALL_STATE(10)] = 131,
[SMALL_STATE(11)] = 125, [SMALL_STATE(11)] = 139,
[SMALL_STATE(12)] = 131, [SMALL_STATE(12)] = 149,
[SMALL_STATE(13)] = 138, [SMALL_STATE(13)] = 156,
[SMALL_STATE(14)] = 142, [SMALL_STATE(14)] = 166,
[SMALL_STATE(15)] = 172,
[SMALL_STATE(16)] = 176,
}; };
static const TSParseActionEntry ts_parse_actions[] = { static const TSParseActionEntry ts_parse_actions[] = {
[0] = {.entry = {.count = 0, .reusable = false}}, [0] = {.entry = {.count = 0, .reusable = false}},
[1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(),
[3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0), [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0),
[5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13),
[7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7),
[9] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_parameter_list, 1), [9] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_parameter_list, 1),
[11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(9), [11] = {.entry = {.count = 1, .reusable = false}}, SHIFT(10),
[13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(5), [13] = {.entry = {.count = 1, .reusable = false}}, SHIFT(11),
[15] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), [15] = {.entry = {.count = 1, .reusable = false}}, SHIFT(3),
[17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), [17] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_parameter_list, 2),
[19] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), [19] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_parameter_list, 3),
[21] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(12), [21] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_parameter_list_repeat1, 2),
[24] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(4), [23] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_parameter_list_repeat1, 2), SHIFT_REPEAT(10),
[27] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_parameter_list, 2), [26] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_parameter_list_repeat1, 2), SHIFT_REPEAT(11),
[29] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_parameter_list, 3), [29] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1),
[31] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_parameter_list_repeat1, 2), [31] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8),
[33] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_parameter_list_repeat1, 2), SHIFT_REPEAT(9), [33] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2),
[36] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_parameter_list_repeat1, 1), [35] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(13),
[38] = {.entry = {.count = 1, .reusable = false}}, SHIFT(10), [38] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(8),
[40] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_bracket_statement, 3), [41] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_declaration, 1),
[42] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), [43] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_reference, 1),
[44] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), [45] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_parameter_list_repeat1, 1),
[46] = {.entry = {.count = 1, .reusable = true}}, SHIFT(11), [47] = {.entry = {.count = 1, .reusable = false}}, SHIFT(12),
[49] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9),
[51] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_bracket_statement, 3),
[53] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(),
[55] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14),
}; };
#ifdef __cplusplus #ifdef __cplusplus