type: preliminarily forbit \; in types

This commit is contained in:
Michael Sippel 2025-06-14 12:56:33 +02:00
parent 831aefb112
commit 41c4428c89
Signed by: senvas
GPG key ID: F96CF119C34B64A6
4 changed files with 5 additions and 3 deletions

View file

@ -21,7 +21,7 @@ module.exports = grammar({
typedef: ($) => prec.right(seq("type", $.ident, "=", $.type, ";")),
morphdef: ($) => prec.right(seq("morph", $.ident, ":", $.type, "=", $.impl, ";")),
ident: ($) => /([a-zA-Z$][0-9a-zA-Z_\-]*)/,
type: ($) => /([^\`\=]*)/,
type: ($) => /([^\`\=\;]*)/,
impl: ($) => seq("```", $.impl_c_code, "```"),
impl_c_code: (_) => /([^\`]*)/,
},

View file

@ -1,3 +1,3 @@
((impl_c_code @injection.content)
((impl_c_code) @injection.content
(#set! injection.language "c"))

2
src/grammar.json generated
View file

@ -158,7 +158,7 @@
},
"type": {
"type": "PATTERN",
"value": "([^\\`\\=]*)"
"value": "([^\\`\\=\\;]*)"
},
"impl": {
"type": "SEQ",

2
src/parser.c generated
View file

@ -363,12 +363,14 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (('\t' <= lookahead && lookahead <= '\r') ||
lookahead == ' ') ADVANCE(27);
if (lookahead != 0 &&
lookahead != ';' &&
lookahead != '=' &&
lookahead != '`') ADVANCE(28);
END_STATE();
case 28:
ACCEPT_TOKEN(sym_type);
if (lookahead != 0 &&
lookahead != ';' &&
lookahead != '=' &&
lookahead != '`') ADVANCE(28);
END_STATE();