开发者

antlr text from matching rule in c#

开发者 https://www.devze.com 2023-02-14 03:29 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消