Closed hernanmd closed 2 years ago
The problem is actually earlier in that line: the backslash `\`
needs to be escaped as `\\`
. If not escaped, then the backslash itself will serve to escape the following `
, which will confuse the lexer as it reads the rest of the line.
Also, there are some other issues with this lang file as written. To begin with, there are list expressions (#L
) in the lexer tokens, which is not allowed -- #L
is only permitted in the parser. The syntax of the #L
expressions also looks odd to me: the expression being repeated is e
, but e
is not defined elsewhere in the grammar.
I've just pushed some additional changes to improve the error messages for invalid lang files, which should hopefully help you refine this example.
I am experimenting a bit with langcc to generate a Smalltalk parser from one of its BNFs. However, I encounter an "Invalid token" problem with some characters, e.g. % < > =.
Ex:
How can I do to escape them?
This is the .lang I wrote so far: (The lexer and parser stanzas are simply copied from the manual because I have not yet reached that part :-)