[antlr-interest] Re: Why No Error?

genericised trigonometric at softhome.net
Thu Aug 15 08:13:21 PDT 2002


> file   : line (NEWLINE line)* (NEWLINE)? EOF
> line   : (record)+ ;
> record : (r:RECORD) (COMMA)? ;

This is broken in some way, It generates the output:

line 1: unexpected token: null

It also has nondeterminisms which I want to avoid,
is there anything actually WRONG with me using:

class CSVParser extends Parser;
file   : (line)+ ;
line   : (record)+ (NEWLINE|EOF);
record : (r:RECORD) (COMMA)? ;

I would have thought that if EOF is actually matched
then this is a perfectly viable way of matching the
whole file. In fact, IF the EOF IS matched then I see
no reason NOT to use this way.


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list