D
Daniel Pitts
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?
Thanks,
Daniel.
P.S. I've also sent this message to the antlr-interest mailing list.
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?
Thanks,
Daniel.
P.S. I've also sent this message to the antlr-interest mailing list.