[英]Action with more than one instance of a rule or token
I have the following grammar rule: 我有以下语法规则:
pacman
: section section map section
;
I want to write a Java action for this rule that processes the three different section
s differently. 我想为此规则编写一个Java操作,以不同方式处理三个不同的
section
。 What are the handles for the three different instances? 这三个不同实例的句柄是什么?
This is psuedocode showing what I want: 这是显示我想要的伪代码:
pacman
: section section map section
{
processFirstSection($section[0]);
if(checkSecondSection($section[1]))
{
//The if statement isn't important itself;
//the point is that I do completely different
//things with each section
handleThirdSection($section[2]);
}
}
;
pacman
: section1=section section2=section map section3=section
{
processFirstSection($section1);
if(checkSecondSection($section2))
{
handleThirdSection($section3);
}
}
In general, the rule 一般来说,规则
rule : name=Token otherName=rule
lets you access the token Token
using $name
and the rule rule
using $otherName
. 使您可以使用
$name
访问令牌Token
并使用$otherName
访问规则rule
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.