@informalsystems/quint
Version:
Core tool for the Quint specification language
1,169 lines • 305 kB
JavaScript
"use strict";
// Generated from ./src/generated/Quint.g4 by ANTLR 4.9.0-SNAPSHOT
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RowLabelContext = exports.RowContext = exports.TypeVarContext = exports.WrongTypeAppContext = exports.TypeAppContext = exports.TypeParenContext = exports.TypeConstContext = exports.TypeVarCaseContext = exports.TypeBoolContext = exports.TypeStrContext = exports.TypeIntContext = exports.TypeRecContext = exports.TypeTupleContext = exports.TypeUnitContext = exports.TypeListContext = exports.TypeSetContext = exports.TypeOperContext = exports.TypeFunContext = exports.TypeContext = exports.FromSourceContext = exports.QualifiedNameContext = exports.NameContext = exports.ModuleNameContext = exports.InstanceModContext = exports.ExportModContext = exports.ImportModContext = exports.QualifierContext = exports.TypeSumVariantContext = exports.SumTypeDefinitionContext = exports.TypeDefHeadContext = exports.TypeAliasDefContext = exports.TypeSumDefContext = exports.TypeAbstractDefContext = exports.TypeDefContext = exports.DeprecatedOperDefContext = exports.AnnotatedOperDefContext = exports.OperDefContext = exports.ExportDefContext = exports.ImportDefContext = exports.TypeDefsContext = exports.OperContext = exports.InstanceContext = exports.AssumeContext = exports.VarContext = exports.ConstContext = exports.DeclarationContext = exports.DocumentedDeclarationContext = exports.ModuleContext = exports.ModulesContext = exports.QuintParser = void 0;
exports.OperatorContext = exports.NameAfterDotContext = exports.NormalCallNameContext = exports.RecElemContext = exports.ArgListContext = exports.IdentOrStarContext = exports.AnnotatedParameterContext = exports.ParameterContext = exports.IdentOrHoleContext = exports.LambdaTupleSugarContext = exports.LambdaUnsugaredContext = exports.LambdaContext = exports.DeclarationOrExprContext = exports.MatchSumVariantContext = exports.MatchSumCaseContext = exports.MatchSumExprContext = exports.BracesContext = exports.ParenContext = exports.LetInContext = exports.IfElseContext = exports.ListContext = exports.RecordContext = exports.PairContext = exports.UnitContext = exports.TupleContext = exports.LiteralOrIdContext = exports.ActionAnyContext = exports.ActionAllContext = exports.MatchContext = exports.ImpliesContext = exports.IffContext = exports.OrContext = exports.OrExprContext = exports.AndContext = exports.AndExprContext = exports.ErrorEqContext = exports.AsgnContext = exports.RelationsContext = exports.PlusMinusContext = exports.MultDivContext = exports.UminusContext = exports.PowContext = exports.ListAppContext = exports.OperAppContext = exports.LambdaConsContext = exports.DotCallContext = exports.ExprContext = exports.WrongTypeApplicationContext = exports.TypeApplicationContext = exports.TypeArgsContext = void 0;
exports.ReservedContext = exports.KeywordAsIDContext = exports.IdentifierContext = exports.SimpleIdContext = exports.QualIdContext = exports.LiteralContext = void 0;
// Used for forming errors
const quintError_1 = require("../quintError");
const ATN_1 = require("antlr4ts/atn/ATN");
const ATNDeserializer_1 = require("antlr4ts/atn/ATNDeserializer");
const FailedPredicateException_1 = require("antlr4ts/FailedPredicateException");
const NoViableAltException_1 = require("antlr4ts/NoViableAltException");
const Parser_1 = require("antlr4ts/Parser");
const ParserRuleContext_1 = require("antlr4ts/ParserRuleContext");
const ParserATNSimulator_1 = require("antlr4ts/atn/ParserATNSimulator");
const RecognitionException_1 = require("antlr4ts/RecognitionException");
const Token_1 = require("antlr4ts/Token");
const VocabularyImpl_1 = require("antlr4ts/VocabularyImpl");
const Utils = __importStar(require("antlr4ts/misc/Utils"));
class QuintParser extends Parser_1.Parser {
// @Override
// @NotNull
get vocabulary() {
return QuintParser.VOCABULARY;
}
// tslint:enable:no-trailing-whitespace
// @Override
get grammarFileName() { return "Quint.g4"; }
// @Override
get ruleNames() { return QuintParser.ruleNames; }
// @Override
get serializedATN() { return QuintParser._serializedATN; }
createFailedPredicateException(predicate, message) {
return new FailedPredicateException_1.FailedPredicateException(this, predicate, message);
}
constructor(input) {
super(input);
this._interp = new ParserATNSimulator_1.ParserATNSimulator(QuintParser._ATN, this);
}
// @RuleVersion(0)
modules() {
let _localctx = new ModulesContext(this._ctx, this.state);
this.enterRule(_localctx, 0, QuintParser.RULE_modules);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 95;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.HASHBANG_LINE) {
{
this.state = 94;
this.match(QuintParser.HASHBANG_LINE);
}
}
this.state = 98;
this._errHandler.sync(this);
_la = this._input.LA(1);
do {
{
{
this.state = 97;
this.module();
}
}
this.state = 100;
this._errHandler.sync(this);
_la = this._input.LA(1);
} while (_la === QuintParser.T__0 || _la === QuintParser.DOCCOMMENT);
this.state = 102;
this.match(QuintParser.EOF);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
module() {
let _localctx = new ModuleContext(this._ctx, this.state);
this.enterRule(_localctx, 2, QuintParser.RULE_module);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 107;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === QuintParser.DOCCOMMENT) {
{
{
this.state = 104;
this.match(QuintParser.DOCCOMMENT);
}
}
this.state = 109;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 110;
this.match(QuintParser.T__0);
this.state = 111;
this.qualId();
this.state = 112;
this.match(QuintParser.T__1);
this.state = 116;
this._errHandler.sync(this);
_la = this._input.LA(1);
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << QuintParser.T__3) | (1 << QuintParser.T__5) | (1 << QuintParser.T__6) | (1 << QuintParser.T__9) | (1 << QuintParser.T__13) | (1 << QuintParser.T__14) | (1 << QuintParser.T__15) | (1 << QuintParser.T__16) | (1 << QuintParser.T__17) | (1 << QuintParser.T__18) | (1 << QuintParser.T__19))) !== 0) || ((((_la - 60)) & ~0x1F) === 0 && ((1 << (_la - 60)) & ((1 << (QuintParser.IMPORT - 60)) | (1 << (QuintParser.EXPORT - 60)) | (1 << (QuintParser.DOCCOMMENT - 60)))) !== 0)) {
{
{
this.state = 113;
this.documentedDeclaration();
}
}
this.state = 118;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 119;
this.match(QuintParser.T__2);
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
documentedDeclaration() {
let _localctx = new DocumentedDeclarationContext(this._ctx, this.state);
this.enterRule(_localctx, 4, QuintParser.RULE_documentedDeclaration);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 124;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === QuintParser.DOCCOMMENT) {
{
{
this.state = 121;
this.match(QuintParser.DOCCOMMENT);
}
}
this.state = 126;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 127;
this.declaration();
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
declaration() {
let _localctx = new DeclarationContext(this._ctx, this.state);
this.enterRule(_localctx, 6, QuintParser.RULE_declaration);
try {
this.state = 149;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 5, this._ctx)) {
case 1:
_localctx = new ConstContext(_localctx);
this.enterOuterAlt(_localctx, 1);
{
this.state = 129;
this.match(QuintParser.T__3);
this.state = 130;
this.qualId();
this.state = 131;
this.match(QuintParser.T__4);
this.state = 132;
this.type(0);
}
break;
case 2:
_localctx = new VarContext(_localctx);
this.enterOuterAlt(_localctx, 2);
{
this.state = 134;
this.match(QuintParser.T__5);
this.state = 135;
this.qualId();
this.state = 136;
this.match(QuintParser.T__4);
this.state = 137;
this.type(0);
}
break;
case 3:
_localctx = new AssumeContext(_localctx);
this.enterOuterAlt(_localctx, 3);
{
this.state = 139;
this.match(QuintParser.T__6);
{
this.state = 140;
_localctx._assumeName = this.identOrHole();
}
this.state = 141;
this.match(QuintParser.ASGN);
this.state = 142;
this.expr(0);
}
break;
case 4:
_localctx = new InstanceContext(_localctx);
this.enterOuterAlt(_localctx, 4);
{
this.state = 144;
this.instanceMod();
}
break;
case 5:
_localctx = new OperContext(_localctx);
this.enterOuterAlt(_localctx, 5);
{
this.state = 145;
this.operDef();
}
break;
case 6:
_localctx = new TypeDefsContext(_localctx);
this.enterOuterAlt(_localctx, 6);
{
this.state = 146;
this.typeDef();
}
break;
case 7:
_localctx = new ImportDefContext(_localctx);
this.enterOuterAlt(_localctx, 7);
{
this.state = 147;
this.importMod();
}
break;
case 8:
_localctx = new ExportDefContext(_localctx);
this.enterOuterAlt(_localctx, 8);
{
this.state = 148;
this.exportMod();
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
operDef() {
let _localctx = new OperDefContext(this._ctx, this.state);
this.enterRule(_localctx, 8, QuintParser.RULE_operDef);
let _la;
try {
let _alt;
this.state = 205;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 17, this._ctx)) {
case 1:
_localctx = new AnnotatedOperDefContext(_localctx);
this.enterOuterAlt(_localctx, 1);
{
this.state = 151;
this.qualifier();
this.state = 152;
this.normalCallName();
this.state = 153;
this.match(QuintParser.LPAREN);
{
this.state = 154;
_localctx._annotatedParameter = this.annotatedParameter();
_localctx._annotOperParam.push(_localctx._annotatedParameter);
this.state = 159;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 155;
this.match(QuintParser.T__7);
this.state = 156;
_localctx._annotatedParameter = this.annotatedParameter();
_localctx._annotOperParam.push(_localctx._annotatedParameter);
}
}
}
this.state = 161;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx);
}
}
this.state = 163;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.T__7) {
{
this.state = 162;
this.match(QuintParser.T__7);
}
}
this.state = 165;
this.match(QuintParser.RPAREN);
this.state = 166;
this.match(QuintParser.T__4);
this.state = 167;
this.type(0);
this.state = 170;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.ASGN) {
{
this.state = 168;
this.match(QuintParser.ASGN);
this.state = 169;
this.expr(0);
}
}
this.state = 173;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.T__8) {
{
this.state = 172;
this.match(QuintParser.T__8);
}
}
}
break;
case 2:
_localctx = new DeprecatedOperDefContext(_localctx);
this.enterOuterAlt(_localctx, 2);
{
this.state = 175;
this.qualifier();
this.state = 176;
this.normalCallName();
this.state = 192;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 13, this._ctx)) {
case 1:
{
this.state = 177;
this.match(QuintParser.LPAREN);
this.state = 189;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (((((_la - 33)) & ~0x1F) === 0 && ((1 << (_la - 33)) & ((1 << (QuintParser.T__32 - 33)) | (1 << (QuintParser.AND - 33)) | (1 << (QuintParser.OR - 33)) | (1 << (QuintParser.IFF - 33)) | (1 << (QuintParser.IMPLIES - 33)) | (1 << (QuintParser.MATCH - 33)) | (1 << (QuintParser.SET - 33)) | (1 << (QuintParser.LIST - 33)) | (1 << (QuintParser.IMPORT - 33)) | (1 << (QuintParser.EXPORT - 33)) | (1 << (QuintParser.FROM - 33)) | (1 << (QuintParser.AS - 33)) | (1 << (QuintParser.LOW_ID - 33)))) !== 0) || _la === QuintParser.CAP_ID) {
{
this.state = 178;
_localctx._parameter = this.parameter();
_localctx._operParam.push(_localctx._parameter);
this.state = 183;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 10, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 179;
this.match(QuintParser.T__7);
this.state = 180;
_localctx._parameter = this.parameter();
_localctx._operParam.push(_localctx._parameter);
}
}
}
this.state = 185;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 10, this._ctx);
}
this.state = 187;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.T__7) {
{
this.state = 186;
this.match(QuintParser.T__7);
}
}
}
}
this.state = 191;
this.match(QuintParser.RPAREN);
}
break;
}
this.state = 196;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.T__4) {
{
this.state = 194;
this.match(QuintParser.T__4);
this.state = 195;
_localctx._annotatedRetType = this.type(0);
}
}
this.state = 200;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.ASGN) {
{
this.state = 198;
this.match(QuintParser.ASGN);
this.state = 199;
this.expr(0);
}
}
this.state = 203;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.T__8) {
{
this.state = 202;
this.match(QuintParser.T__8);
}
}
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
typeDef() {
let _localctx = new TypeDefContext(this._ctx, this.state);
this.enterRule(_localctx, 10, QuintParser.RULE_typeDef);
try {
this.state = 219;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 18, this._ctx)) {
case 1:
_localctx = new TypeAbstractDefContext(_localctx);
this.enterOuterAlt(_localctx, 1);
{
this.state = 207;
this.match(QuintParser.T__9);
this.state = 208;
this.qualId();
}
break;
case 2:
_localctx = new TypeSumDefContext(_localctx);
this.enterOuterAlt(_localctx, 2);
{
this.state = 209;
this.match(QuintParser.T__9);
this.state = 210;
this.typeDefHead();
this.state = 211;
this.match(QuintParser.ASGN);
this.state = 212;
this.sumTypeDefinition();
}
break;
case 3:
_localctx = new TypeAliasDefContext(_localctx);
this.enterOuterAlt(_localctx, 3);
{
this.state = 214;
this.match(QuintParser.T__9);
this.state = 215;
this.typeDefHead();
this.state = 216;
this.match(QuintParser.ASGN);
this.state = 217;
this.type(0);
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
typeDefHead() {
let _localctx = new TypeDefHeadContext(this._ctx, this.state);
this.enterRule(_localctx, 12, QuintParser.RULE_typeDefHead);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 221;
_localctx._typeName = this.qualId();
this.state = 232;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.T__10) {
{
this.state = 222;
this.match(QuintParser.T__10);
this.state = 223;
_localctx._LOW_ID = this.match(QuintParser.LOW_ID);
_localctx._typeVars.push(_localctx._LOW_ID);
this.state = 228;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === QuintParser.T__7) {
{
{
this.state = 224;
this.match(QuintParser.T__7);
this.state = 225;
_localctx._LOW_ID = this.match(QuintParser.LOW_ID);
_localctx._typeVars.push(_localctx._LOW_ID);
}
}
this.state = 230;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
this.state = 231;
this.match(QuintParser.T__11);
}
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
sumTypeDefinition() {
let _localctx = new SumTypeDefinitionContext(this._ctx, this.state);
this.enterRule(_localctx, 14, QuintParser.RULE_sumTypeDefinition);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 235;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.T__12) {
{
this.state = 234;
_localctx._separator = this.match(QuintParser.T__12);
}
}
this.state = 237;
this.typeSumVariant();
this.state = 242;
this._errHandler.sync(this);
_la = this._input.LA(1);
while (_la === QuintParser.T__12) {
{
{
this.state = 238;
this.match(QuintParser.T__12);
this.state = 239;
this.typeSumVariant();
}
}
this.state = 244;
this._errHandler.sync(this);
_la = this._input.LA(1);
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
typeSumVariant() {
let _localctx = new TypeSumVariantContext(this._ctx, this.state);
this.enterRule(_localctx, 16, QuintParser.RULE_typeSumVariant);
let _la;
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 245;
_localctx._sumLabel = this.simpleId("variant label");
this.state = 250;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.LPAREN) {
{
this.state = 246;
this.match(QuintParser.LPAREN);
this.state = 247;
this.type(0);
this.state = 248;
this.match(QuintParser.RPAREN);
}
}
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
qualifier() {
let _localctx = new QualifierContext(this._ctx, this.state);
this.enterRule(_localctx, 18, QuintParser.RULE_qualifier);
try {
this.state = 262;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 24, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 252;
this.match(QuintParser.T__13);
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 253;
this.match(QuintParser.T__14);
}
break;
case 3:
this.enterOuterAlt(_localctx, 3);
{
this.state = 254;
this.match(QuintParser.T__15);
this.state = 255;
this.match(QuintParser.T__13);
}
break;
case 4:
this.enterOuterAlt(_localctx, 4);
{
this.state = 256;
this.match(QuintParser.T__15);
this.state = 257;
this.match(QuintParser.T__14);
}
break;
case 5:
this.enterOuterAlt(_localctx, 5);
{
this.state = 258;
this.match(QuintParser.T__16);
}
break;
case 6:
this.enterOuterAlt(_localctx, 6);
{
this.state = 259;
this.match(QuintParser.T__17);
}
break;
case 7:
this.enterOuterAlt(_localctx, 7);
{
this.state = 260;
this.match(QuintParser.T__18);
}
break;
case 8:
this.enterOuterAlt(_localctx, 8);
{
this.state = 261;
this.match(QuintParser.T__19);
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
importMod() {
let _localctx = new ImportModContext(this._ctx, this.state);
this.enterRule(_localctx, 20, QuintParser.RULE_importMod);
let _la;
try {
this.state = 282;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 28, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 264;
this.match(QuintParser.IMPORT);
this.state = 265;
this.name();
this.state = 266;
this.match(QuintParser.T__20);
this.state = 267;
this.identOrStar();
this.state = 270;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.FROM) {
{
this.state = 268;
this.match(QuintParser.FROM);
this.state = 269;
this.fromSource();
}
}
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 272;
this.match(QuintParser.IMPORT);
this.state = 273;
this.name();
this.state = 276;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.AS) {
{
this.state = 274;
this.match(QuintParser.AS);
this.state = 275;
this.name();
}
}
this.state = 280;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.FROM) {
{
this.state = 278;
this.match(QuintParser.FROM);
this.state = 279;
this.fromSource();
}
}
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
exportMod() {
let _localctx = new ExportModContext(this._ctx, this.state);
this.enterRule(_localctx, 22, QuintParser.RULE_exportMod);
let _la;
try {
this.state = 295;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 30, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 284;
this.match(QuintParser.EXPORT);
this.state = 285;
this.name();
this.state = 286;
this.match(QuintParser.T__20);
this.state = 287;
this.identOrStar();
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 289;
this.match(QuintParser.EXPORT);
this.state = 290;
this.name();
this.state = 293;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.AS) {
{
this.state = 291;
this.match(QuintParser.AS);
this.state = 292;
this.name();
}
}
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
instanceMod() {
let _localctx = new InstanceModContext(this._ctx, this.state);
this.enterRule(_localctx, 24, QuintParser.RULE_instanceMod);
let _la;
try {
let _alt;
this.state = 349;
this._errHandler.sync(this);
switch (this.interpreter.adaptivePredict(this._input, 37, this._ctx)) {
case 1:
this.enterOuterAlt(_localctx, 1);
{
this.state = 297;
this.match(QuintParser.IMPORT);
this.state = 298;
this.moduleName();
this.state = 299;
this.match(QuintParser.LPAREN);
{
this.state = 300;
this.name();
this.state = 301;
this.match(QuintParser.ASGN);
this.state = 302;
this.expr(0);
this.state = 310;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 31, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 303;
this.match(QuintParser.T__7);
this.state = 304;
this.name();
this.state = 305;
this.match(QuintParser.ASGN);
this.state = 306;
this.expr(0);
}
}
}
this.state = 312;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 31, this._ctx);
}
}
this.state = 314;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.T__7) {
{
this.state = 313;
this.match(QuintParser.T__7);
}
}
this.state = 316;
this.match(QuintParser.RPAREN);
this.state = 317;
this.match(QuintParser.T__20);
this.state = 318;
this.match(QuintParser.MUL);
this.state = 321;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.FROM) {
{
this.state = 319;
this.match(QuintParser.FROM);
this.state = 320;
this.fromSource();
}
}
}
break;
case 2:
this.enterOuterAlt(_localctx, 2);
{
this.state = 323;
this.match(QuintParser.IMPORT);
this.state = 324;
this.moduleName();
this.state = 325;
this.match(QuintParser.LPAREN);
{
this.state = 326;
this.name();
this.state = 327;
this.match(QuintParser.ASGN);
this.state = 328;
this.expr(0);
this.state = 336;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 34, this._ctx);
while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) {
if (_alt === 1) {
{
{
this.state = 329;
this.match(QuintParser.T__7);
this.state = 330;
this.name();
this.state = 331;
this.match(QuintParser.ASGN);
this.state = 332;
this.expr(0);
}
}
}
this.state = 338;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 34, this._ctx);
}
}
this.state = 340;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.T__7) {
{
this.state = 339;
this.match(QuintParser.T__7);
}
}
this.state = 342;
this.match(QuintParser.RPAREN);
this.state = 343;
this.match(QuintParser.AS);
this.state = 344;
this.qualifiedName();
this.state = 347;
this._errHandler.sync(this);
_la = this._input.LA(1);
if (_la === QuintParser.FROM) {
{
this.state = 345;
this.match(QuintParser.FROM);
this.state = 346;
this.fromSource();
}
}
}
break;
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
moduleName() {
let _localctx = new ModuleNameContext(this._ctx, this.state);
this.enterRule(_localctx, 26, QuintParser.RULE_moduleName);
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 351;
this.qualId();
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
name() {
let _localctx = new NameContext(this._ctx, this.state);
this.enterRule(_localctx, 28, QuintParser.RULE_name);
try {
this.enterOuterAlt(_localctx, 1);
{
this.state = 353;
this.qualId();
}
}
catch (re) {
if (re instanceof RecognitionException_1.RecognitionException) {
_localctx.exception = re;
this._errHandler.reportError(this, re);
this._errHandler.recover(this, re);
}
else {
throw re;
}
}
finally {
this.exitRule();
}
return _localctx;
}
// @RuleVersion(0)
qualifiedName() {
let _localctx = new QualifiedNameContext(this._ctx, this.state);
this.enterRule(_localctx, 30, QuintParser.RULE_qualifiedName);
try {
this.enterOuterAlt(_localctx