antlr text from matching rule in c#
In an Antlr 开发者_StackOverflow3 grammar, is it possible to print out the full text matching a rule in a grammar targeting c#? Something like below:
rule : FIRST SECOND
{ Console.WriteLine($rule.text); };//does not work.
FIRST: 'first';
SECOND: 'second';
If $rule.text
doesn't work (as @dana suggested), you might try $rule.Text
or even $rule.GetText()
.
If all fails, please tell us which version of the C# port you're using (and where it can be downloaded), then I (or someone else) can perhaps give it a try.
精彩评论