[antlr-interest] Newbie question: ignoring tokens, or is there a better way?
Daniel Pitts
Daniel.Pitts at cnet.com
Thu Sep 27 14:18:34 PDT 2007
Basically, my input is something like:
something{
value: >>>
This is the text
<<<
}
I want a rule that can give me as a value "This is the text".
I've tried:
LQS: LQSS *options {greedy=false;} : .)* LQSE;
LQSS : '>>>\n';
LQSE: '\n<<<';
and I've tried using channel=HIDDEN on LQSS and LQSE, but then I get
errors while parsing other parts of my source.
I have a work around, but its ugly. I have a rule
lstring returns [String value]: LQS
{value=$LQS.getText().replaceFirst(">>>\n","").replaceFirst("\n<<<$",
"");};
but that seems like an awful big hack. Any suggestions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070927/5e7ecde2/attachment.html
More information about the antlr-interest
mailing list