UNPKG

vb6-antlr4

Version:

A Visual Basic 6 lexer & parser that provides both visitor and listener patterns to traverse the parse tree.

1,132 lines (1,131 loc) 1.11 MB
"use strict"; // Generated from VisualBasic6.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.ExitStmtContext = exports.EventStmtContext = exports.ErrorStmtContext = exports.EraseStmtContext = exports.EnumerationStmt_ConstantContext = exports.EnumerationStmtContext = exports.EndStmtContext = exports.DoLoopStmtContext = exports.DeleteSettingStmtContext = exports.DeftypeStmtContext = exports.DeclareStmtContext = exports.DateStmtContext = exports.ConstSubStmtContext = exports.ConstStmtContext = exports.CloseStmtContext = exports.ChDriveStmtContext = exports.ChDirStmtContext = exports.BeepStmtContext = exports.AppActivateStmtContext = exports.BlockStmtContext = exports.BlockContext = exports.AttributeStmtContext = exports.ModuleBlockContext = exports.Cp_ControlIdentifierContext = exports.Cp_ControlTypeContext = exports.Cp_NestedPropertyContext = exports.Cp_PropertyValueContext = exports.Cp_PropertyNameContext = exports.Cp_SinglePropertyContext = exports.Cp_PropertiesContext = exports.ControlPropertiesContext = exports.ModuleBodyElementContext = exports.ModuleBodyContext = exports.OptionPrivateModuleStmtContext = exports.OptionExplicitStmtContext = exports.OptionCompareStmtContext = exports.OptionBaseStmtContext = exports.ModuleOptionContext = exports.ModuleOptionsContext = exports.ModuleAttributesContext = exports.ModuleConfigElementContext = exports.ModuleConfigContext = exports.ModuleHeaderContext = exports.ModuleReferenceComponentContext = exports.ModuleReferenceValueContext = exports.ModuleReferenceContext = exports.ModuleReferencesContext = exports.ModuleContext = exports.StartRuleContext = exports.VisualBasic6Parser = void 0; exports.SavepictureStmtContext = exports.RsetStmtContext = exports.RmdirStmtContext = exports.ReturnStmtContext = exports.ResumeStmtContext = exports.ResetStmtContext = exports.RedimSubStmtContext = exports.RedimStmtContext = exports.RandomizeStmtContext = exports.RaiseEventStmtContext = exports.PutStmtContext = exports.PropertyLetStmtContext = exports.PropertySetStmtContext = exports.PropertyGetStmtContext = exports.PrintStmtContext = exports.OutputList_ExpressionContext = exports.OutputListContext = exports.OpenStmtContext = exports.OnGoSubStmtContext = exports.OnGoToStmtContext = exports.OnErrorStmtContext = exports.NameStmtContext = exports.MkdirStmtContext = exports.MidStmtContext = exports.MacroElseBlockStmtContext = exports.MacroElseIfBlockStmtContext = exports.MacroIfBlockStmtContext = exports.MacroIfThenElseStmtContext = exports.LsetStmtContext = exports.LockStmtContext = exports.LoadStmtContext = exports.LineInputStmtContext = exports.LetStmtContext = exports.KillStmtContext = exports.InputStmtContext = exports.ImplementsStmtContext = exports.IfElseBlockStmtContext = exports.IfElseIfBlockStmtContext = exports.IfConditionStmtContext = exports.IfBlockStmtContext = exports.BlockIfThenElseContext = exports.InlineIfThenElseContext = exports.IfThenElseStmtContext = exports.GoToStmtContext = exports.GoSubStmtContext = exports.GetStmtContext = exports.FunctionStmtContext = exports.ForNextStmtContext = exports.ForEachStmtContext = exports.FilecopyStmtContext = void 0; exports.VsXorContext = exports.VsOrContext = exports.VsAndContext = exports.VsNotContext = exports.VsIsContext = exports.VsLikeContext = exports.VsGeqContext = exports.VsLeqContext = exports.VsGtContext = exports.VsLtContext = exports.VsNeqContext = exports.VsEqContext = exports.VsAmpContext = exports.VsMinusContext = exports.VsAddContext = exports.VsModContext = exports.VsMultContext = exports.VsDivContext = exports.VsPlusContext = exports.VsNegationContext = exports.VsPowContext = exports.VsAssignContext = exports.VsAddressOfContext = exports.VsTypeOfContext = exports.VsNewContext = exports.VsStructContext = exports.VsLiteralContext = exports.ValueStmtContext = exports.UnlockStmtContext = exports.UnloadStmtContext = exports.TypeOfStmtContext = exports.TypeStmt_ElementContext = exports.TypeStmtContext = exports.TimeStmtContext = exports.SubStmtContext = exports.StopStmtContext = exports.SetStmtContext = exports.SetattrStmtContext = exports.SendkeysStmtContext = exports.CaseCondExprToContext = exports.CaseCondExprValueContext = exports.CaseCondExprIsContext = exports.SC_CondExprContext = exports.CaseCondExprContext = exports.CaseCondElseContext = exports.SC_CondContext = exports.SC_CaseContext = exports.SelectCaseStmtContext = exports.SeekStmtContext = exports.SaveSettingStmtContext = void 0; exports.AmbiguousKeywordContext = exports.VisibilityContext = exports.TypeHintContext = exports.TypeContext = exports.PublicPrivateGlobalVisibilityContext = exports.PublicPrivateVisibilityContext = exports.LiteralContext = exports.LineLabelContext = exports.LetterrangeContext = exports.FieldLengthContext = exports.ComplexTypeContext = exports.ComparisonOperatorContext = exports.CertainIdentifierContext = exports.BaseTypeContext = exports.AsTypeClauseContext = exports.AmbiguousIdentifierContext = exports.SubscriptContext = exports.SubscriptsContext = exports.ArgDefaultValueContext = exports.ArgContext = exports.ArgListContext = exports.DictionaryCallStmtContext = exports.ArgCallContext = exports.ArgsCallContext = exports.ICS_S_DictionaryCallContext = exports.ICS_S_MemberCallContext = exports.ICS_S_MembersCallContext = exports.ICS_S_NestedProcedureCallContext = exports.ICS_S_ProcedureOrArrayCallContext = exports.ICS_S_VariableOrProcedureCallContext = exports.ImplicitCallStmt_InStmtContext = exports.ICS_B_MemberProcedureCallContext = exports.ICS_B_ProcedureCallContext = exports.ImplicitCallStmt_InBlockContext = exports.ECS_MemberProcedureCallContext = exports.ECS_ProcedureCallContext = exports.ExplicitCallStmtContext = exports.WriteStmtContext = exports.WithStmtContext = exports.WidthStmtContext = exports.WhileWendStmtContext = exports.VariableSubStmtContext = exports.VariableListStmtContext = exports.VariableStmtContext = exports.VsMidContext = exports.VsICSContext = exports.VsImpContext = exports.VsEqvContext = void 0; 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 VisualBasic6Parser extends Parser_1.Parser { // @Override // @NotNull get vocabulary() { return VisualBasic6Parser.VOCABULARY; } // tslint:enable:no-trailing-whitespace // @Override get grammarFileName() { return "VisualBasic6.g4"; } // @Override get ruleNames() { return VisualBasic6Parser.ruleNames; } // @Override get serializedATN() { return VisualBasic6Parser._serializedATN; } createFailedPredicateException(predicate, message) { return new FailedPredicateException_1.FailedPredicateException(this, predicate, message); } constructor(input) { super(input); this._interp = new ParserATNSimulator_1.ParserATNSimulator(VisualBasic6Parser._ATN, this); } // @RuleVersion(0) startRule() { let _localctx = new StartRuleContext(this._ctx, this.state); this.enterRule(_localctx, 0, VisualBasic6Parser.RULE_startRule); try { this.enterOuterAlt(_localctx, 1); { this.state = 310; this.module(); this.state = 311; this.match(VisualBasic6Parser.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, VisualBasic6Parser.RULE_module); let _la; try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 314; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 0, this._ctx)) { case 1: { this.state = 313; this.match(VisualBasic6Parser.WS); } break; } this.state = 319; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 1, this._ctx); while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 316; this.match(VisualBasic6Parser.NEWLINE); } } } this.state = 321; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 1, this._ctx); } this.state = 328; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 3, this._ctx)) { case 1: { this.state = 322; this.moduleHeader(); this.state = 324; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 323; this.match(VisualBasic6Parser.NEWLINE); } } break; default: throw new NoViableAltException_1.NoViableAltException(this); } this.state = 326; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 2, this._ctx); } while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER); } break; } this.state = 331; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 4, this._ctx)) { case 1: { this.state = 330; this.moduleReferences(); } break; } this.state = 336; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 5, this._ctx); while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 333; this.match(VisualBasic6Parser.NEWLINE); } } } this.state = 338; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 5, this._ctx); } this.state = 340; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 6, this._ctx)) { case 1: { this.state = 339; this.controlProperties(); } break; } this.state = 345; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx); while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 342; this.match(VisualBasic6Parser.NEWLINE); } } } this.state = 347; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx); } this.state = 349; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 8, this._ctx)) { case 1: { this.state = 348; this.moduleConfig(); } break; } this.state = 354; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 9, this._ctx); while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 351; this.match(VisualBasic6Parser.NEWLINE); } } } this.state = 356; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 9, this._ctx); } this.state = 358; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 10, this._ctx)) { case 1: { this.state = 357; this.moduleAttributes(); } break; } this.state = 363; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 11, this._ctx); while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 360; this.match(VisualBasic6Parser.NEWLINE); } } } this.state = 365; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 11, this._ctx); } this.state = 367; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 12, this._ctx)) { case 1: { this.state = 366; this.moduleOptions(); } break; } this.state = 372; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 13, this._ctx); while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 369; this.match(VisualBasic6Parser.NEWLINE); } } } this.state = 374; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 13, this._ctx); } this.state = 376; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 14, this._ctx)) { case 1: { this.state = 375; this.moduleBody(); } break; } this.state = 381; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === VisualBasic6Parser.NEWLINE) { { { this.state = 378; this.match(VisualBasic6Parser.NEWLINE); } } this.state = 383; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 385; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === VisualBasic6Parser.WS) { { this.state = 384; this.match(VisualBasic6Parser.WS); } } } } 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) moduleReferences() { let _localctx = new ModuleReferencesContext(this._ctx, this.state); this.enterRule(_localctx, 4, VisualBasic6Parser.RULE_moduleReferences); try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 388; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 387; this.moduleReference(); } } break; default: throw new NoViableAltException_1.NoViableAltException(this); } this.state = 390; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 17, this._ctx); } while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER); } } 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) moduleReference() { let _localctx = new ModuleReferenceContext(this._ctx, this.state); this.enterRule(_localctx, 6, VisualBasic6Parser.RULE_moduleReference); let _la; try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 392; this.match(VisualBasic6Parser.OBJECT); this.state = 394; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === VisualBasic6Parser.WS) { { this.state = 393; this.match(VisualBasic6Parser.WS); } } this.state = 396; this.match(VisualBasic6Parser.EQ); this.state = 398; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === VisualBasic6Parser.WS) { { this.state = 397; this.match(VisualBasic6Parser.WS); } } this.state = 400; this.moduleReferenceValue(); this.state = 406; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === VisualBasic6Parser.SEMICOLON) { { this.state = 401; this.match(VisualBasic6Parser.SEMICOLON); this.state = 403; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === VisualBasic6Parser.WS) { { this.state = 402; this.match(VisualBasic6Parser.WS); } } this.state = 405; this.moduleReferenceComponent(); } } this.state = 411; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 22, this._ctx); while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 408; this.match(VisualBasic6Parser.NEWLINE); } } } this.state = 413; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 22, this._ctx); } } } 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) moduleReferenceValue() { let _localctx = new ModuleReferenceValueContext(this._ctx, this.state); this.enterRule(_localctx, 8, VisualBasic6Parser.RULE_moduleReferenceValue); try { this.enterOuterAlt(_localctx, 1); { this.state = 414; this.match(VisualBasic6Parser.STRINGLITERAL); } } 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) moduleReferenceComponent() { let _localctx = new ModuleReferenceComponentContext(this._ctx, this.state); this.enterRule(_localctx, 10, VisualBasic6Parser.RULE_moduleReferenceComponent); try { this.enterOuterAlt(_localctx, 1); { this.state = 416; this.match(VisualBasic6Parser.STRINGLITERAL); } } 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) moduleHeader() { let _localctx = new ModuleHeaderContext(this._ctx, this.state); this.enterRule(_localctx, 12, VisualBasic6Parser.RULE_moduleHeader); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 418; this.match(VisualBasic6Parser.VERSION); this.state = 419; this.match(VisualBasic6Parser.WS); this.state = 420; this.match(VisualBasic6Parser.DOUBLELITERAL); this.state = 423; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === VisualBasic6Parser.WS) { { this.state = 421; this.match(VisualBasic6Parser.WS); this.state = 422; this.match(VisualBasic6Parser.CLASS); } } } } 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) moduleConfig() { let _localctx = new ModuleConfigContext(this._ctx, this.state); this.enterRule(_localctx, 14, VisualBasic6Parser.RULE_moduleConfig); let _la; try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 425; this.match(VisualBasic6Parser.BEGIN); this.state = 427; this._errHandler.sync(this); _la = this._input.LA(1); do { { { this.state = 426; this.match(VisualBasic6Parser.NEWLINE); } } this.state = 429; this._errHandler.sync(this); _la = this._input.LA(1); } while (_la === VisualBasic6Parser.NEWLINE); this.state = 432; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 431; this.moduleConfigElement(); } } break; default: throw new NoViableAltException_1.NoViableAltException(this); } this.state = 434; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 25, this._ctx); } while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER); this.state = 436; this.match(VisualBasic6Parser.END); this.state = 438; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 437; this.match(VisualBasic6Parser.NEWLINE); } } break; default: throw new NoViableAltException_1.NoViableAltException(this); } this.state = 440; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 26, this._ctx); } while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER); } } 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) moduleConfigElement() { let _localctx = new ModuleConfigElementContext(this._ctx, this.state); this.enterRule(_localctx, 16, VisualBasic6Parser.RULE_moduleConfigElement); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 442; this.ambiguousIdentifier(); this.state = 444; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === VisualBasic6Parser.WS) { { this.state = 443; this.match(VisualBasic6Parser.WS); } } this.state = 446; this.match(VisualBasic6Parser.EQ); this.state = 448; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === VisualBasic6Parser.WS) { { this.state = 447; this.match(VisualBasic6Parser.WS); } } this.state = 450; this.literal(); this.state = 451; this.match(VisualBasic6Parser.NEWLINE); } } 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) moduleAttributes() { let _localctx = new ModuleAttributesContext(this._ctx, this.state); this.enterRule(_localctx, 18, VisualBasic6Parser.RULE_moduleAttributes); try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 459; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 453; this.attributeStmt(); this.state = 455; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 454; this.match(VisualBasic6Parser.NEWLINE); } } break; default: throw new NoViableAltException_1.NoViableAltException(this); } this.state = 457; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 29, this._ctx); } while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER); } } break; default: throw new NoViableAltException_1.NoViableAltException(this); } this.state = 461; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 30, this._ctx); } while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER); } } 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) moduleOptions() { let _localctx = new ModuleOptionsContext(this._ctx, this.state); this.enterRule(_localctx, 20, VisualBasic6Parser.RULE_moduleOptions); try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 469; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 463; this.moduleOption(); this.state = 465; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 464; this.match(VisualBasic6Parser.NEWLINE); } } break; default: throw new NoViableAltException_1.NoViableAltException(this); } this.state = 467; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 31, this._ctx); } while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER); } } break; default: throw new NoViableAltException_1.NoViableAltException(this); } this.state = 471; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 32, this._ctx); } while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER); } } 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) moduleOption() { let _localctx = new ModuleOptionContext(this._ctx, this.state); this.enterRule(_localctx, 22, VisualBasic6Parser.RULE_moduleOption); let _la; try { this.state = 481; this._errHandler.sync(this); switch (this._input.LA(1)) { case VisualBasic6Parser.OPTION_BASE: _localctx = new OptionBaseStmtContext(_localctx); this.enterOuterAlt(_localctx, 1); { this.state = 473; this.match(VisualBasic6Parser.OPTION_BASE); this.state = 474; this.match(VisualBasic6Parser.WS); this.state = 475; this.match(VisualBasic6Parser.INTEGERLITERAL); } break; case VisualBasic6Parser.OPTION_COMPARE: _localctx = new OptionCompareStmtContext(_localctx); this.enterOuterAlt(_localctx, 2); { this.state = 476; this.match(VisualBasic6Parser.OPTION_COMPARE); this.state = 477; this.match(VisualBasic6Parser.WS); this.state = 478; _la = this._input.LA(1); if (!(_la === VisualBasic6Parser.BINARY || _la === VisualBasic6Parser.TEXT)) { this._errHandler.recoverInline(this); } else { if (this._input.LA(1) === Token_1.Token.EOF) { this.matchedEOF = true; } this._errHandler.reportMatch(this); this.consume(); } } break; case VisualBasic6Parser.OPTION_EXPLICIT: _localctx = new OptionExplicitStmtContext(_localctx); this.enterOuterAlt(_localctx, 3); { this.state = 479; this.match(VisualBasic6Parser.OPTION_EXPLICIT); } break; case VisualBasic6Parser.OPTION_PRIVATE_MODULE: _localctx = new OptionPrivateModuleStmtContext(_localctx); this.enterOuterAlt(_localctx, 4); { this.state = 480; this.match(VisualBasic6Parser.OPTION_PRIVATE_MODULE); } break; default: throw new NoViableAltException_1.NoViableAltException(this); } } 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) moduleBody() { let _localctx = new ModuleBodyContext(this._ctx, this.state); this.enterRule(_localctx, 24, VisualBasic6Parser.RULE_moduleBody); let _la; try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 483; this.moduleBodyElement(); this.state = 492; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 35, this._ctx); while (_alt !== 2 && _alt !== ATN_1.ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 485; this._errHandler.sync(this); _la = this._input.LA(1); do { { { this.state = 484; this.match(VisualBasic6Parser.NEWLINE); } } this.state = 487; this._errHandler.sync(this); _la = this._input.LA(1); } while (_la === VisualBasic6Parser.NEWLINE); this.state = 489; this.moduleBodyElement(); } } } this.state = 494; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 35, this._ctx); } } } 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) moduleBodyElement() { let _localctx = new ModuleBodyElementContext(this._ctx, this.state); this.enterRule(_localctx, 26, VisualBasic6Parser.RULE_moduleBodyElement); try { this.state = 507; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 36, this._ctx)) { case 1: this.enterOuterAlt(_localctx, 1); { this.state = 495; this.moduleBlock(); } break; case 2: this.enterOuterAlt(_localctx, 2); { this.state = 496; this.moduleOption(); } break; case 3: this.enterOuterAlt(_localctx, 3); { this.state = 497; this.declareStmt(); } break; case 4: this.enterOuterAlt(_localctx, 4); { this.state = 498; this.enumerationStmt(); } break; case 5: this.enterOuterAlt(_localctx, 5); { this.state = 499; this.eventStmt(); } break; case 6: this.enterOuterAlt(_localctx, 6); { this.state = 500; this.functionStmt(); } break; case 7: this.enterOuterAlt(_localctx, 7); { this.state = 501; this.macroIfThenElseStmt(); } break; case 8: this.enterOuterAlt(_localctx, 8); { this.state = 502; this.propertyGetStmt(); } break; case 9: this.enterOuterAlt(_localctx, 9); { this.state = 503; this.propertySetStmt(); } break; case 10: this.enterOuterAlt(_localctx, 10); { this.state = 504; this.propertyLetStmt(); } break; case 11: this.enterOuterAlt(_localctx, 11); { this.state = 505; this.subStmt(); } break; case 12: this.enterOuterAlt(_localctx, 12); { this.state = 506; this.typeStmt(); } 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) controlProperties() { let _localctx = new ControlPropertiesContext(this._ctx, this.state); this.enterRule(_localctx, 28, VisualBasic6Parser.RULE_controlProperties); let _la; try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 510; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === VisualBasic6Parser.WS) { { this.state = 509; this.match(VisualBasic6Parser.WS); } } this.state = 512; this.match(VisualBasic6Parser.BEGIN); this.state = 513; this.match(VisualBasic6Parser.WS); this.state = 514; this.cp_ControlType(); this.state = 515; this.match(VisualBasic6Parser.WS); this.state = 516; this.cp_ControlIdentifier(); this.state = 518; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === VisualBasic6Parser.WS) { { this.state = 517; this.match(VisualBasic6Parser.WS); } } this.state = 521; this._errHandler.sync(this); _la = this._input.LA(1); do { { { this.state = 520; this.match(VisualBasic6Parser.NEWLINE); } } this.state = 523; this._errHandler.sync(this); _la = this._input.LA(1); } while (_la === VisualBasic6Parser.NEWLINE); this.state = 526; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 525; this.cp_Properties(); }