How do I recognize tokens defined as "from here to end of line" such as in a "print" command where the argument is everything after the "print" to end of line?
Created May 4, 2012
Terence Parr You should be able to do a "while not end-of-line" loop like:
/** Match print then anything until eol */ PRINT : "print" (~' ')* ' '! ;
Note that the PRINT token returned to the parser will contain the entire PRINT command including all text until end of line, but not end of line (since I put a ! suffix on it). To return just the print argument, put a ! on the "print" reference in the rule.