From 07f6a311b2f36ec56f23c432b2473a309ac9a7a2 Mon Sep 17 00:00:00 2001 From: JellyApple102 Date: Thu, 23 Sep 2021 22:58:36 -0400 Subject: [PATCH] update string punctuation --- grammar.js | 2 +- src/grammar.json | 2 +- src/parser.c | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/grammar.js b/grammar.js index 72ae457..a00cf91 100644 --- a/grammar.js +++ b/grammar.js @@ -36,7 +36,7 @@ module.exports = grammar({ large: $ => /[A-Z_\d]+/, - string: $ => /[A-Za-z \-,.']+/, + string: $ => /[A-Za-z \-,.'/\\]+/, separator: $ => /:/, diff --git a/src/grammar.json b/src/grammar.json index e6c80bd..858a2f5 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -121,7 +121,7 @@ }, "string": { "type": "PATTERN", - "value": "[A-Za-z \\-,.']+" + "value": "[A-Za-z \\-,.'/\\\\]+" }, "separator": { "type": "PATTERN", diff --git a/src/parser.c b/src/parser.c index 9ab41cc..637ad08 100644 --- a/src/parser.c +++ b/src/parser.c @@ -182,7 +182,8 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (('0' <= lookahead && lookahead <= '9')) ADVANCE(9); if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(7); if (lookahead == '\'' || - (',' <= lookahead && lookahead <= '.') || + (',' <= lookahead && lookahead <= '/') || + lookahead == '\\' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(11); END_STATE(); case 2: @@ -220,7 +221,8 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(7); if (lookahead == ' ' || lookahead == '\'' || - (',' <= lookahead && lookahead <= '.') || + (',' <= lookahead && lookahead <= '/') || + lookahead == '\\' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(11); END_STATE(); case 8: @@ -239,15 +241,17 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (('0' <= lookahead && lookahead <= '9')) ADVANCE(9); if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(7); if (lookahead == '\'' || - (',' <= lookahead && lookahead <= '.') || + (',' <= lookahead && lookahead <= '/') || + lookahead == '\\' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(11); END_STATE(); case 11: ACCEPT_TOKEN(sym_string); if (lookahead == ' ' || lookahead == '\'' || - (',' <= lookahead && lookahead <= '.') || + (',' <= lookahead && lookahead <= '/') || ('A' <= lookahead && lookahead <= 'Z') || + lookahead == '\\' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(11); END_STATE(); case 12: