I am trying to implement a grammar for a custom language and therefore I try to understand the .grammar data structure.
Specifically, I do want to have keyword tokens, so I did try Lezer System Guide. But I don’t really get what that abstract is saying. It’s conflating the keyword tokens with other stuff, and when I tried to just have a keyword token, I got the following error:
That is exactly what I did. The java grammar defines this kw(value)="keyword" { value !identifierChar } and then uses it to parse keywords. But when I copy paste literally the java solution in my grammer, I get the error message Unexpected token '(' (src/my.grammar 64:2) where 64 is that very line. The java grammar aparently does things, that I am not allowed to do.
Thank you for your support. For now I figured a solution for the keywords. But what you say the java grammar is doing I can’t find in the java gramma. What I see is this code kw(value)="keyword" { value !identifierChar } and that code does not work in my workspace. I even copied the java grammar as is in my workspace to see if I can use it without modification. It doesn’t work either. I think we are talking about different versions of the java grammar? Did you look into the link to the java.grammar that I posted in the original message?