[antlr-interest] Discard comment text
Richard Gildea
rgildea at gmail.com
Mon Jun 7 03:52:38 PDT 2010
Dear all,
I have encountered the following problem with my grammar related to
comments:
The rule loop_header correctly matches a construct such as:
loop_ # comment
_tag1
_tag2
_tag3
However, when I later get the text matched by the rule loop_header as
"$loop_header.text", the text of the comment is still included, even though
I send the comments to the hidden channel.
Is there a way to discard the text of the comment from the text stream
matched by a rule?
loop_header
: LOOP_ ( WHITESPACE+ TAG )+ WHITESPACE
;
COMMENTS
: ( ( '#' ANY_PRINT_CHAR* EOL )+ ) { $channel = HIDDEN; }
;
Thanks,
Richard
More information about the antlr-interest
mailing list