I’m trying to write a small codemirror language, and while lezer is very pleasant to use, it seems I’m misunderstanding precedence.
@top rule { Flag | ID }
Flag { "SA_" letters }
ID { letters ":" numbers }
@tokens {
@precedence {"SA_", letters}
letters { $[a-zA-Z_]+ }
numbers { $[0-9]+ }
}
With the above grammar, lezer parses “SA_test” as an ID, with a parse error. However, I would think it should parse it as a flag. What would the correct precedence be to allow lezer to parse the string as a Flag?