diff options
-rw-r--r-- | grammar.js | 4 | ||||
-rw-r--r-- | src/grammar.json | 4 | ||||
-rw-r--r-- | src/parser.c | 40 |
3 files changed, 24 insertions, 24 deletions
@@ -43,8 +43,8 @@ module.exports = grammar({ ), ), - class_shorthand: $ => /\.[a-zA-Z0-9_-]+/, - id_shorthand: $ => /#[a-zA-Z0-9_-]+/, + class_shorthand: $ => /\.[^\s]+/, + id_shorthand: $ => /#[^\s]+/, attribute_name: $ => /[a-zA-Z0-9_-]+/, attribute_value: $ => /"(\\.|[^"\\])*"/, 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); |