[antlr-interest] White space handling in V3.0

Terence Parr parrt at cs.usfca.edu
Fri Jun 3 20:43:34 PDT 2005


On Jun 3, 2005, at 5:46 PM, Matthew Ford wrote:

> Hi Ter,
>
> channel=99 appears to consume white space
> is there a way to get it back when processing
>
> (WORD)+
>
> so the words have the whitespace between them?

You bet.  The parser simply tunes to a particular channel and 99 is  
definitely off channel.  All tokens are kept in v3 so you can always  
as for the tokens to the left or right of you.  Further, do a toString 
() on the token stream and all tokens come back out. :)

You can easily tweak the input stream as well; see the tweak example  
in the examples-v3 stuff. :)

Ter


More information about the antlr-interest mailing list