Didn't spot anything you did to ask to treat EOF the
same as NEWLINE.

[C:\rlb]dump \input.txt
0000: 66 75 6e 63 74 69 65 20 66 28 78 29 20 69 73 20    functie f(x) is
0010: 7b  d  a  9 61 20 69 73 20 78 20 2b 20 35  d  a    {...a is x + 5..
0020:  9 32 2a 61  d  a 7d  d  a 66 28 31 30 29          .2*a..}..f(10)

As Jim speculated, your input seems to not have a trailing NEWLINE.
As for Windows versus Unix, they are equally happy to let users
create text files that aren't terminated by newlines (something
most programmer's editors view as correct behavior).

You could certainly make the grammar do the work
of treating EOF as a NEWLINE (and then as EOF
of course), but I suspect the simplest out is to just
have the lexer generate a NEWLINE if one was not
seen just prior to the EOF...

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to