Closed 21it closed 1 year ago
This bug report is a bit terse. Could you flesh it out with the usual
Ok, after getting tiger.x
compiled, I see the following output:
$ cat tiger/Literals.txt
123 "Hello, world!"
$ ./tiger.bin tiger/Literals.txt
Beginning analysis of the Tiger program in file tiger/Literals.txt
[ Lexeme class=INT 123 posn=1:1 string="123", Lexeme class=STRING "Hello, world!" posn=1:19 string="\"", Lexeme EOF]
So, both posn
and string
are wrong: string
contains just the last character of the parsed input, and posn
points at the closing "
rather than at the opening one.
PR #226 fixes the wrong posn
and removes the wrong string
component in Lexeme class=STRING
.
Here last argument of
Lexeme
constructor is alwaysJust "\""
, but I guess it's supposed to be raw full representation of parsed stringhttps://github.com/simonmar/alex/blob/a2a10a1a58a2a5066e69ecff205a27d5a1ed66c0/examples/tiger.x#L254