UNPKG

bitmark-grammar

Version:
1,031 lines (1,030 loc) 467 kB
// Generated from ./Interview/interviewParser.g4 by ANTLR 4.9.0-SNAPSHOT import { ATN } from "antlr4ts/atn/ATN"; import { ATNDeserializer } from "antlr4ts/atn/ATNDeserializer"; import { FailedPredicateException } from "antlr4ts/FailedPredicateException"; import { NoViableAltException } from "antlr4ts/NoViableAltException"; import { Parser } from "antlr4ts/Parser"; import { ParserRuleContext } from "antlr4ts/ParserRuleContext"; import { ParserATNSimulator } from "antlr4ts/atn/ParserATNSimulator"; import { RecognitionException } from "antlr4ts/RecognitionException"; import { Token } from "antlr4ts/Token"; import { VocabularyImpl } from "antlr4ts/VocabularyImpl"; import * as Utils from "antlr4ts/misc/Utils"; export class interviewParser extends Parser { constructor(input) { super(input); this._interp = new ParserATNSimulator(interviewParser._ATN, this); } // @Override // @NotNull get vocabulary() { return interviewParser.VOCABULARY; } // tslint:enable:no-trailing-whitespace // @Override get grammarFileName() { return "interviewParser.g4"; } // @Override get ruleNames() { return interviewParser.ruleNames; } // @Override get serializedATN() { return interviewParser._serializedATN; } createFailedPredicateException(predicate, message) { return new FailedPredicateException(this, predicate, message); } // @RuleVersion(0) bitmark() { let _localctx = new BitmarkContext(this._ctx, this.state); this.enterRule(_localctx, 0, interviewParser.RULE_bitmark); let _la; try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 203; this._errHandler.sync(this); _la = this._input.LA(1); do { { { this.state = 190; this.bitmark_(); this.state = 200; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 1, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 194; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === interviewParser.S) { { { this.state = 191; this.match(interviewParser.S); } } this.state = 196; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 197; this.match(interviewParser.NL); } } } this.state = 202; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 1, this._ctx); } } } this.state = 205; this._errHandler.sync(this); _la = this._input.LA(1); } while (_la === interviewParser.BitInterview || _la === interviewParser.BitInterviewinstgrp); this.state = 210; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === interviewParser.NL) { { { this.state = 207; this.match(interviewParser.NL); } } this.state = 212; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 213; this.match(interviewParser.EOF); } } catch (re) { if (re instanceof RecognitionException) { _localctx.exception = re; this._errHandler.reportError(this, re); this._errHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return _localctx; } // @RuleVersion(0) bitmark_() { let _localctx = new Bitmark_Context(this._ctx, this.state); this.enterRule(_localctx, 2, interviewParser.RULE_bitmark_); try { this.enterOuterAlt(_localctx, 1); { this.state = 215; this.interviews(); } } catch (re) { if (re instanceof RecognitionException) { _localctx.exception = re; this._errHandler.reportError(this, re); this._errHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return _localctx; } // @RuleVersion(0) interviews() { let _localctx = new InterviewsContext(this._ctx, this.state); this.enterRule(_localctx, 4, interviewParser.RULE_interviews); try { this.state = 219; this._errHandler.sync(this); switch (this._input.LA(1)) { case interviewParser.BitInterview: this.enterOuterAlt(_localctx, 1); { this.state = 217; this.interview(); } break; case interviewParser.BitInterviewinstgrp: this.enterOuterAlt(_localctx, 2); { this.state = 218; this.interview_instruction_grouped(); } break; default: throw new NoViableAltException(this); } } catch (re) { if (re instanceof RecognitionException) { _localctx.exception = re; this._errHandler.reportError(this, re); this._errHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return _localctx; } // @RuleVersion(0) interview() { let _localctx = new InterviewContext(this._ctx, this.state); this.enterRule(_localctx, 6, interviewParser.RULE_interview); try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 221; this.match(interviewParser.BitInterview); this.state = 222; this.format(); this.state = 223; this.match(interviewParser.CL); this.state = 227; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 5, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 224; this.match(interviewParser.NL); } } } this.state = 229; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 5, this._ctx); } this.state = 239; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 230; this.bitElem(); this.state = 234; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 231; this.match(interviewParser.NL); } } } this.state = 236; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 6, this._ctx); } } } } this.state = 241; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx); } this.state = 258; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 242; this.mcrsep(); this.state = 246; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 243; this.match(interviewParser.NL); } } } this.state = 248; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 8, this._ctx); } this.state = 256; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 10, this._ctx)) { case 1: { this.state = 249; this.interview_qanda(); this.state = 253; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 9, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 250; this.match(interviewParser.NL); } } } this.state = 255; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 9, this._ctx); } } break; } } } break; default: throw new NoViableAltException(this); } this.state = 260; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 11, this._ctx); } while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); this.state = 262; this.mcrsep_end(); this.state = 266; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 12, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 263; this.match(interviewParser.NL); } } } this.state = 268; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 12, this._ctx); } this.state = 270; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 13, this._ctx)) { case 1: { this.state = 269; this.interview_footer(); } break; } } } catch (re) { if (re instanceof RecognitionException) { _localctx.exception = re; this._errHandler.reportError(this, re); this._errHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return _localctx; } // @RuleVersion(0) interview_instruction_grouped() { let _localctx = new Interview_instruction_groupedContext(this._ctx, this.state); this.enterRule(_localctx, 8, interviewParser.RULE_interview_instruction_grouped); try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 272; this.match(interviewParser.BitInterviewinstgrp); this.state = 273; this.format(); this.state = 274; this.match(interviewParser.CL); this.state = 278; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 14, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 275; this.match(interviewParser.NL); } } } this.state = 280; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 14, this._ctx); } this.state = 290; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 16, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 281; this.bitElem(); this.state = 285; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 15, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 282; this.match(interviewParser.NL); } } } this.state = 287; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 15, this._ctx); } } } } this.state = 292; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 16, this._ctx); } this.state = 303; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 18, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 293; this.mcrsep(); { this.state = 294; this.interview_qanda(); this.state = 298; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 17, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 295; this.match(interviewParser.NL); } } } this.state = 300; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 17, this._ctx); } } } } } this.state = 305; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 18, this._ctx); } this.state = 306; this.mcrsep_end(); this.state = 310; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 19, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 307; this.match(interviewParser.NL); } } } this.state = 312; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 19, this._ctx); } this.state = 314; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 20, this._ctx)) { case 1: { this.state = 313; this.interview_footer(); } break; } } } catch (re) { if (re instanceof RecognitionException) { _localctx.exception = re; this._errHandler.reportError(this, re); this._errHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return _localctx; } // @RuleVersion(0) mcrsep() { let _localctx = new McrsepContext(this._ctx, this.state); this.enterRule(_localctx, 10, interviewParser.RULE_mcrsep); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 318; this._errHandler.sync(this); switch (this._input.LA(1)) { case interviewParser.HSPL: case interviewParser.HSPL2: { this.state = 316; _la = this._input.LA(1); if (!(_la === interviewParser.HSPL || _la === interviewParser.HSPL2)) { this._errHandler.recoverInline(this); } else { if (this._input.LA(1) === Token.EOF) { this.matchedEOF = true; } this._errHandler.reportMatch(this); this.consume(); } } break; case interviewParser.NL: { this.state = 317; this.match(interviewParser.NL); } break; default: throw new NoViableAltException(this); } } } catch (re) { if (re instanceof RecognitionException) { _localctx.exception = re; this._errHandler.reportError(this, re); this._errHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return _localctx; } // @RuleVersion(0) mcrsep_end() { let _localctx = new Mcrsep_endContext(this._ctx, this.state); this.enterRule(_localctx, 12, interviewParser.RULE_mcrsep_end); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 320; _la = this._input.LA(1); if (!(_la === interviewParser.HSPL || _la === interviewParser.HSPL2)) { this._errHandler.recoverInline(this); } else { if (this._input.LA(1) === Token.EOF) { this.matchedEOF = true; } this._errHandler.reportMatch(this); this.consume(); } } } catch (re) { if (re instanceof RecognitionException) { _localctx.exception = re; this._errHandler.reportError(this, re); this._errHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return _localctx; } // @RuleVersion(0) mcrmisc() { let _localctx = new McrmiscContext(this._ctx, this.state); this.enterRule(_localctx, 14, interviewParser.RULE_mcrmisc); try { this.enterOuterAlt(_localctx, 1); { this.state = 322; this.interview_qanda(); this.state = 323; this.match(interviewParser.NL); } } catch (re) { if (re instanceof RecognitionException) { _localctx.exception = re; this._errHandler.reportError(this, re); this._errHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return _localctx; } // @RuleVersion(0) interview_qanda() { let _localctx = new Interview_qandaContext(this._ctx, this.state); this.enterRule(_localctx, 16, interviewParser.RULE_interview_qanda); try { let _alt; this.enterOuterAlt(_localctx, 1); { this.state = 325; this.interview_qanda__(); this.state = 334; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 23, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 327; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { { this.state = 326; this.match(interviewParser.NL); } } break; default: throw new NoViableAltException(this); } this.state = 329; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 22, this._ctx); } while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); this.state = 331; this.interview_qanda__(); } } } this.state = 336; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 23, this._ctx); } } } catch (re) { if (re instanceof RecognitionException) { _localctx.exception = re; this._errHandler.reportError(this, re); this._errHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return _localctx; } // @RuleVersion(0) interview_qanda__() { let _localctx = new Interview_qanda__Context(this._ctx, this.state); this.enterRule(_localctx, 18, interviewParser.RULE_interview_qanda__); let _la; try { let _alt; this.state = 424; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 40, this._ctx)) { case 1: this.enterOuterAlt(_localctx, 1); { this.state = 338; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === interviewParser.OPC) { { this.state = 337; this.item(); } } this.state = 340; this.interview_text(); this.state = 344; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 25, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { { this.state = 341; this.match(interviewParser.S); } } } this.state = 346; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 25, this._ctx); } this.state = 360; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 27, this._ctx); while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { if (_alt === 1) { { this.state = 358; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 26, this._ctx)) { case 1: { this.state = 347; this.item(); } break; case 2: { this.state = 348; this.instruction(); } break; case 3: { this.state = 349; this.example(); } break; case 4: { this.state = 350; this.shortans(); } break; case 5: { this.state = 351; this.longans(); } break; case 6: { this.state = 352; this.dollarans(); } break; case 7: { this.state = 353; this.partans(); } break; case 8: { this.state = 354; this.single_gap(); } break; case 9: { this.state = 355; this.mark_text(); } break; case 10: { this.state = 356; this.hint(); } break; case 11: { this.state = 357; this.interview_sometext(); } break; } } } this.state = 362; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 27, this._ctx); } this.state = 384; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 32, this._ctx)) { case 1: { this.state = 363; this.match(interviewParser.NL); this.state = 365; this._errHandler.sync(this); _la = this._input.LA(1); if (((((_la - 23)) & ~0x1F) === 0 && ((1 << (_la - 23)) & ((1 << (interviewParser.AMP - 23)) | (1 << (interviewParser.Greater - 23)) | (1 << (interviewParser.Less - 23)) | (1 << (interviewParser.RightAngle - 23)) | (1 << (interviewParser.RightArrow - 23)) | (1 << (interviewParser.STRING - 23)) | (1 << (interviewParser.NOTBITMARK - 23)) | (1 << (interviewParser.SENTENCE - 23)) | (1 << (interviewParser.BARSTRING - 23)))) !== 0)) { { this.state = 364; this.interview_answer(); } } this.state = 370; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === interviewParser.S) { { { this.state = 367; this.match(interviewParser.S); } } this.state = 372; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 381; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === interviewParser.OPDOLL || ((((_la - 57)) & ~0x1F) === 0 && ((1 << (_la - 57)) & ((1 << (interviewParser.AtShortanswer - 57)) | (1 << (interviewParser.AtLonganswer - 57)) | (1 << (interviewParser.AtExampleWithStr - 57)) | (1 << (interviewParser.AtExamplecol - 57)) | (1 << (interviewParser.AtExamplecl - 57)) | (1 << (interviewParser.AtSampleSolution - 57)) | (1 << (interviewParser.AtPartialAnswerS - 57)) | (1 << (interviewParser.AtPartialAnswer - 57)))) !== 0)) { { this.state = 379; this._errHandler.sync(this); switch (this._input.LA(1)) { case interviewParser.AtExampleWithStr: case interviewParser.AtExamplecol: case interviewParser.AtExamplecl: { this.state = 373; this.example(); } break; case interviewParser.AtShortanswer: { this.state = 374; this.shortans(); } break; case interviewParser.AtLonganswer: { this.state = 375; this.longans(); } break; case interviewParser.OPDOLL: { this.state = 376; this.dollarans(); } break; case interviewParser.AtPartialAnswerS: case interviewParser.AtPartialAnswer: { this.state = 377; this.partans(); } break; case interviewParser.AtSampleSolution: { this.state = 378; this.sample_soln_prop(); } break; default: throw new NoViableAltException(this); } } this.state = 383; this._errHandler.sync(this); _la = this._input.LA(1); } } break; } } break; case 2: this.enterOuterAlt(_localctx, 2); { this.state = 397; this._errHandler.sync(this); _alt = 1; do { switch (_alt) { case 1: { this.state = 397; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 33, this._ctx)) { case 1: { this.state = 386; this.item(); } break; case 2: { this.state = 387; this.instruction(); } break; case 3: { this.state = 388; this.example(); } break; case 4: { this.state = 389; this.shortans(); } break; case 5: { this.state = 390; this.longans(); } break; case 6: { this.state = 391; this.dollarans(); } break; case 7: { this.state = 392; this.partans(); } break; case 8: { this.state = 393; this.single_gap(); } break; case 9: { this.state = 394; this.mark_text(); } break; case 10: { this.state = 395; this.hint(); } break; case 11: { this.state = 396; this.interview_sometext(); } break; } } break; default: throw new NoViableAltException(this); } this.state = 399; this._errHandler.sync(this); _alt = this.interpreter.adaptivePredict(this._input, 34, this._ctx); } while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); this.state = 422; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 39, this._ctx)) { case 1: { this.state = 401; this.match(interviewParser.NL); this.state = 403; this._errHandler.sync(this); _la = this._input.LA(1); if (((((_la - 23)) & ~0x1F) === 0 && ((1 << (_la - 23)) & ((1 << (interviewParser.AMP - 23)) | (1 << (interviewParser.Greater - 23)) | (1 << (interviewParser.Less - 23)) | (1 << (interviewParser.RightAngle - 23)) | (1 << (interviewParser.RightArrow - 23)) | (1 << (interviewParser.STRING - 23)) | (1 << (interviewParser.NOTBITMARK - 23)) | (1 << (interviewParser.SENTENCE - 23)) | (1 << (interviewParser.BARSTRING - 23)))) !== 0)) { { this.state = 402; this.interview_answer(); } } this.state = 408; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === interviewParser.S) { { { this.state = 405; this.match(interviewParser.S); } } this.state = 410; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 419; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === interviewParser.OPDOLL || ((((_la - 57)) & ~0x1F) === 0 && ((1 << (_la - 57)) & ((1 << (interviewParser.AtShortanswer - 57)) | (1 << (interviewParser.AtLonganswer - 57)) | (1 << (interviewParser.AtExampleWithStr - 57)) | (1 << (interviewParser.AtExamplecol - 57)) | (1 << (interviewParser.AtExamplecl - 57)) | (1 << (interviewParser.AtSampleSolution - 57)) | (1 << (interviewParser.AtPartialAnswerS - 57)) | (1 << (interviewParser.AtPartialAnswer - 57)))) !== 0)) { { this.state = 417; this._errHandler.sync(this); switch (this._input.LA(1)) { case interviewParser.AtExampleWithStr: case interviewParser.AtExamplecol: case interviewParser.AtExamplecl: { this.state = 411; this.example(); } break; case interviewParser.AtShortanswer: { this.state = 412; this.shortans();