[antlr-interest] Re: Why No Error?

Bogdan Mitu bogdan_mt at yahoo.com
Thu Aug 15 08:32:00 PDT 2002


> ...
> 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.

Should parse OK correct input. But I'm afraid it will also parse incorrect
input without producing any error.

For instance, try an input like:

a, b, c
a, , ,

which I think it's incorrect. I didn't test, but I expect that the parser
will stop after the first line, without any warning or error. 

Let me know how it works.

Cheers,
Bogdan

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


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

 

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



More information about the antlr-interest mailing list