From 39af2e5e72ca1eaa4a3dd05c785d3e0c31705ca5 Mon Sep 17 00:00:00 2001 From: JellyApple102 Date: Thu, 23 Sep 2021 23:07:02 -0400 Subject: [PATCH] update string punctuation --- grammar.js | 2 +- src/grammar.json | 2 +- src/parser.c | 4 ++++ test/corpus/test.txt | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/grammar.js b/grammar.js index a00cf91..3445f28 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 858a2f5..d82124b 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 637ad08..7b63f2b 100644 --- a/src/parser.c +++ b/src/parser.c @@ -183,6 +183,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(7); if (lookahead == '\'' || (',' <= lookahead && lookahead <= '/') || + lookahead == '=' || lookahead == '\\' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(11); END_STATE(); @@ -222,6 +223,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == ' ' || lookahead == '\'' || (',' <= lookahead && lookahead <= '/') || + lookahead == '=' || lookahead == '\\' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(11); END_STATE(); @@ -242,6 +244,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (('A' <= lookahead && lookahead <= 'Z')) ADVANCE(7); if (lookahead == '\'' || (',' <= lookahead && lookahead <= '/') || + lookahead == '=' || lookahead == '\\' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(11); END_STATE(); @@ -250,6 +253,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == ' ' || lookahead == '\'' || (',' <= lookahead && lookahead <= '/') || + lookahead == '=' || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '\\' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(11); diff --git a/test/corpus/test.txt b/test/corpus/test.txt index 98bf9d6..5b4fa0f 100644 --- a/test/corpus/test.txt +++ b/test/corpus/test.txt @@ -7,7 +7,7 @@ opening_comment [TEST:BODY_1PART] comment here [MULTIPLE:string:123:LARGE] [SINGLE_TEST] - [HERE:A string, contating lot's of diffent-punctuation.] + [HERE:A string, contating=lot's of diffent-punctuation.] ---