UNPKG

@maniascript/api

Version:

Maniascript API generator

809 lines (808 loc) 28.9 kB
import * as antlr from "antlr4ng"; import { Token } from "antlr4ng"; export class DocCommentParser extends antlr.Parser { static DOC_START = 1; static DOC_END = 2; static COMMAND_BRIEF = 3; static COMMAND_PARAM = 4; static WHITESPACE = 5; static NEWLINE = 6; static STAR = 7; static COLON = 8; static TEXT_CONTENT = 9; static UNKNOWN = 10; static RULE_documentation = 0; static RULE_content = 1; static RULE_line = 2; static RULE_lineEmpty = 3; static RULE_lineBrief = 4; static RULE_lineParam = 5; static RULE_lineDescription = 6; static RULE_lineStart = 7; static RULE_brief = 8; static RULE_param = 9; static RULE_description = 10; static literalNames = [ null, "'/*!'", "'*/'", "'\\brief'", "'\\param'", null, null, "'*'", "':'" ]; static symbolicNames = [ null, "DOC_START", "DOC_END", "COMMAND_BRIEF", "COMMAND_PARAM", "WHITESPACE", "NEWLINE", "STAR", "COLON", "TEXT_CONTENT", "UNKNOWN" ]; static ruleNames = [ "documentation", "content", "line", "lineEmpty", "lineBrief", "lineParam", "lineDescription", "lineStart", "brief", "param", "description", ]; get grammarFileName() { return "DocCommentParser.g4"; } get literalNames() { return DocCommentParser.literalNames; } get symbolicNames() { return DocCommentParser.symbolicNames; } get ruleNames() { return DocCommentParser.ruleNames; } get serializedATN() { return DocCommentParser._serializedATN; } createFailedPredicateException(predicate, message) { return new antlr.FailedPredicateException(this, predicate, message); } constructor(input) { super(input); this.interpreter = new antlr.ParserATNSimulator(this, DocCommentParser._ATN, DocCommentParser.decisionsToDFA, new antlr.PredictionContextCache()); } documentation() { let localContext = new DocumentationContext(this.context, this.state); this.enterRule(localContext, 0, DocCommentParser.RULE_documentation); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 22; this.match(DocCommentParser.DOC_START); this.state = 24; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1016) !== 0)) { { this.state = 23; this.content(); } } this.state = 26; this.match(DocCommentParser.DOC_END); this.state = 27; this.match(DocCommentParser.EOF); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } content() { let localContext = new ContentContext(this.context, this.state); this.enterRule(localContext, 2, DocCommentParser.RULE_content); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 30; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); do { { { this.state = 29; this.line(); } } this.state = 32; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); } while ((((_la) & ~0x1F) === 0 && ((1 << _la) & 1016) !== 0)); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } line() { let localContext = new LineContext(this.context, this.state); this.enterRule(localContext, 4, DocCommentParser.RULE_line); try { this.state = 38; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 2, this.context)) { case 1: this.enterOuterAlt(localContext, 1); { this.state = 34; this.lineEmpty(); } break; case 2: this.enterOuterAlt(localContext, 2); { this.state = 35; this.lineBrief(); } break; case 3: this.enterOuterAlt(localContext, 3); { this.state = 36; this.lineParam(); } break; case 4: this.enterOuterAlt(localContext, 4); { this.state = 37; this.lineDescription(); } break; } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } lineEmpty() { let localContext = new LineEmptyContext(this.context, this.state); this.enterRule(localContext, 6, DocCommentParser.RULE_lineEmpty); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 41; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 5 || _la === 7) { { this.state = 40; this.lineStart(); } } this.state = 43; this.match(DocCommentParser.NEWLINE); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } lineBrief() { let localContext = new LineBriefContext(this.context, this.state); this.enterRule(localContext, 8, DocCommentParser.RULE_lineBrief); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 46; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 5 || _la === 7) { { this.state = 45; this.lineStart(); } } this.state = 48; this.brief(); this.state = 50; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 5, this.context)) { case 1: { this.state = 49; this.match(DocCommentParser.NEWLINE); } break; } } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } lineParam() { let localContext = new LineParamContext(this.context, this.state); this.enterRule(localContext, 10, DocCommentParser.RULE_lineParam); let _la; try { this.enterOuterAlt(localContext, 1); { this.state = 53; this.errorHandler.sync(this); _la = this.tokenStream.LA(1); if (_la === 5 || _la === 7) { { this.state = 52; this.lineStart(); } } this.state = 55; this.param(); this.state = 57; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 7, this.context)) { case 1: { this.state = 56; this.match(DocCommentParser.NEWLINE); } break; } } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } lineDescription() { let localContext = new LineDescriptionContext(this.context, this.state); this.enterRule(localContext, 12, DocCommentParser.RULE_lineDescription); try { this.enterOuterAlt(localContext, 1); { this.state = 60; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 8, this.context)) { case 1: { this.state = 59; this.lineStart(); } break; } this.state = 62; this.description(); this.state = 64; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 9, this.context)) { case 1: { this.state = 63; this.match(DocCommentParser.NEWLINE); } break; } } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } lineStart() { let localContext = new LineStartContext(this.context, this.state); this.enterRule(localContext, 14, DocCommentParser.RULE_lineStart); try { this.state = 76; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 12, this.context)) { case 1: this.enterOuterAlt(localContext, 1); { this.state = 66; this.match(DocCommentParser.WHITESPACE); this.state = 67; this.match(DocCommentParser.STAR); this.state = 69; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 10, this.context)) { case 1: { this.state = 68; this.match(DocCommentParser.WHITESPACE); } break; } } break; case 2: this.enterOuterAlt(localContext, 2); { this.state = 71; this.match(DocCommentParser.STAR); this.state = 73; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 11, this.context)) { case 1: { this.state = 72; this.match(DocCommentParser.WHITESPACE); } break; } } break; case 3: this.enterOuterAlt(localContext, 3); { this.state = 75; this.match(DocCommentParser.WHITESPACE); } break; } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } brief() { let localContext = new BriefContext(this.context, this.state); this.enterRule(localContext, 16, DocCommentParser.RULE_brief); try { this.enterOuterAlt(localContext, 1); { this.state = 78; this.match(DocCommentParser.COMMAND_BRIEF); this.state = 79; this.match(DocCommentParser.WHITESPACE); this.state = 80; this.description(); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } param() { let localContext = new ParamContext(this.context, this.state); this.enterRule(localContext, 18, DocCommentParser.RULE_param); try { this.enterOuterAlt(localContext, 1); { this.state = 82; this.match(DocCommentParser.COMMAND_PARAM); this.state = 83; this.match(DocCommentParser.WHITESPACE); this.state = 84; localContext._paramName = this.match(DocCommentParser.TEXT_CONTENT); this.state = 85; this.match(DocCommentParser.WHITESPACE); this.state = 86; this.match(DocCommentParser.COLON); this.state = 88; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 13, this.context)) { case 1: { this.state = 87; this.match(DocCommentParser.WHITESPACE); } break; } this.state = 91; this.errorHandler.sync(this); switch (this.interpreter.adaptivePredict(this.tokenStream, 14, this.context)) { case 1: { this.state = 90; this.description(); } break; } } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } description() { let localContext = new DescriptionContext(this.context, this.state); this.enterRule(localContext, 20, DocCommentParser.RULE_description); let _la; try { let alternative; this.enterOuterAlt(localContext, 1); { this.state = 94; this.errorHandler.sync(this); alternative = 1; do { switch (alternative) { case 1: { { this.state = 93; _la = this.tokenStream.LA(1); if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & 928) !== 0))) { this.errorHandler.recoverInline(this); } else { this.errorHandler.reportMatch(this); this.consume(); } } } break; default: throw new antlr.NoViableAltException(this); } this.state = 96; this.errorHandler.sync(this); alternative = this.interpreter.adaptivePredict(this.tokenStream, 15, this.context); } while (alternative !== 2 && alternative !== antlr.ATN.INVALID_ALT_NUMBER); } } catch (re) { if (re instanceof antlr.RecognitionException) { this.errorHandler.reportError(this, re); this.errorHandler.recover(this, re); } else { throw re; } } finally { this.exitRule(); } return localContext; } static _serializedATN = [ 4, 1, 10, 99, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 1, 0, 1, 0, 3, 0, 25, 8, 0, 1, 0, 1, 0, 1, 0, 1, 1, 4, 1, 31, 8, 1, 11, 1, 12, 1, 32, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 39, 8, 2, 1, 3, 3, 3, 42, 8, 3, 1, 3, 1, 3, 1, 4, 3, 4, 47, 8, 4, 1, 4,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3, 14, 7, 0, 41, 40, 1, 0, 0, 0, 41, 42, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 44, 5, 6, 0, 0, 44, 7, 1, 0, 0, 0, 45, 47, 3, 14, 7, 0, 46, 45, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 50, 3, 16, 8, 0, 49, 51, 5, 6, 0, 0, 50, 49, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 9, 1, 0, 0, 0, 52, 54, 3, 14, 7, 0, 53, 52, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 57, 3, 18, 9, 0, 56, 58, 5, 6, 0, 0, 57, 56, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 11, 1, 0, 0, 0, 59, 61, 3, 14, 7, 0, 60, 59, 1, 0, 0, 0, 60, 61, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 64, 3, 20, 10, 0, 63, 65, 5, 6, 0, 0, 64, 63, 1, 0, 0, 0, 64, 65, 1, 0, 0, 0, 65, 13, 1, 0, 0, 0, 66, 67, 5, 5, 0, 0, 67, 69, 5, 7, 0, 0, 68, 70, 5, 5, 0, 0, 69, 68, 1, 0, 0, 0, 69, 70, 1, 0, 0, 0, 70, 77, 1, 0, 0, 0, 71, 73, 5, 7, 0, 0, 72, 74, 5, 5, 0, 0, 73, 72, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 77, 1, 0, 0, 0, 75, 77, 5, 5, 0, 0, 76, 66, 1, 0, 0, 0, 76, 71, 1, 0, 0, 0, 76, 75, 1, 0, 0, 0, 77, 15, 1, 0, 0, 0, 78, 79, 5, 3, 0, 0, 79, 80, 5, 5, 0, 0, 80, 81, 3, 20, 10, 0, 81, 17, 1, 0, 0, 0, 82, 83, 5, 4, 0, 0, 83, 84, 5, 5, 0, 0, 84, 85, 5, 9, 0, 0, 85, 86, 5, 5, 0, 0, 86, 88, 5, 8, 0, 0, 87, 89, 5, 5, 0, 0, 88, 87, 1, 0, 0, 0, 88, 89, 1, 0, 0, 0, 89, 91, 1, 0, 0, 0, 90, 92, 3, 20, 10, 0, 91, 90, 1, 0, 0, 0, 91, 92, 1, 0, 0, 0, 92, 19, 1, 0, 0, 0, 93, 95, 7, 0, 0, 0, 94, 93, 1, 0, 0, 0, 95, 96, 1, 0, 0, 0, 96, 94, 1, 0, 0, 0, 96, 97, 1, 0, 0, 0, 97, 21, 1, 0, 0, 0, 16, 24, 32, 38, 41, 46, 50, 53, 57, 60, 64, 69, 73, 76, 88, 91, 96 ]; static __ATN; static get _ATN() { if (!DocCommentParser.__ATN) { DocCommentParser.__ATN = new antlr.ATNDeserializer().deserialize(DocCommentParser._serializedATN); } return DocCommentParser.__ATN; } static vocabulary = new antlr.Vocabulary(DocCommentParser.literalNames, DocCommentParser.symbolicNames, []); get vocabulary() { return DocCommentParser.vocabulary; } static decisionsToDFA = DocCommentParser._ATN.decisionToState.map((ds, index) => new antlr.DFA(ds, index)); } export class DocumentationContext extends antlr.ParserRuleContext { constructor(parent, invokingState) { super(parent, invokingState); } DOC_START() { return this.getToken(DocCommentParser.DOC_START, 0); } DOC_END() { return this.getToken(DocCommentParser.DOC_END, 0); } EOF() { return this.getToken(DocCommentParser.EOF, 0); } content() { return this.getRuleContext(0, ContentContext); } get ruleIndex() { return DocCommentParser.RULE_documentation; } } export class ContentContext extends antlr.ParserRuleContext { constructor(parent, invokingState) { super(parent, invokingState); } line(i) { if (i === undefined) { return this.getRuleContexts(LineContext); } return this.getRuleContext(i, LineContext); } get ruleIndex() { return DocCommentParser.RULE_content; } } export class LineContext extends antlr.ParserRuleContext { constructor(parent, invokingState) { super(parent, invokingState); } lineEmpty() { return this.getRuleContext(0, LineEmptyContext); } lineBrief() { return this.getRuleContext(0, LineBriefContext); } lineParam() { return this.getRuleContext(0, LineParamContext); } lineDescription() { return this.getRuleContext(0, LineDescriptionContext); } get ruleIndex() { return DocCommentParser.RULE_line; } } export class LineEmptyContext extends antlr.ParserRuleContext { constructor(parent, invokingState) { super(parent, invokingState); } NEWLINE() { return this.getToken(DocCommentParser.NEWLINE, 0); } lineStart() { return this.getRuleContext(0, LineStartContext); } get ruleIndex() { return DocCommentParser.RULE_lineEmpty; } } export class LineBriefContext extends antlr.ParserRuleContext { constructor(parent, invokingState) { super(parent, invokingState); } brief() { return this.getRuleContext(0, BriefContext); } lineStart() { return this.getRuleContext(0, LineStartContext); } NEWLINE() { return this.getToken(DocCommentParser.NEWLINE, 0); } get ruleIndex() { return DocCommentParser.RULE_lineBrief; } } export class LineParamContext extends antlr.ParserRuleContext { constructor(parent, invokingState) { super(parent, invokingState); } param() { return this.getRuleContext(0, ParamContext); } lineStart() { return this.getRuleContext(0, LineStartContext); } NEWLINE() { return this.getToken(DocCommentParser.NEWLINE, 0); } get ruleIndex() { return DocCommentParser.RULE_lineParam; } } export class LineDescriptionContext extends antlr.ParserRuleContext { constructor(parent, invokingState) { super(parent, invokingState); } description() { return this.getRuleContext(0, DescriptionContext); } lineStart() { return this.getRuleContext(0, LineStartContext); } NEWLINE() { return this.getToken(DocCommentParser.NEWLINE, 0); } get ruleIndex() { return DocCommentParser.RULE_lineDescription; } } export class LineStartContext extends antlr.ParserRuleContext { constructor(parent, invokingState) { super(parent, invokingState); } WHITESPACE(i) { if (i === undefined) { return this.getTokens(DocCommentParser.WHITESPACE); } else { return this.getToken(DocCommentParser.WHITESPACE, i); } } STAR() { return this.getToken(DocCommentParser.STAR, 0); } get ruleIndex() { return DocCommentParser.RULE_lineStart; } } export class BriefContext extends antlr.ParserRuleContext { constructor(parent, invokingState) { super(parent, invokingState); } COMMAND_BRIEF() { return this.getToken(DocCommentParser.COMMAND_BRIEF, 0); } WHITESPACE() { return this.getToken(DocCommentParser.WHITESPACE, 0); } description() { return this.getRuleContext(0, DescriptionContext); } get ruleIndex() { return DocCommentParser.RULE_brief; } } export class ParamContext extends antlr.ParserRuleContext { _paramName; constructor(parent, invokingState) { super(parent, invokingState); } COMMAND_PARAM() { return this.getToken(DocCommentParser.COMMAND_PARAM, 0); } WHITESPACE(i) { if (i === undefined) { return this.getTokens(DocCommentParser.WHITESPACE); } else { return this.getToken(DocCommentParser.WHITESPACE, i); } } COLON() { return this.getToken(DocCommentParser.COLON, 0); } TEXT_CONTENT() { return this.getToken(DocCommentParser.TEXT_CONTENT, 0); } description() { return this.getRuleContext(0, DescriptionContext); } get ruleIndex() { return DocCommentParser.RULE_param; } } export class DescriptionContext extends antlr.ParserRuleContext { constructor(parent, invokingState) { super(parent, invokingState); } TEXT_CONTENT(i) { if (i === undefined) { return this.getTokens(DocCommentParser.TEXT_CONTENT); } else { return this.getToken(DocCommentParser.TEXT_CONTENT, i); } } WHITESPACE(i) { if (i === undefined) { return this.getTokens(DocCommentParser.WHITESPACE); } else { return this.getToken(DocCommentParser.WHITESPACE, i); } } STAR(i) { if (i === undefined) { return this.getTokens(DocCommentParser.STAR); } else { return this.getToken(DocCommentParser.STAR, i); } } COLON(i) { if (i === undefined) { return this.getTokens(DocCommentParser.COLON); } else { return this.getToken(DocCommentParser.COLON, i); } } get ruleIndex() { return DocCommentParser.RULE_description; } }