UNPKG

thrift-parser-ts

Version:

A parser of Thrift , by Antlr4 and antlr4ts

1,295 lines 130 kB
"use strict"; // Generated from Thrift.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.Real_base_typeContext = exports.List_separatorContext = exports.Const_mapContext = exports.Const_map_entryContext = exports.Const_listContext = exports.IntegerContext = exports.Const_valueContext = exports.Cpp_typeContext = exports.List_typeContext = exports.Set_typeContext = exports.Map_typeContext = exports.Container_typeContext = exports.Base_typeContext = exports.Field_typeContext = exports.Annotation_valueContext = exports.Type_annotationContext = exports.Type_annotationsContext = exports.Throws_listContext = exports.Function_typeContext = exports.OnewayContext = exports.Function_Context = exports.Field_reqContext = exports.Field_idContext = exports.FieldContext = exports.ServiceContext = exports.Exception_Context = exports.Union_Context = exports.Struct_Context = exports.SenumContext = exports.Enum_fieldContext = exports.Enum_ruleContext = exports.Typedef_Context = exports.Const_ruleContext = exports.DefinitionContext = exports.Cpp_includeContext = exports.Namespace_Context = exports.Include_Context = exports.HeaderContext = exports.DocumentContext = exports.ThriftParser = void 0; 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 ThriftParser extends Parser_1.Parser { static T__0 = 1; static T__1 = 2; static T__2 = 3; static T__3 = 4; static T__4 = 5; static T__5 = 6; static T__6 = 7; static T__7 = 8; static T__8 = 9; static T__9 = 10; static T__10 = 11; static T__11 = 12; static T__12 = 13; static T__13 = 14; static T__14 = 15; static T__15 = 16; static T__16 = 17; static T__17 = 18; static T__18 = 19; static T__19 = 20; static T__20 = 21; static T__21 = 22; static T__22 = 23; static T__23 = 24; static T__24 = 25; static T__25 = 26; static T__26 = 27; static T__27 = 28; static T__28 = 29; static T__29 = 30; static T__30 = 31; static T__31 = 32; static T__32 = 33; static T__33 = 34; static T__34 = 35; static T__35 = 36; static INTEGER = 37; static HEX_INTEGER = 38; static DOUBLE = 39; static TYPE_BOOL = 40; static TYPE_BYTE = 41; static TYPE_I16 = 42; static TYPE_I32 = 43; static TYPE_I64 = 44; static TYPE_DOUBLE = 45; static TYPE_STRING = 46; static TYPE_BINARY = 47; static LITERAL = 48; static IDENTIFIER = 49; static COMMA = 50; static WS = 51; static SL_COMMENT = 52; static ML_COMMENT = 53; static RULE_document = 0; static RULE_header = 1; static RULE_include_ = 2; static RULE_namespace_ = 3; static RULE_cpp_include = 4; static RULE_definition = 5; static RULE_const_rule = 6; static RULE_typedef_ = 7; static RULE_enum_rule = 8; static RULE_enum_field = 9; static RULE_senum = 10; static RULE_struct_ = 11; static RULE_union_ = 12; static RULE_exception_ = 13; static RULE_service = 14; static RULE_field = 15; static RULE_field_id = 16; static RULE_field_req = 17; static RULE_function_ = 18; static RULE_oneway = 19; static RULE_function_type = 20; static RULE_throws_list = 21; static RULE_type_annotations = 22; static RULE_type_annotation = 23; static RULE_annotation_value = 24; static RULE_field_type = 25; static RULE_base_type = 26; static RULE_container_type = 27; static RULE_map_type = 28; static RULE_set_type = 29; static RULE_list_type = 30; static RULE_cpp_type = 31; static RULE_const_value = 32; static RULE_integer = 33; static RULE_const_list = 34; static RULE_const_map_entry = 35; static RULE_const_map = 36; static RULE_list_separator = 37; static RULE_real_base_type = 38; // tslint:disable:no-trailing-whitespace static ruleNames = [ "document", "header", "include_", "namespace_", "cpp_include", "definition", "const_rule", "typedef_", "enum_rule", "enum_field", "senum", "struct_", "union_", "exception_", "service", "field", "field_id", "field_req", "function_", "oneway", "function_type", "throws_list", "type_annotations", "type_annotation", "annotation_value", "field_type", "base_type", "container_type", "map_type", "set_type", "list_type", "cpp_type", "const_value", "integer", "const_list", "const_map_entry", "const_map", "list_separator", "real_base_type", ]; static _LITERAL_NAMES = [ undefined, "'include'", "'namespace'", "'*'", "'cpp_namespace'", "'php_namespace'", "'cpp_include'", "'const'", "'='", "'typedef'", "'enum'", "'{'", "'}'", "'senum'", "'struct'", "'union'", "'exception'", "'service'", "'extends'", "':'", "'required'", "'optional'", "'('", "')'", "'oneway'", "'async'", "'void'", "'throws'", "'map'", "'<'", "'>'", "'set'", "'list'", "'cpp_type'", "'['", "']'", "';'", undefined, undefined, undefined, "'bool'", "'byte'", "'i16'", "'i32'", "'i64'", "'double'", "'string'", "'binary'", undefined, undefined, "','", ]; static _SYMBOLIC_NAMES = [ undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "INTEGER", "HEX_INTEGER", "DOUBLE", "TYPE_BOOL", "TYPE_BYTE", "TYPE_I16", "TYPE_I32", "TYPE_I64", "TYPE_DOUBLE", "TYPE_STRING", "TYPE_BINARY", "LITERAL", "IDENTIFIER", "COMMA", "WS", "SL_COMMENT", "ML_COMMENT", ]; static VOCABULARY = new VocabularyImpl_1.VocabularyImpl(ThriftParser._LITERAL_NAMES, ThriftParser._SYMBOLIC_NAMES, []); // @Override // @NotNull get vocabulary() { return ThriftParser.VOCABULARY; } // tslint:enable:no-trailing-whitespace // @Override get grammarFileName() { return "Thrift.g4"; } // @Override get ruleNames() { return ThriftParser.ruleNames; } // @Override get serializedATN() { return ThriftParser._serializedATN; } createFailedPredicateException(predicate, message) { return new FailedPredicateException_1.FailedPredicateException(this, predicate, message); } constructor(input) { super(input); this._interp = new ParserATNSimulator_1.ParserATNSimulator(ThriftParser._ATN, this); } // @RuleVersion(0) document() { let _localctx = new DocumentContext(this._ctx, this.state); this.enterRule(_localctx, 0, ThriftParser.RULE_document); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 81; this._errHandler.sync(this); _la = this._input.LA(1); while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << ThriftParser.T__0) | (1 << ThriftParser.T__1) | (1 << ThriftParser.T__3) | (1 << ThriftParser.T__4) | (1 << ThriftParser.T__5))) !== 0)) { { { this.state = 78; this.header(); } } this.state = 83; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 87; this._errHandler.sync(this); _la = this._input.LA(1); while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << ThriftParser.T__6) | (1 << ThriftParser.T__8) | (1 << ThriftParser.T__9) | (1 << ThriftParser.T__12) | (1 << ThriftParser.T__13) | (1 << ThriftParser.T__14) | (1 << ThriftParser.T__15) | (1 << ThriftParser.T__16))) !== 0)) { { { this.state = 84; this.definition(); } } this.state = 89; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 90; this.match(ThriftParser.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) header() { let _localctx = new HeaderContext(this._ctx, this.state); this.enterRule(_localctx, 2, ThriftParser.RULE_header); try { this.state = 95; this._errHandler.sync(this); switch (this._input.LA(1)) { case ThriftParser.T__0: this.enterOuterAlt(_localctx, 1); { this.state = 92; this.include_(); } break; case ThriftParser.T__1: case ThriftParser.T__3: case ThriftParser.T__4: this.enterOuterAlt(_localctx, 2); { this.state = 93; this.namespace_(); } break; case ThriftParser.T__5: this.enterOuterAlt(_localctx, 3); { this.state = 94; this.cpp_include(); } 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) include_() { let _localctx = new Include_Context(this._ctx, this.state); this.enterRule(_localctx, 4, ThriftParser.RULE_include_); try { this.enterOuterAlt(_localctx, 1); { this.state = 97; this.match(ThriftParser.T__0); this.state = 98; this.match(ThriftParser.LITERAL); } } 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) namespace_() { let _localctx = new Namespace_Context(this._ctx, this.state); this.enterRule(_localctx, 6, ThriftParser.RULE_namespace_); let _la; try { this.state = 113; this._errHandler.sync(this); switch (this.interpreter.adaptivePredict(this._input, 4, this._ctx)) { case 1: this.enterOuterAlt(_localctx, 1); { this.state = 100; this.match(ThriftParser.T__1); this.state = 101; this.match(ThriftParser.T__2); this.state = 102; _la = this._input.LA(1); if (!(_la === ThriftParser.LITERAL || _la === ThriftParser.IDENTIFIER)) { 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 2: this.enterOuterAlt(_localctx, 2); { this.state = 103; this.match(ThriftParser.T__1); this.state = 104; this.match(ThriftParser.IDENTIFIER); this.state = 105; _la = this._input.LA(1); if (!(_la === ThriftParser.LITERAL || _la === ThriftParser.IDENTIFIER)) { this._errHandler.recoverInline(this); } else { if (this._input.LA(1) === Token_1.Token.EOF) { this.matchedEOF = true; } this._errHandler.reportMatch(this); this.consume(); } this.state = 107; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 106; this.type_annotations(); } } } break; case 3: this.enterOuterAlt(_localctx, 3); { this.state = 109; this.match(ThriftParser.T__3); this.state = 110; this.match(ThriftParser.IDENTIFIER); } break; case 4: this.enterOuterAlt(_localctx, 4); { this.state = 111; this.match(ThriftParser.T__4); this.state = 112; this.match(ThriftParser.IDENTIFIER); } 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) cpp_include() { let _localctx = new Cpp_includeContext(this._ctx, this.state); this.enterRule(_localctx, 8, ThriftParser.RULE_cpp_include); try { this.enterOuterAlt(_localctx, 1); { this.state = 115; this.match(ThriftParser.T__5); this.state = 116; this.match(ThriftParser.LITERAL); } } 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) definition() { let _localctx = new DefinitionContext(this._ctx, this.state); this.enterRule(_localctx, 10, ThriftParser.RULE_definition); try { this.state = 126; this._errHandler.sync(this); switch (this._input.LA(1)) { case ThriftParser.T__6: this.enterOuterAlt(_localctx, 1); { this.state = 118; this.const_rule(); } break; case ThriftParser.T__8: this.enterOuterAlt(_localctx, 2); { this.state = 119; this.typedef_(); } break; case ThriftParser.T__9: this.enterOuterAlt(_localctx, 3); { this.state = 120; this.enum_rule(); } break; case ThriftParser.T__12: this.enterOuterAlt(_localctx, 4); { this.state = 121; this.senum(); } break; case ThriftParser.T__13: this.enterOuterAlt(_localctx, 5); { this.state = 122; this.struct_(); } break; case ThriftParser.T__14: this.enterOuterAlt(_localctx, 6); { this.state = 123; this.union_(); } break; case ThriftParser.T__15: this.enterOuterAlt(_localctx, 7); { this.state = 124; this.exception_(); } break; case ThriftParser.T__16: this.enterOuterAlt(_localctx, 8); { this.state = 125; this.service(); } 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) const_rule() { let _localctx = new Const_ruleContext(this._ctx, this.state); this.enterRule(_localctx, 12, ThriftParser.RULE_const_rule); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 128; this.match(ThriftParser.T__6); this.state = 129; this.field_type(); this.state = 130; this.match(ThriftParser.IDENTIFIER); this.state = 133; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__7) { { this.state = 131; this.match(ThriftParser.T__7); this.state = 132; this.const_value(); } } this.state = 136; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__35 || _la === ThriftParser.COMMA) { { this.state = 135; this.list_separator(); } } } } 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 Typedef_Context(this._ctx, this.state); this.enterRule(_localctx, 14, ThriftParser.RULE_typedef_); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 138; this.match(ThriftParser.T__8); this.state = 139; this.field_type(); this.state = 140; this.match(ThriftParser.IDENTIFIER); this.state = 142; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 141; this.type_annotations(); } } } } 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) enum_rule() { let _localctx = new Enum_ruleContext(this._ctx, this.state); this.enterRule(_localctx, 16, ThriftParser.RULE_enum_rule); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 144; this.match(ThriftParser.T__9); this.state = 145; this.match(ThriftParser.IDENTIFIER); this.state = 146; this.match(ThriftParser.T__10); this.state = 150; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === ThriftParser.IDENTIFIER) { { { this.state = 147; this.enum_field(); } } this.state = 152; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 153; this.match(ThriftParser.T__11); this.state = 155; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 154; this.type_annotations(); } } } } 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) enum_field() { let _localctx = new Enum_fieldContext(this._ctx, this.state); this.enterRule(_localctx, 18, ThriftParser.RULE_enum_field); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 157; this.match(ThriftParser.IDENTIFIER); this.state = 160; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__7) { { this.state = 158; this.match(ThriftParser.T__7); this.state = 159; this.integer(); } } this.state = 163; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 162; this.type_annotations(); } } this.state = 166; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__35 || _la === ThriftParser.COMMA) { { this.state = 165; this.list_separator(); } } } } 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) senum() { let _localctx = new SenumContext(this._ctx, this.state); this.enterRule(_localctx, 20, ThriftParser.RULE_senum); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 168; this.match(ThriftParser.T__12); this.state = 169; this.match(ThriftParser.IDENTIFIER); this.state = 170; this.match(ThriftParser.T__10); this.state = 177; this._errHandler.sync(this); _la = this._input.LA(1); while (_la === ThriftParser.LITERAL) { { { this.state = 171; this.match(ThriftParser.LITERAL); this.state = 173; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__35 || _la === ThriftParser.COMMA) { { this.state = 172; this.list_separator(); } } } } this.state = 179; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 180; this.match(ThriftParser.T__11); this.state = 182; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 181; this.type_annotations(); } } } } 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) struct_() { let _localctx = new Struct_Context(this._ctx, this.state); this.enterRule(_localctx, 22, ThriftParser.RULE_struct_); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 184; this.match(ThriftParser.T__13); this.state = 185; this.match(ThriftParser.IDENTIFIER); this.state = 186; this.match(ThriftParser.T__10); this.state = 190; this._errHandler.sync(this); _la = this._input.LA(1); while (((((_la - 20)) & ~0x1F) === 0 && ((1 << (_la - 20)) & ((1 << (ThriftParser.T__19 - 20)) | (1 << (ThriftParser.T__20 - 20)) | (1 << (ThriftParser.T__27 - 20)) | (1 << (ThriftParser.T__30 - 20)) | (1 << (ThriftParser.T__31 - 20)) | (1 << (ThriftParser.INTEGER - 20)) | (1 << (ThriftParser.HEX_INTEGER - 20)) | (1 << (ThriftParser.TYPE_BOOL - 20)) | (1 << (ThriftParser.TYPE_BYTE - 20)) | (1 << (ThriftParser.TYPE_I16 - 20)) | (1 << (ThriftParser.TYPE_I32 - 20)) | (1 << (ThriftParser.TYPE_I64 - 20)) | (1 << (ThriftParser.TYPE_DOUBLE - 20)) | (1 << (ThriftParser.TYPE_STRING - 20)) | (1 << (ThriftParser.TYPE_BINARY - 20)) | (1 << (ThriftParser.IDENTIFIER - 20)))) !== 0)) { { { this.state = 187; this.field(); } } this.state = 192; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 193; this.match(ThriftParser.T__11); this.state = 195; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 194; this.type_annotations(); } } } } 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) union_() { let _localctx = new Union_Context(this._ctx, this.state); this.enterRule(_localctx, 24, ThriftParser.RULE_union_); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 197; this.match(ThriftParser.T__14); this.state = 198; this.match(ThriftParser.IDENTIFIER); this.state = 199; this.match(ThriftParser.T__10); this.state = 203; this._errHandler.sync(this); _la = this._input.LA(1); while (((((_la - 20)) & ~0x1F) === 0 && ((1 << (_la - 20)) & ((1 << (ThriftParser.T__19 - 20)) | (1 << (ThriftParser.T__20 - 20)) | (1 << (ThriftParser.T__27 - 20)) | (1 << (ThriftParser.T__30 - 20)) | (1 << (ThriftParser.T__31 - 20)) | (1 << (ThriftParser.INTEGER - 20)) | (1 << (ThriftParser.HEX_INTEGER - 20)) | (1 << (ThriftParser.TYPE_BOOL - 20)) | (1 << (ThriftParser.TYPE_BYTE - 20)) | (1 << (ThriftParser.TYPE_I16 - 20)) | (1 << (ThriftParser.TYPE_I32 - 20)) | (1 << (ThriftParser.TYPE_I64 - 20)) | (1 << (ThriftParser.TYPE_DOUBLE - 20)) | (1 << (ThriftParser.TYPE_STRING - 20)) | (1 << (ThriftParser.TYPE_BINARY - 20)) | (1 << (ThriftParser.IDENTIFIER - 20)))) !== 0)) { { { this.state = 200; this.field(); } } this.state = 205; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 206; this.match(ThriftParser.T__11); this.state = 208; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 207; this.type_annotations(); } } } } 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) exception_() { let _localctx = new Exception_Context(this._ctx, this.state); this.enterRule(_localctx, 26, ThriftParser.RULE_exception_); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 210; this.match(ThriftParser.T__15); this.state = 211; this.match(ThriftParser.IDENTIFIER); this.state = 212; this.match(ThriftParser.T__10); this.state = 216; this._errHandler.sync(this); _la = this._input.LA(1); while (((((_la - 20)) & ~0x1F) === 0 && ((1 << (_la - 20)) & ((1 << (ThriftParser.T__19 - 20)) | (1 << (ThriftParser.T__20 - 20)) | (1 << (ThriftParser.T__27 - 20)) | (1 << (ThriftParser.T__30 - 20)) | (1 << (ThriftParser.T__31 - 20)) | (1 << (ThriftParser.INTEGER - 20)) | (1 << (ThriftParser.HEX_INTEGER - 20)) | (1 << (ThriftParser.TYPE_BOOL - 20)) | (1 << (ThriftParser.TYPE_BYTE - 20)) | (1 << (ThriftParser.TYPE_I16 - 20)) | (1 << (ThriftParser.TYPE_I32 - 20)) | (1 << (ThriftParser.TYPE_I64 - 20)) | (1 << (ThriftParser.TYPE_DOUBLE - 20)) | (1 << (ThriftParser.TYPE_STRING - 20)) | (1 << (ThriftParser.TYPE_BINARY - 20)) | (1 << (ThriftParser.IDENTIFIER - 20)))) !== 0)) { { { this.state = 213; this.field(); } } this.state = 218; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 219; this.match(ThriftParser.T__11); this.state = 221; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 220; this.type_annotations(); } } } } 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) service() { let _localctx = new ServiceContext(this._ctx, this.state); this.enterRule(_localctx, 28, ThriftParser.RULE_service); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 223; this.match(ThriftParser.T__16); this.state = 224; this.match(ThriftParser.IDENTIFIER); this.state = 227; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__17) { { this.state = 225; this.match(ThriftParser.T__17); this.state = 226; this.match(ThriftParser.IDENTIFIER); } } this.state = 229; this.match(ThriftParser.T__10); this.state = 233; this._errHandler.sync(this); _la = this._input.LA(1); while (((((_la - 24)) & ~0x1F) === 0 && ((1 << (_la - 24)) & ((1 << (ThriftParser.T__23 - 24)) | (1 << (ThriftParser.T__24 - 24)) | (1 << (ThriftParser.T__25 - 24)) | (1 << (ThriftParser.T__27 - 24)) | (1 << (ThriftParser.T__30 - 24)) | (1 << (ThriftParser.T__31 - 24)) | (1 << (ThriftParser.TYPE_BOOL - 24)) | (1 << (ThriftParser.TYPE_BYTE - 24)) | (1 << (ThriftParser.TYPE_I16 - 24)) | (1 << (ThriftParser.TYPE_I32 - 24)) | (1 << (ThriftParser.TYPE_I64 - 24)) | (1 << (ThriftParser.TYPE_DOUBLE - 24)) | (1 << (ThriftParser.TYPE_STRING - 24)) | (1 << (ThriftParser.TYPE_BINARY - 24)) | (1 << (ThriftParser.IDENTIFIER - 24)))) !== 0)) { { { this.state = 230; this.function_(); } } this.state = 235; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 236; this.match(ThriftParser.T__11); this.state = 238; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 237; this.type_annotations(); } } } } 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) field() { let _localctx = new FieldContext(this._ctx, this.state); this.enterRule(_localctx, 30, ThriftParser.RULE_field); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 241; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.INTEGER || _la === ThriftParser.HEX_INTEGER) { { this.state = 240; this.field_id(); } } this.state = 244; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__19 || _la === ThriftParser.T__20) { { this.state = 243; this.field_req(); } } this.state = 246; this.field_type(); this.state = 247; this.match(ThriftParser.IDENTIFIER); this.state = 250; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__7) { { this.state = 248; this.match(ThriftParser.T__7); this.state = 249; this.const_value(); } } this.state = 253; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 252; this.type_annotations(); } } this.state = 256; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__35 || _la === ThriftParser.COMMA) { { this.state = 255; this.list_separator(); } } } } 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) field_id() { let _localctx = new Field_idContext(this._ctx, this.state); this.enterRule(_localctx, 32, ThriftParser.RULE_field_id); try { this.enterOuterAlt(_localctx, 1); { this.state = 258; this.integer(); this.state = 259; this.match(ThriftParser.T__18); } } 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) field_req() { let _localctx = new Field_reqContext(this._ctx, this.state); this.enterRule(_localctx, 34, ThriftParser.RULE_field_req); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 261; _la = this._input.LA(1); if (!(_la === ThriftParser.T__19 || _la === ThriftParser.T__20)) { this._errHandler.recoverInline(this); } else { if (this._input.LA(1) === Token_1.Token.EOF) { this.matchedEOF = true; } this._errHandler.reportMatch(this); this.consume(); } } } 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) function_() { let _localctx = new Function_Context(this._ctx, this.state); this.enterRule(_localctx, 36, ThriftParser.RULE_function_); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 264; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__23 || _la === ThriftParser.T__24) { { this.state = 263; this.oneway(); } } this.state = 266; this.function_type(); this.state = 267; this.match(ThriftParser.IDENTIFIER); this.state = 268; this.match(ThriftParser.T__21); this.state = 272; this._errHandler.sync(this); _la = this._input.LA(1); while (((((_la - 20)) & ~0x1F) === 0 && ((1 << (_la - 20)) & ((1 << (ThriftParser.T__19 - 20)) | (1 << (ThriftParser.T__20 - 20)) | (1 << (ThriftParser.T__27 - 20)) | (1 << (ThriftParser.T__30 - 20)) | (1 << (ThriftParser.T__31 - 20)) | (1 << (ThriftParser.INTEGER - 20)) | (1 << (ThriftParser.HEX_INTEGER - 20)) | (1 << (ThriftParser.TYPE_BOOL - 20)) | (1 << (ThriftParser.TYPE_BYTE - 20)) | (1 << (ThriftParser.TYPE_I16 - 20)) | (1 << (ThriftParser.TYPE_I32 - 20)) | (1 << (ThriftParser.TYPE_I64 - 20)) | (1 << (ThriftParser.TYPE_DOUBLE - 20)) | (1 << (ThriftParser.TYPE_STRING - 20)) | (1 << (ThriftParser.TYPE_BINARY - 20)) | (1 << (ThriftParser.IDENTIFIER - 20)))) !== 0)) { { { this.state = 269; this.field(); } } this.state = 274; this._errHandler.sync(this); _la = this._input.LA(1); } this.state = 275; this.match(ThriftParser.T__22); this.state = 277; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__26) { { this.state = 276; this.throws_list(); } } this.state = 280; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__21) { { this.state = 279; this.type_annotations(); } } this.state = 283; this._errHandler.sync(this); _la = this._input.LA(1); if (_la === ThriftParser.T__35 || _la === ThriftParser.COMMA) { { this.state = 282; this.list_separator(); } } } } 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) oneway() { let _localctx = new OnewayContext(this._ctx, this.state); this.enterRule(_localctx, 38, ThriftParser.RULE_oneway); let _la; try { this.enterOuterAlt(_localctx, 1); { this.state = 285; _la = this._input.LA(1); if (!(_la === ThriftParser.T__23 || _la === ThriftParser.T__24)) { this._errHandler.recoverInline(this); } else { if (this._input.LA(1) === Token_1.Token.EOF) { this.matchedEOF = true; } this._errHandler.reportMatch(this); this.consume(); } } } 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) function_type() { let _localctx = new Function_typeContext(this._ctx, this.state); this.enterRule(_localctx, 40, ThriftParser.RULE_function_type); try { this.state = 289; this._errHandler.sync(this); switch (this._input.LA(1)) { case ThriftParser.T__27: case ThriftParser.T__30: case ThriftParser.T__31: ca