[antlr-interest] Line oriented parsing with Unix files on Windows machine

Stevenson, Todd (GE Healthcare) Todd.T.Stevenson at ge.com
Thu Aug 4 11:37:18 PDT 2011


I have a line-oriented grammar that uses the following rule to define an
end of line:

 

EOL : ('\r' | '\n')+;

 

My grammar parses input files fine when they are in windows format
(lines end with '\r\n'), however the parser doesn't work when the input
files are in unix format (lines end with '\n' only).  It seems to ignore
the new line character and attach it to the subsequent rule.   Is there
something I need to do the process these files correctly?  Any ideas?

 

Thanks.

 

 

 

 



More information about the antlr-interest mailing list