UNPKG

@informalsystems/quint

Version:

Core tool for the Quint specification language

1,140 lines (1,139 loc) 319 kB
"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.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.PureValDestructuringContext = exports.ValDestructuringContext = 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.IdentOrStarContext = exports.RecordPatternContext = exports.TuplePatternContext = exports.DestructuringPatternContext = 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 = exports.RowLabelContext = exports.RowContext = void 0; exports.ReservedContext = exports.KeywordAsIDContext = exports.IdentifierContext = exports.SimpleIdContext = exports.QualIdContext = exports.LiteralContext = exports.OperatorContext = exports.NameAfterDotContext = exports.NormalCallNameContext = exports.RecElemContext = exports.ArgListContext = 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 = 101; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.HASHBANG_LINE) { { this.state = 100; this.match(QuintParser.HASHBANG_LINE); } } this.state = 104; this._errHandler.sync(this); _la = this._input.LA(1); do { { { this.state = 103; this.module(); } } this.state = 106; this._errHandler.sync(this); _la = this._input.LA(1); } while (_la === QuintParser.T__0 || _la === QuintParser.DOCCOMMENT); this.state = 108; 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 = 113; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === QuintParser.DOCCOMMENT) { { { this.state = 110; this.match(QuintParser.DOCCOMMENT); } } this.state = 115; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 116; this.match(QuintParser.T__0); this.state = 117; this.qualId(); this.state = 118; this.match(QuintParser.T__1); this.state = 122; 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__10) | (1 << QuintParser.T__11) | (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 = 119; this.documentedDeclaration(); } } this.state = 124; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 125; 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 = 130; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === QuintParser.DOCCOMMENT) { { { this.state = 127; this.match(QuintParser.DOCCOMMENT); } } this.state = 132; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 133; 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 = 155; 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 = 135; this.match(QuintParser.T__3); this.state = 136; this.qualId(); this.state = 137; this.match(QuintParser.T__4); this.state = 138; this.type(0); } break; case 2: _localctx = new VarContext(_localctx); this.enterOuterAlt(_localctx, 2); { this.state = 140; this.match(QuintParser.T__5); this.state = 141; this.qualId(); this.state = 142; this.match(QuintParser.T__4); this.state = 143; this.type(0); } break; case 3: _localctx = new AssumeContext(_localctx); this.enterOuterAlt(_localctx, 3); { this.state = 145; this.match(QuintParser.T__6); { this.state = 146; _localctx._assumeName = this.identOrHole(); } this.state = 147; this.match(QuintParser.ASGN); this.state = 148; this.expr(0); } break; case 4: _localctx = new InstanceContext(_localctx); this.enterOuterAlt(_localctx, 4); { this.state = 150; this.instanceMod(); } break; case 5: _localctx = new OperContext(_localctx); this.enterOuterAlt(_localctx, 5); { this.state = 151; this.operDef(); } break; case 6: _localctx = new TypeDefsContext(_localctx); this.enterOuterAlt(_localctx, 6); { this.state = 152; this.typeDef(); } break; case 7: _localctx = new ImportDefContext(_localctx); this.enterOuterAlt(_localctx, 7); { this.state = 153; this.importMod(); } break; case 8: _localctx = new ExportDefContext(_localctx); this.enterOuterAlt(_localctx, 8); { this.state = 154; 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 = 226; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 19, this._ctx)) { case 1: _localctx = new AnnotatedOperDefContext(_localctx); this.enterOuterAlt(_localctx, 1); { this.state = 157; this.qualifier(); this.state = 158; this.normalCallName(); this.state = 159; this.match(QuintParser.LPAREN); { this.state = 160; _localctx._annotatedParameter = this.annotatedParameter(); _localctx._annotOperParam.push(_localctx._annotatedParameter); this.state = 165; 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 = 161; this.match(QuintParser.T__7); this.state = 162; _localctx._annotatedParameter = this.annotatedParameter(); _localctx._annotOperParam.push(_localctx._annotatedParameter); } } } this.state = 167; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx); } } this.state = 169; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__7) { { this.state = 168; this.match(QuintParser.T__7); } } this.state = 171; this.match(QuintParser.RPAREN); this.state = 172; this.match(QuintParser.T__4); this.state = 173; this.type(0); this.state = 176; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.ASGN) { { this.state = 174; this.match(QuintParser.ASGN); this.state = 175; this.expr(0); } } this.state = 179; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__8) { { this.state = 178; this.match(QuintParser.T__8); } } } break; case 2: _localctx = new DeprecatedOperDefContext(_localctx); this.enterOuterAlt(_localctx, 2); { this.state = 181; this.qualifier(); this.state = 182; this.normalCallName(); this.state = 198; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 13, this._ctx)) { case 1: { this.state = 183; this.match(QuintParser.LPAREN); this.state = 195; 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 = 184; _localctx._parameter = this.parameter(); _localctx._operParam.push(_localctx._parameter); this.state = 189; 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 = 185; this.match(QuintParser.T__7); this.state = 186; _localctx._parameter = this.parameter(); _localctx._operParam.push(_localctx._parameter); } } } this.state = 191; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 10, this._ctx); } this.state = 193; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__7) { { this.state = 192; this.match(QuintParser.T__7); } } } } this.state = 197; this.match(QuintParser.RPAREN); } break; } this.state = 202; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__4) { { this.state = 200; this.match(QuintParser.T__4); this.state = 201; _localctx._annotatedRetType = this.type(0); } } this.state = 206; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.ASGN) { { this.state = 204; this.match(QuintParser.ASGN); this.state = 205; this.expr(0); } } this.state = 209; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__8) { { this.state = 208; this.match(QuintParser.T__8); } } } break; case 3: _localctx = new ValDestructuringContext(_localctx); this.enterOuterAlt(_localctx, 3); { this.state = 211; this.match(QuintParser.T__9); this.state = 212; this.destructuringPattern(); this.state = 213; this.match(QuintParser.ASGN); this.state = 214; this.expr(0); this.state = 216; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__8) { { this.state = 215; this.match(QuintParser.T__8); } } } break; case 4: _localctx = new PureValDestructuringContext(_localctx); this.enterOuterAlt(_localctx, 4); { this.state = 218; this.match(QuintParser.T__10); this.state = 219; this.match(QuintParser.T__9); this.state = 220; this.destructuringPattern(); this.state = 221; this.match(QuintParser.ASGN); this.state = 222; this.expr(0); this.state = 224; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__8) { { this.state = 223; 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 = 240; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 20, this._ctx)) { case 1: _localctx = new TypeAbstractDefContext(_localctx); this.enterOuterAlt(_localctx, 1); { this.state = 228; this.match(QuintParser.T__11); this.state = 229; this.qualId(); } break; case 2: _localctx = new TypeSumDefContext(_localctx); this.enterOuterAlt(_localctx, 2); { this.state = 230; this.match(QuintParser.T__11); this.state = 231; this.typeDefHead(); this.state = 232; this.match(QuintParser.ASGN); this.state = 233; this.sumTypeDefinition(); } break; case 3: _localctx = new TypeAliasDefContext(_localctx); this.enterOuterAlt(_localctx, 3); { this.state = 235; this.match(QuintParser.T__11); this.state = 236; this.typeDefHead(); this.state = 237; this.match(QuintParser.ASGN); this.state = 238; 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 = 242; _localctx._typeName = this.qualId(); this.state = 253; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__12) { { this.state = 243; this.match(QuintParser.T__12); this.state = 244; _localctx._LOW_ID = this.match(QuintParser.LOW_ID); _localctx._typeVars.push(_localctx._LOW_ID); this.state = 249; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === QuintParser.T__7) { { { this.state = 245; this.match(QuintParser.T__7); this.state = 246; _localctx._LOW_ID = this.match(QuintParser.LOW_ID); _localctx._typeVars.push(_localctx._LOW_ID); } } this.state = 251; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 252; this.match(QuintParser.T__13); } } } } 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 = 256; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__14) { { this.state = 255; _localctx._separator = this.match(QuintParser.T__14); } } this.state = 258; this.typeSumVariant(); this.state = 263; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === QuintParser.T__14) { { { this.state = 259; this.match(QuintParser.T__14); this.state = 260; this.typeSumVariant(); } } this.state = 265; 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 = 266; _localctx._sumLabel = this.simpleId("variant label"); this.state = 271; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.LPAREN) { { this.state = 267; this.match(QuintParser.LPAREN); this.state = 268; this.type(0); this.state = 269; 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 = 283; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 26, this._ctx)) { case 1: this.enterOuterAlt(_localctx, 1); { this.state = 273; this.match(QuintParser.T__9); } break; case 2: this.enterOuterAlt(_localctx, 2); { this.state = 274; this.match(QuintParser.T__15); } break; case 3: this.enterOuterAlt(_localctx, 3); { this.state = 275; this.match(QuintParser.T__10); this.state = 276; this.match(QuintParser.T__9); } break; case 4: this.enterOuterAlt(_localctx, 4); { this.state = 277; this.match(QuintParser.T__10); this.state = 278; this.match(QuintParser.T__15); } break; case 5: this.enterOuterAlt(_localctx, 5); { this.state = 279; this.match(QuintParser.T__16); } break; case 6: this.enterOuterAlt(_localctx, 6); { this.state = 280; this.match(QuintParser.T__17); } break; case 7: this.enterOuterAlt(_localctx, 7); { this.state = 281; this.match(QuintParser.T__18); } break; case 8: this.enterOuterAlt(_localctx, 8); { this.state = 282; 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 = 303; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 30, this._ctx)) { case 1: this.enterOuterAlt(_localctx, 1); { this.state = 285; this.match(QuintParser.IMPORT); this.state = 286; this.name(); this.state = 287; this.match(QuintParser.T__20); this.state = 288; this.identOrStar(); this.state = 291; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.FROM) { { this.state = 289; this.match(QuintParser.FROM); this.state = 290; this.fromSource(); } } } break; case 2: this.enterOuterAlt(_localctx, 2); { this.state = 293; this.match(QuintParser.IMPORT); this.state = 294; this.name(); this.state = 297; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.AS) { { this.state = 295; this.match(QuintParser.AS); this.state = 296; this.name(); } } this.state = 301; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.FROM) { { this.state = 299; this.match(QuintParser.FROM); this.state = 300; 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 = 316; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 32, this._ctx)) { case 1: this.enterOuterAlt(_localctx, 1); { this.state = 305; this.match(QuintParser.EXPORT); this.state = 306; this.name(); this.state = 307; this.match(QuintParser.T__20); this.state = 308; this.identOrStar(); } break; case 2: this.enterOuterAlt(_localctx, 2); { this.state = 310; this.match(QuintParser.EXPORT); this.state = 311; this.name(); this.state = 314; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.AS) { { this.state = 312; this.match(QuintParser.AS); this.state = 313; 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 = 370; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 39, this._ctx)) { case 1: this.enterOuterAlt(_localctx, 1); { this.state = 318; this.match(QuintParser.IMPORT); this.state = 319; this.moduleName(); this.state = 320; this.match(QuintParser.LPAREN); { this.state = 321; this.name(); this.state = 322; this.match(QuintParser.ASGN); this.state = 323; this.expr(0); this.state = 331; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 33, this._ctx); while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 324; this.match(QuintParser.T__7); this.state = 325; this.name(); this.state = 326; this.match(QuintParser.ASGN); this.state = 327; this.expr(0); } } } this.state = 333; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 33, this._ctx); } } this.state = 335; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__7) { { this.state = 334; this.match(QuintParser.T__7); } } this.state = 337; this.match(QuintParser.RPAREN); this.state = 338; this.match(QuintParser.T__20); this.state = 339; this.match(QuintParser.MUL); this.state = 342; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.FROM) { { this.state = 340; this.match(QuintParser.FROM); this.state = 341; this.fromSource(); } } } break; case 2: this.enterOuterAlt(_localctx, 2); { this.state = 344; this.match(QuintParser.IMPORT); this.state = 345; this.moduleName(); this.state = 346; this.match(QuintParser.LPAREN); { this.state = 347; this.name(); this.state = 348; this.match(QuintParser.ASGN); this.state = 349; this.expr(0); this.state = 357; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 36, this._ctx); while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 350; this.match(QuintParser.T__7); this.state = 351; this.name(); this.state = 352; this.match(QuintParser.ASGN); this.state = 353; this.expr(0); } } } this.state = 359; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 36, this._ctx); } } this.state = 361; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.T__7) { { this.state = 360; this.match(QuintParser.T__7); } } this.state = 363; this.match(QuintParser.RPAREN); this.state = 364; this.match(QuintParser.AS); this.state = 365; this.qualifiedName(); this.state = 368; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === QuintParser.FROM) { { this.state = 366; this.match(QuintParser.FROM); this.state = 367; this.fromSource(); }