[antlr-interest] skiping the rest of a line

Jason Wood jasonw at justuni.org
Mon Feb 6 11:58:34 PST 2006


Newbie question

I have the following line in a text file 
 ~Another Section. The ~A part
is of interest but the rest is not, also it is not guaranteed that
anything after the ~A will be present. So, I have created a rule to look
for ~A. After the ~A is located I want to skip the rest of the line and
proceed to the next line. How do I go about doing that?

I tried the following and it works but this gives me a nondeterministic
warning, which it understandable because matched everything but newline
characters.

IGNORE: ':'(~('\n'|'\r'))* ('\n'|'\r'('\n')?){$setType(Token.SKIP);
newline();};

J




More information about the antlr-interest mailing list