0

我有以下语法规则:

pacman
  : section section map section
  ;

我想为此规则编写一个 Java 操作,以不同方式处理三个不同section的 s。三个不同实例的句柄是什么?


这是显示我想要的伪代码:

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]);
    }
  }
  ;
4

1 回答 1

0
pacman
  : section1=section section2=section map section3=section
  {
    processFirstSection($section1);
    if(checkSecondSection($section2))
    {
      handleThirdSection($section3);
    }
  }

一般来说,规则

 rule : name=Token otherName=rule

允许您使用访问令牌和Token使用$name规则。rule$otherName

于 2013-10-12T03:05:37.817 回答