Thanks a lot for the quick reply! I’ve gone the second road and am using the generic identifier
.
Here’s my new grammar:
@top Program { (lineWithNewline | emptyLine)* lineWithoutNewline? }
@skip { space | LineComment }
lineWithNewline { Line newLine }
lineWithoutNewline { Line }
emptyLine { newLine }
Line {
(SymbolDeclaration Command)
| SymbolDeclaration
| Command
}
SymbolDeclaration {
Symbol ":"
}
Symbol {
identifier
}
Command {
identifier
}
@tokens {
identifier { $[a-zA-Z0-9_$]+ }
LineComment { "#" ![\n]* }
space { $[ \t\r]+ }
newLine { "\n" }
}