- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 JavaParser.java 中看到规则索引,但还有另一个整数值,即调用状态。这个调用状态与 getStartToken 相关吗?或者它与规则索引有何不同?
最佳答案
调用状态是 ATN 状态,用于到达由该规则上下文表示的规则。 comment in the source code很好地解释了这一点:
/** What state invoked the rule associated with this context? * The "return address" is the followState of invokingState * If parent is null, this should be -1 this context object represents * the start rule. */
这是一个例子:
这是规则 start: e EOF;
的 ATN,其中 e
表示子规则。状态 4 是 e 的调用状态,状态 5 是返回(或跟随)状态。请记住,可以从多个位置调用规则,因此您无法使用从规则结束状态的转换返回到调用规则(因此需要 followState
成员)。该返回状态存储在 rule transition 中从调用状态(本例中为状态 4)转到规则开始状态 e
。
关于java - RuleContext 类实现中的 invokingState 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50680438/
我在 JavaParser.java 中看到规则索引,但还有另一个整数值,即调用状态。这个调用状态与 getStartToken 相关吗?或者它与规则索引有何不同? 最佳答案 调用状态是 ATN 状态
我是一名优秀的程序员,十分优秀!