From 2483cbddd9e7a02296bb928462ba7eb22551752d Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 28 Oct 2023 02:15:21 +0200 Subject: Allow ID- and class shorthands to have anything --- src/grammar.json | 4 ++-- src/parser.c | 40 ++++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/grammar.json b/src/grammar.json index bc4e69c..150b1a5 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -180,11 +180,11 @@ }, "class_shorthand": { "type": "PATTERN", - "value": "\\.[a-zA-Z0-9_-]+" + "value": "\\.[^\\s]+" }, "id_shorthand": { "type": "PATTERN", - "value": "#[a-zA-Z0-9_-]+" + "value": "#[^\\s]+" }, "attribute_name": { "type": "PATTERN", diff --git a/src/parser.c b/src/parser.c index 983827a..97761e6 100644 --- a/src/parser.c +++ b/src/parser.c @@ -336,18 +336,18 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead != 0) ADVANCE(16); END_STATE(); case 4: - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); + if (lookahead != 0 && + lookahead != '\t' && + lookahead != '\n' && + lookahead != '\r' && + lookahead != ' ') ADVANCE(19); END_STATE(); case 5: - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(18); + if (lookahead != 0 && + lookahead != '\t' && + lookahead != '\n' && + lookahead != '\r' && + lookahead != ' ') ADVANCE(18); END_STATE(); case 6: if (lookahead != 0 && @@ -403,19 +403,19 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 18: ACCEPT_TOKEN(sym_class_shorthand); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(18); + if (lookahead != 0 && + lookahead != '\t' && + lookahead != '\n' && + lookahead != '\r' && + lookahead != ' ') ADVANCE(18); END_STATE(); case 19: ACCEPT_TOKEN(sym_id_shorthand); - if (lookahead == '-' || - ('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'Z') || - lookahead == '_' || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); + if (lookahead != 0 && + lookahead != '\t' && + lookahead != '\n' && + lookahead != '\r' && + lookahead != ' ') ADVANCE(19); END_STATE(); case 20: ACCEPT_TOKEN(sym_attribute_name); -- cgit v1.2.3