Last active
November 1, 2021 14:20
-
-
Save maiermic/4f8cfec051e411a4e12d7a917532095f to your computer and use it in GitHub Desktop.
antlr4 issue https://github.com/antlr/antlr4/issues/3334
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated from MultiAlternatives.g4 by ANTLR 4.9 | |
// jshint ignore: start | |
import antlr4 from 'antlr4'; | |
import MultiAlternativesListener from './MultiAlternativesListener.js'; | |
const serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786", | |
"\u5964\u0003\u0007=\u0004\u0002\t\u0002\u0003\u0002\u0007\u0002\u0006", | |
"\n\u0002\f\u0002\u000e\u0002\t\u000b\u0002\u0003\u0002\u0003\u0002\u0007", | |
"\u0002\r\n\u0002\f\u0002\u000e\u0002\u0010\u000b\u0002\u0003\u0002\u0007", | |
"\u0002\u0013\n\u0002\f\u0002\u000e\u0002\u0016\u000b\u0002\u0003\u0002", | |
"\u0007\u0002\u0019\n\u0002\f\u0002\u000e\u0002\u001c\u000b\u0002\u0003", | |
"\u0002\u0003\u0002\u0007\u0002 \n\u0002\f\u0002\u000e\u0002#\u000b\u0002", | |
"\u0003\u0002\u0007\u0002&\n\u0002\f\u0002\u000e\u0002)\u000b\u0002\u0003", | |
"\u0002\u0007\u0002,\n\u0002\f\u0002\u000e\u0002/\u000b\u0002\u0003\u0002", | |
"\u0003\u0002\u0007\u00023\n\u0002\f\u0002\u000e\u00026\u000b\u0002\u0003", | |
"\u0002\u0005\u00029\n\u0002\u0005\u0002;\n\u0002\u0003\u0002\u0002\u0002", | |
"\u0003\u0002\u0002\u0002\u0002E\u0002\u0014\u0003\u0002\u0002\u0002", | |
"\u0004\u0006\u0007\u0007\u0002\u0002\u0005\u0004\u0003\u0002\u0002\u0002", | |
"\u0006\t\u0003\u0002\u0002\u0002\u0007\u0005\u0003\u0002\u0002\u0002", | |
"\u0007\b\u0003\u0002\u0002\u0002\b\n\u0003\u0002\u0002\u0002\t\u0007", | |
"\u0003\u0002\u0002\u0002\n\u000e\u0007\u0003\u0002\u0002\u000b\r\u0007", | |
"\u0007\u0002\u0002\f\u000b\u0003\u0002\u0002\u0002\r\u0010\u0003\u0002", | |
"\u0002\u0002\u000e\f\u0003\u0002\u0002\u0002\u000e\u000f\u0003\u0002", | |
"\u0002\u0002\u000f\u0011\u0003\u0002\u0002\u0002\u0010\u000e\u0003\u0002", | |
"\u0002\u0002\u0011\u0013\u0007\u0004\u0002\u0002\u0012\u0007\u0003\u0002", | |
"\u0002\u0002\u0013\u0016\u0003\u0002\u0002\u0002\u0014\u0012\u0003\u0002", | |
"\u0002\u0002\u0014\u0015\u0003\u0002\u0002\u0002\u0015\'\u0003\u0002", | |
"\u0002\u0002\u0016\u0014\u0003\u0002\u0002\u0002\u0017\u0019\u0007\u0007", | |
"\u0002\u0002\u0018\u0017\u0003\u0002\u0002\u0002\u0019\u001c\u0003\u0002", | |
"\u0002\u0002\u001a\u0018\u0003\u0002\u0002\u0002\u001a\u001b\u0003\u0002", | |
"\u0002\u0002\u001b\u001d\u0003\u0002\u0002\u0002\u001c\u001a\u0003\u0002", | |
"\u0002\u0002\u001d!\u0007\u0005\u0002\u0002\u001e \u0007\u0007\u0002", | |
"\u0002\u001f\u001e\u0003\u0002\u0002\u0002 #\u0003\u0002\u0002\u0002", | |
"!\u001f\u0003\u0002\u0002\u0002!\"\u0003\u0002\u0002\u0002\"$\u0003", | |
"\u0002\u0002\u0002#!\u0003\u0002\u0002\u0002$&\u0007\u0004\u0002\u0002", | |
"%\u001a\u0003\u0002\u0002\u0002&)\u0003\u0002\u0002\u0002\'%\u0003\u0002", | |
"\u0002\u0002\'(\u0003\u0002\u0002\u0002(:\u0003\u0002\u0002\u0002)\'", | |
"\u0003\u0002\u0002\u0002*,\u0007\u0007\u0002\u0002+*\u0003\u0002\u0002", | |
"\u0002,/\u0003\u0002\u0002\u0002-+\u0003\u0002\u0002\u0002-.\u0003\u0002", | |
"\u0002\u0002.0\u0003\u0002\u0002\u0002/-\u0003\u0002\u0002\u000204\u0007", | |
"\u0006\u0002\u000213\u0007\u0007\u0002\u000221\u0003\u0002\u0002\u0002", | |
"36\u0003\u0002\u0002\u000242\u0003\u0002\u0002\u000245\u0003\u0002\u0002", | |
"\u000258\u0003\u0002\u0002\u000264\u0003\u0002\u0002\u000279\u0007\u0004", | |
"\u0002\u000287\u0003\u0002\u0002\u000289\u0003\u0002\u0002\u00029;\u0003", | |
"\u0002\u0002\u0002:-\u0003\u0002\u0002\u0002:;\u0003\u0002\u0002\u0002", | |
";\u0003\u0003\u0002\u0002\u0002\f\u0007\u000e\u0014\u001a!\'-48:"].join(""); | |
const atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN); | |
const decisionsToDFA = atn.decisionToState.map( (ds, index) => new antlr4.dfa.DFA(ds, index) ); | |
const sharedContextCache = new antlr4.PredictionContextCache(); | |
export default class MultiAlternativesParser extends antlr4.Parser { | |
static grammarFileName = "MultiAlternatives.g4"; | |
static literalNames = [ null, "'A'", "','", "'B'", "'C'" ]; | |
static symbolicNames = [ null, null, null, null, null, "SP" ]; | |
static ruleNames = [ "main" ]; | |
constructor(input) { | |
super(input); | |
this._interp = new antlr4.atn.ParserATNSimulator(this, atn, decisionsToDFA, sharedContextCache); | |
this.ruleNames = MultiAlternativesParser.ruleNames; | |
this.literalNames = MultiAlternativesParser.literalNames; | |
this.symbolicNames = MultiAlternativesParser.symbolicNames; | |
} | |
get atn() { | |
return atn; | |
} | |
main() { | |
let localctx = new MainContext(this, this._ctx, this.state); | |
this.enterRule(localctx, 0, MultiAlternativesParser.RULE_main); | |
var _la = 0; // Token type | |
try { | |
this.enterOuterAlt(localctx, 1); | |
this.state = 18; | |
this._errHandler.sync(this); | |
let _alt = this._interp.adaptivePredict(this._input,2,this._ctx) | |
while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { | |
if(_alt===1) { | |
this.state = 5; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
while(_la===MultiAlternativesParser.SP) { | |
this.state = 2; | |
this.match(MultiAlternativesParser.SP); | |
this.state = 7; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
} | |
this.state = 8; | |
this.match(MultiAlternativesParser.T__0); | |
this.state = 12; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
while(_la===MultiAlternativesParser.SP) { | |
this.state = 9; | |
this.match(MultiAlternativesParser.SP); | |
this.state = 14; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
} | |
this.state = 15; | |
this.match(MultiAlternativesParser.T__1); | |
} | |
this.state = 20; | |
this._errHandler.sync(this); | |
_alt = this._interp.adaptivePredict(this._input,2,this._ctx); | |
} | |
this.state = 37; | |
this._errHandler.sync(this); | |
let _alt = this._interp.adaptivePredict(this._input,5,this._ctx) | |
while(_alt!=2 && _alt!=antlr4.atn.ATN.INVALID_ALT_NUMBER) { | |
if(_alt===1) { | |
this.state = 24; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
while(_la===MultiAlternativesParser.SP) { | |
this.state = 21; | |
this.match(MultiAlternativesParser.SP); | |
this.state = 26; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
} | |
this.state = 27; | |
this.match(MultiAlternativesParser.T__2); | |
this.state = 31; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
while(_la===MultiAlternativesParser.SP) { | |
this.state = 28; | |
this.match(MultiAlternativesParser.SP); | |
this.state = 33; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
} | |
this.state = 34; | |
this.match(MultiAlternativesParser.T__1); | |
} | |
this.state = 39; | |
this._errHandler.sync(this); | |
_alt = this._interp.adaptivePredict(this._input,5,this._ctx); | |
} | |
this.state = 56; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
if(_la===MultiAlternativesParser.T__3 || _la===MultiAlternativesParser.SP) { | |
this.state = 43; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
while(_la===MultiAlternativesParser.SP) { | |
this.state = 40; | |
this.match(MultiAlternativesParser.SP); | |
this.state = 45; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
} | |
this.state = 46; | |
this.match(MultiAlternativesParser.T__3); | |
this.state = 50; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
while(_la===MultiAlternativesParser.SP) { | |
this.state = 47; | |
this.match(MultiAlternativesParser.SP); | |
this.state = 52; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
} | |
this.state = 54; | |
this._errHandler.sync(this); | |
_la = this._input.LA(1); | |
if(_la===MultiAlternativesParser.T__1) { | |
this.state = 53; | |
this.match(MultiAlternativesParser.T__1); | |
} | |
} | |
} catch (re) { | |
if(re instanceof antlr4.error.RecognitionException) { | |
localctx.exception = re; | |
this._errHandler.reportError(this, re); | |
this._errHandler.recover(this, re); | |
} else { | |
throw re; | |
} | |
} finally { | |
this.exitRule(); | |
} | |
return localctx; | |
} | |
} | |
MultiAlternativesParser.EOF = antlr4.Token.EOF; | |
MultiAlternativesParser.T__0 = 1; | |
MultiAlternativesParser.T__1 = 2; | |
MultiAlternativesParser.T__2 = 3; | |
MultiAlternativesParser.T__3 = 4; | |
MultiAlternativesParser.SP = 5; | |
MultiAlternativesParser.RULE_main = 0; | |
class MainContext extends antlr4.ParserRuleContext { | |
constructor(parser, parent, invokingState) { | |
if(parent===undefined) { | |
parent = null; | |
} | |
if(invokingState===undefined || invokingState===null) { | |
invokingState = -1; | |
} | |
super(parent, invokingState); | |
this.parser = parser; | |
this.ruleIndex = MultiAlternativesParser.RULE_main; | |
} | |
SP = function(i) { | |
if(i===undefined) { | |
i = null; | |
} | |
if(i===null) { | |
return this.getTokens(MultiAlternativesParser.SP); | |
} else { | |
return this.getToken(MultiAlternativesParser.SP, i); | |
} | |
}; | |
enterRule(listener) { | |
if(listener instanceof MultiAlternativesListener ) { | |
listener.enterMain(this); | |
} | |
} | |
exitRule(listener) { | |
if(listener instanceof MultiAlternativesListener ) { | |
listener.exitMain(this); | |
} | |
} | |
} | |
MultiAlternativesParser.MainContext = MainContext; |
@ericvergnaud Thanks, how do I show the exact version of antlr4? It only prints 4.9 if I run antlr4
, a file that contains
#!/bin/bash
export CLASSPATH=".:/usr/local/lib/antlr-4.9-complete.jar:$CLASSPATH"
java -Xmx500M -cp "/usr/local/lib/antlr-4.9-complete.jar:$CLASSPATH" org.antlr.v4.Tool $@
I'm pretty sure that I downloaded the JAR recently
curl -O https://www.antlr.org/download/antlr-4.9-complete.jar
4.9.2 would print 4.9.2
… Le 1 nov. 2021 à 14:34, Michael Maier ***@***.***> a écrit :
@maiermic commented on this gist.
@ericvergnaud <https://github.com/ericvergnaud> Thanks, how do I show the exact version of antlr4? It only prints 4.9 if I run antlr4
export CLASSPATH=".:/usr/local/lib/antlr-4.9-complete.jar:$CLASSPATH"
java -Xmx500M -cp "/usr/local/lib/antlr-4.9-complete.jar:$CLASSPATH" org.antlr.v4.Tool $@
I'm pretty sure that I downloaded the JAR recently.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <https://gist.github.com/4f8cfec051e411a4e12d7a917532095f#gistcomment-3947300>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAZNQJCHCS4AO2C4BA6L7BTUJ2JPXANCNFSM5HEAISYA>.
I'm surprised that https://www.antlr.org/download/antlr-4.9-complete.jar did not refer to the latest version 😮
I just downloaded https://www.antlr.org/download/antlr-4.9.2-complete.jar and can confirm that it is fixed in 4.9.2 👍
Sorry for bothering you. I thought that I'm already using 4.9.2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is already fixed with 4.9.2