

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.