Each tree node will tell you the starting and ending token (the tokens that
get what the node represents). Hidden tokens (rather than skipped tokens)
are still within the span, but the parser does not see them. So, if you
want the whitespace, you will need to access the tokens directly using code
at the point in the tree walk where you need to see it.



Jim



*From:* [email protected] [mailto:[email protected]] *On
Behalf Of *Mike Lischke
*Sent:* Thursday, June 14, 2012 7:47 PM
*To:* ANTLR Mailing Mailing List
*Subject:* [antlr-dev] Including whitespace in AST



Hi,



I couldn't find an answer to this in the archive, so here we go. What's
needed to have the parser include the hidden channel when constructing the
AST? The white spaces there should remain hidden wrt. parsing, but I would
like to get the tokens in my resulting AST. Is this possible or do I have
to make white spaces not hidden and handle them manually everywhere?



Thanks,



Mike
-- 
www.soft-gems.net
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to