From 9b1cb1838cd27135a41a416c5f25a54111ccf1b1 Mon Sep 17 00:00:00 2001 From: Rokas Puzonas Date: Tue, 27 Jun 2023 15:01:46 +0300 Subject: [PATCH] update parser.c --- src/grammar.json | 2 +- src/parser.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/grammar.json b/src/grammar.json index aa84e27..cb8df32 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -19,7 +19,7 @@ }, "_name_fragment": { "type": "PATTERN", - "value": "[A-Za-z0-9]+" + "value": "[A-Za-z0-9_]+" }, "name": { "type": "CHOICE", diff --git a/src/parser.c b/src/parser.c index 3c8eb64..ac84698 100644 --- a/src/parser.c +++ b/src/parser.c @@ -296,6 +296,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (anon_sym_DQUOTE_character_set_1(lookahead)) SKIP(0) if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 1: @@ -305,6 +306,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (anon_sym_DQUOTE_character_set_1(lookahead)) SKIP(1) if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 2: @@ -409,6 +411,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'a') ADVANCE(28); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('b' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 27: @@ -416,6 +419,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'a') ADVANCE(32); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('b' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 28: @@ -423,6 +427,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'c') ADVANCE(36); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 29: @@ -430,6 +435,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'e') ADVANCE(56); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 30: @@ -437,6 +443,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'f') ADVANCE(34); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 31: @@ -444,6 +451,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'g') ADVANCE(54); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 32: @@ -451,6 +459,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'g') ADVANCE(29); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 33: @@ -458,6 +467,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'i') ADVANCE(42); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 34: @@ -465,6 +475,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'i') ADVANCE(31); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 35: @@ -472,6 +483,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'i') ADVANCE(40); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 36: @@ -479,6 +491,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'k') ADVANCE(27); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 37: @@ -486,6 +499,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'n') ADVANCE(30); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 38: @@ -493,6 +507,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'n') ADVANCE(58); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 39: @@ -500,6 +515,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'o') ADVANCE(37); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 40: @@ -507,6 +523,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'o') ADVANCE(38); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 41: @@ -514,6 +531,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'p') ADVANCE(44); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 42: @@ -521,6 +539,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 's') ADVANCE(43); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 43: @@ -528,6 +547,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 't') ADVANCE(60); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 44: @@ -535,12 +555,14 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 't') ADVANCE(35); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 45: ACCEPT_TOKEN(sym__name_fragment); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 46: @@ -601,6 +623,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { ACCEPT_TOKEN(anon_sym_config); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 55: @@ -610,6 +633,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { ACCEPT_TOKEN(anon_sym_package); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 57: @@ -619,6 +643,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { ACCEPT_TOKEN(anon_sym_option); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 59: @@ -628,6 +653,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { ACCEPT_TOKEN(anon_sym_list); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 61: