You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Token Categories should be taken into account when performing lookahead calculation.
For example:
constA=createToken({name: "A"})constB=createToken({name: "B",// `B` is a typeof `A`categories: A})constC=createToken({name: "C"})constD=createToken({name: "D"})classCategoriesLookaheadBugParserextendsParser{constructor(){super([A,B,C,D])this.performSelfAnalysis()}publicmain=this.RULE("main",()=>{this.OR([// 'alt1' is `BC`// 'alt2' is `AD`// However `B` can also match `A` due to the categories definition.// So we need to look **two** tokens ahead// to decide between these two alternatives.{ALT: ()=>this.SUBRULE(this.alt1)},{ALT: ()=>this.SUBRULE(this.alt2)}])})publicalt1=this.RULE("alt1",()=>{this.CONSUME(B)this.CONSUME(C)})publicalt2=this.RULE("alt2",()=>{this.CONSUME(A)this.CONSUME(D)})}
The text was updated successfully, but these errors were encountered:
bd82
changed the title
Consider Token Categories when computing Lookahead Functions
Consider Token Categories in Lookahead Functions Calculation
May 25, 2019
So while this change is more of a bug fix, it would be released in a new minor version as it could cause
previously "working" (incorrectly) grammars to fail during startup as previously missed errors would now be detected.
Token Categories should be taken into account when performing lookahead calculation.
For example:
The text was updated successfully, but these errors were encountered: