* Checks whether or not symbol can follow the current state in the * ATN. The behavior of this method is equivalent to the following, but is * implemented such that the complete context-sensitive follow set does not * need to be explicitly constructed. * *
(symbol)
| 502 | * the ATN, otherwise {@code false}. |
| 503 | */ |
| 504 | isExpectedToken(symbol) { |
| 505 | const atn = this._interp.atn; |
| 506 | let ctx = this._ctx; |
| 507 | const s = atn.states[this.state]; |
| 508 | let following = atn.nextTokens(s); |
| 509 | if (following.contains(symbol)) { |
| 510 | return true; |
| 511 | } |
| 512 | if (!following.contains(Token.EPSILON)) { |
| 513 | return false; |
| 514 | } |
| 515 | while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) { |
| 516 | const invokingState = atn.states[ctx.invokingState]; |
| 517 | const rt = invokingState.transitions[0]; |
| 518 | following = atn.nextTokens(rt.followState); |
| 519 | if (following.contains(symbol)) { |
| 520 | return true; |
| 521 | } |
| 522 | ctx = ctx.parentCtx; |
| 523 | } |
| 524 | if (following.contains(Token.EPSILON) && symbol === Token.EOF) { |
| 525 | return true; |
| 526 | } else { |
| 527 | return false; |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | /** |
| 532 | * Computes the set of input symbols which could follow the current parser |
nothing calls this directly
no test coverage detected