# Generated from Thrift.g4 by ANTLR 4.11.1
# encoding: utf-8
from antlr4 import *
from io import StringIO
import sys
if sys.version_info[1] > 5:
	from typing import TextIO
else:
	from typing.io import TextIO

def serializedATN():
    return [
        4,1,53,409,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,2,11,7,11,2,12,7,12,2,13,7,13,
        2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,
        7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26,
        2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33,
        7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,1,0,5,0,80,
        8,0,10,0,12,0,83,9,0,1,0,5,0,86,8,0,10,0,12,0,89,9,0,1,0,1,0,1,1,
        1,1,1,1,3,1,96,8,1,1,2,1,2,1,2,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,108,
        8,3,1,3,1,3,1,3,1,3,3,3,114,8,3,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,
        1,5,1,5,1,5,3,5,127,8,5,1,6,1,6,1,6,1,6,1,6,3,6,134,8,6,1,6,3,6,
        137,8,6,1,7,1,7,1,7,1,7,3,7,143,8,7,1,8,1,8,1,8,1,8,5,8,149,8,8,
        10,8,12,8,152,9,8,1,8,1,8,3,8,156,8,8,1,9,1,9,1,9,3,9,161,8,9,1,
        9,3,9,164,8,9,1,9,3,9,167,8,9,1,10,1,10,1,10,1,10,1,10,3,10,174,
        8,10,5,10,176,8,10,10,10,12,10,179,9,10,1,10,1,10,3,10,183,8,10,
        1,11,1,11,1,11,1,11,5,11,189,8,11,10,11,12,11,192,9,11,1,11,1,11,
        3,11,196,8,11,1,12,1,12,1,12,1,12,5,12,202,8,12,10,12,12,12,205,
        9,12,1,12,1,12,3,12,209,8,12,1,13,1,13,1,13,1,13,5,13,215,8,13,10,
        13,12,13,218,9,13,1,13,1,13,3,13,222,8,13,1,14,1,14,1,14,1,14,3,
        14,228,8,14,1,14,1,14,5,14,232,8,14,10,14,12,14,235,9,14,1,14,1,
        14,3,14,239,8,14,1,15,3,15,242,8,15,1,15,3,15,245,8,15,1,15,1,15,
        1,15,1,15,3,15,251,8,15,1,15,3,15,254,8,15,1,15,3,15,257,8,15,1,
        16,1,16,1,16,1,17,1,17,1,18,3,18,265,8,18,1,18,1,18,1,18,1,18,5,
        18,271,8,18,10,18,12,18,274,9,18,1,18,1,18,3,18,278,8,18,1,18,3,
        18,281,8,18,1,18,3,18,284,8,18,1,19,1,19,1,20,1,20,3,20,290,8,20,
        1,21,1,21,1,21,5,21,295,8,21,10,21,12,21,298,9,21,1,21,1,21,1,22,
        1,22,5,22,304,8,22,10,22,12,22,307,9,22,1,22,1,22,1,23,1,23,1,23,
        3,23,314,8,23,1,23,3,23,317,8,23,1,24,1,24,3,24,321,8,24,1,25,1,
        25,1,25,3,25,326,8,25,1,26,1,26,3,26,330,8,26,1,27,1,27,1,27,3,27,
        335,8,27,1,27,3,27,338,8,27,1,28,1,28,3,28,342,8,28,1,28,1,28,1,
        28,1,28,1,28,1,28,1,29,1,29,3,29,352,8,29,1,29,1,29,1,29,1,29,1,
        30,1,30,1,30,1,30,1,30,3,30,363,8,30,1,31,1,31,1,31,1,32,1,32,1,
        32,1,32,1,32,1,32,3,32,374,8,32,1,33,1,33,1,34,1,34,1,34,3,34,381,
        8,34,5,34,383,8,34,10,34,12,34,386,9,34,1,34,1,34,1,35,1,35,1,35,
        1,35,3,35,394,8,35,1,36,1,36,5,36,398,8,36,10,36,12,36,401,9,36,
        1,36,1,36,1,37,1,37,1,38,1,38,1,38,0,0,39,0,2,4,6,8,10,12,14,16,
        18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,
        62,64,66,68,70,72,74,76,0,6,1,0,48,49,1,0,20,21,1,0,24,25,1,0,37,
        38,2,0,36,36,50,50,1,0,40,47,438,0,81,1,0,0,0,2,95,1,0,0,0,4,97,
        1,0,0,0,6,113,1,0,0,0,8,115,1,0,0,0,10,126,1,0,0,0,12,128,1,0,0,
        0,14,138,1,0,0,0,16,144,1,0,0,0,18,157,1,0,0,0,20,168,1,0,0,0,22,
        184,1,0,0,0,24,197,1,0,0,0,26,210,1,0,0,0,28,223,1,0,0,0,30,241,
        1,0,0,0,32,258,1,0,0,0,34,261,1,0,0,0,36,264,1,0,0,0,38,285,1,0,
        0,0,40,289,1,0,0,0,42,291,1,0,0,0,44,301,1,0,0,0,46,310,1,0,0,0,
        48,320,1,0,0,0,50,325,1,0,0,0,52,327,1,0,0,0,54,334,1,0,0,0,56,339,
        1,0,0,0,58,349,1,0,0,0,60,357,1,0,0,0,62,364,1,0,0,0,64,373,1,0,
        0,0,66,375,1,0,0,0,68,377,1,0,0,0,70,389,1,0,0,0,72,395,1,0,0,0,
        74,404,1,0,0,0,76,406,1,0,0,0,78,80,3,2,1,0,79,78,1,0,0,0,80,83,
        1,0,0,0,81,79,1,0,0,0,81,82,1,0,0,0,82,87,1,0,0,0,83,81,1,0,0,0,
        84,86,3,10,5,0,85,84,1,0,0,0,86,89,1,0,0,0,87,85,1,0,0,0,87,88,1,
        0,0,0,88,90,1,0,0,0,89,87,1,0,0,0,90,91,5,0,0,1,91,1,1,0,0,0,92,
        96,3,4,2,0,93,96,3,6,3,0,94,96,3,8,4,0,95,92,1,0,0,0,95,93,1,0,0,
        0,95,94,1,0,0,0,96,3,1,0,0,0,97,98,5,1,0,0,98,99,5,48,0,0,99,5,1,
        0,0,0,100,101,5,2,0,0,101,102,5,3,0,0,102,114,7,0,0,0,103,104,5,
        2,0,0,104,105,5,49,0,0,105,107,7,0,0,0,106,108,3,44,22,0,107,106,
        1,0,0,0,107,108,1,0,0,0,108,114,1,0,0,0,109,110,5,4,0,0,110,114,
        5,49,0,0,111,112,5,5,0,0,112,114,5,49,0,0,113,100,1,0,0,0,113,103,
        1,0,0,0,113,109,1,0,0,0,113,111,1,0,0,0,114,7,1,0,0,0,115,116,5,
        6,0,0,116,117,5,48,0,0,117,9,1,0,0,0,118,127,3,12,6,0,119,127,3,
        14,7,0,120,127,3,16,8,0,121,127,3,20,10,0,122,127,3,22,11,0,123,
        127,3,24,12,0,124,127,3,26,13,0,125,127,3,28,14,0,126,118,1,0,0,
        0,126,119,1,0,0,0,126,120,1,0,0,0,126,121,1,0,0,0,126,122,1,0,0,
        0,126,123,1,0,0,0,126,124,1,0,0,0,126,125,1,0,0,0,127,11,1,0,0,0,
        128,129,5,7,0,0,129,130,3,50,25,0,130,133,5,49,0,0,131,132,5,8,0,
        0,132,134,3,64,32,0,133,131,1,0,0,0,133,134,1,0,0,0,134,136,1,0,
        0,0,135,137,3,74,37,0,136,135,1,0,0,0,136,137,1,0,0,0,137,13,1,0,
        0,0,138,139,5,9,0,0,139,140,3,50,25,0,140,142,5,49,0,0,141,143,3,
        44,22,0,142,141,1,0,0,0,142,143,1,0,0,0,143,15,1,0,0,0,144,145,5,
        10,0,0,145,146,5,49,0,0,146,150,5,11,0,0,147,149,3,18,9,0,148,147,
        1,0,0,0,149,152,1,0,0,0,150,148,1,0,0,0,150,151,1,0,0,0,151,153,
        1,0,0,0,152,150,1,0,0,0,153,155,5,12,0,0,154,156,3,44,22,0,155,154,
        1,0,0,0,155,156,1,0,0,0,156,17,1,0,0,0,157,160,5,49,0,0,158,159,
        5,8,0,0,159,161,3,66,33,0,160,158,1,0,0,0,160,161,1,0,0,0,161,163,
        1,0,0,0,162,164,3,44,22,0,163,162,1,0,0,0,163,164,1,0,0,0,164,166,
        1,0,0,0,165,167,3,74,37,0,166,165,1,0,0,0,166,167,1,0,0,0,167,19,
        1,0,0,0,168,169,5,13,0,0,169,170,5,49,0,0,170,177,5,11,0,0,171,173,
        5,48,0,0,172,174,3,74,37,0,173,172,1,0,0,0,173,174,1,0,0,0,174,176,
        1,0,0,0,175,171,1,0,0,0,176,179,1,0,0,0,177,175,1,0,0,0,177,178,
        1,0,0,0,178,180,1,0,0,0,179,177,1,0,0,0,180,182,5,12,0,0,181,183,
        3,44,22,0,182,181,1,0,0,0,182,183,1,0,0,0,183,21,1,0,0,0,184,185,
        5,14,0,0,185,186,5,49,0,0,186,190,5,11,0,0,187,189,3,30,15,0,188,
        187,1,0,0,0,189,192,1,0,0,0,190,188,1,0,0,0,190,191,1,0,0,0,191,
        193,1,0,0,0,192,190,1,0,0,0,193,195,5,12,0,0,194,196,3,44,22,0,195,
        194,1,0,0,0,195,196,1,0,0,0,196,23,1,0,0,0,197,198,5,15,0,0,198,
        199,5,49,0,0,199,203,5,11,0,0,200,202,3,30,15,0,201,200,1,0,0,0,
        202,205,1,0,0,0,203,201,1,0,0,0,203,204,1,0,0,0,204,206,1,0,0,0,
        205,203,1,0,0,0,206,208,5,12,0,0,207,209,3,44,22,0,208,207,1,0,0,
        0,208,209,1,0,0,0,209,25,1,0,0,0,210,211,5,16,0,0,211,212,5,49,0,
        0,212,216,5,11,0,0,213,215,3,30,15,0,214,213,1,0,0,0,215,218,1,0,
        0,0,216,214,1,0,0,0,216,217,1,0,0,0,217,219,1,0,0,0,218,216,1,0,
        0,0,219,221,5,12,0,0,220,222,3,44,22,0,221,220,1,0,0,0,221,222,1,
        0,0,0,222,27,1,0,0,0,223,224,5,17,0,0,224,227,5,49,0,0,225,226,5,
        18,0,0,226,228,5,49,0,0,227,225,1,0,0,0,227,228,1,0,0,0,228,229,
        1,0,0,0,229,233,5,11,0,0,230,232,3,36,18,0,231,230,1,0,0,0,232,235,
        1,0,0,0,233,231,1,0,0,0,233,234,1,0,0,0,234,236,1,0,0,0,235,233,
        1,0,0,0,236,238,5,12,0,0,237,239,3,44,22,0,238,237,1,0,0,0,238,239,
        1,0,0,0,239,29,1,0,0,0,240,242,3,32,16,0,241,240,1,0,0,0,241,242,
        1,0,0,0,242,244,1,0,0,0,243,245,3,34,17,0,244,243,1,0,0,0,244,245,
        1,0,0,0,245,246,1,0,0,0,246,247,3,50,25,0,247,250,5,49,0,0,248,249,
        5,8,0,0,249,251,3,64,32,0,250,248,1,0,0,0,250,251,1,0,0,0,251,253,
        1,0,0,0,252,254,3,44,22,0,253,252,1,0,0,0,253,254,1,0,0,0,254,256,
        1,0,0,0,255,257,3,74,37,0,256,255,1,0,0,0,256,257,1,0,0,0,257,31,
        1,0,0,0,258,259,3,66,33,0,259,260,5,19,0,0,260,33,1,0,0,0,261,262,
        7,1,0,0,262,35,1,0,0,0,263,265,3,38,19,0,264,263,1,0,0,0,264,265,
        1,0,0,0,265,266,1,0,0,0,266,267,3,40,20,0,267,268,5,49,0,0,268,272,
        5,22,0,0,269,271,3,30,15,0,270,269,1,0,0,0,271,274,1,0,0,0,272,270,
        1,0,0,0,272,273,1,0,0,0,273,275,1,0,0,0,274,272,1,0,0,0,275,277,
        5,23,0,0,276,278,3,42,21,0,277,276,1,0,0,0,277,278,1,0,0,0,278,280,
        1,0,0,0,279,281,3,44,22,0,280,279,1,0,0,0,280,281,1,0,0,0,281,283,
        1,0,0,0,282,284,3,74,37,0,283,282,1,0,0,0,283,284,1,0,0,0,284,37,
        1,0,0,0,285,286,7,2,0,0,286,39,1,0,0,0,287,290,3,50,25,0,288,290,
        5,26,0,0,289,287,1,0,0,0,289,288,1,0,0,0,290,41,1,0,0,0,291,292,
        5,27,0,0,292,296,5,22,0,0,293,295,3,30,15,0,294,293,1,0,0,0,295,
        298,1,0,0,0,296,294,1,0,0,0,296,297,1,0,0,0,297,299,1,0,0,0,298,
        296,1,0,0,0,299,300,5,23,0,0,300,43,1,0,0,0,301,305,5,22,0,0,302,
        304,3,46,23,0,303,302,1,0,0,0,304,307,1,0,0,0,305,303,1,0,0,0,305,
        306,1,0,0,0,306,308,1,0,0,0,307,305,1,0,0,0,308,309,5,23,0,0,309,
        45,1,0,0,0,310,313,5,49,0,0,311,312,5,8,0,0,312,314,3,48,24,0,313,
        311,1,0,0,0,313,314,1,0,0,0,314,316,1,0,0,0,315,317,3,74,37,0,316,
        315,1,0,0,0,316,317,1,0,0,0,317,47,1,0,0,0,318,321,3,66,33,0,319,
        321,5,48,0,0,320,318,1,0,0,0,320,319,1,0,0,0,321,49,1,0,0,0,322,
        326,3,52,26,0,323,326,5,49,0,0,324,326,3,54,27,0,325,322,1,0,0,0,
        325,323,1,0,0,0,325,324,1,0,0,0,326,51,1,0,0,0,327,329,3,76,38,0,
        328,330,3,44,22,0,329,328,1,0,0,0,329,330,1,0,0,0,330,53,1,0,0,0,
        331,335,3,56,28,0,332,335,3,58,29,0,333,335,3,60,30,0,334,331,1,
        0,0,0,334,332,1,0,0,0,334,333,1,0,0,0,335,337,1,0,0,0,336,338,3,
        44,22,0,337,336,1,0,0,0,337,338,1,0,0,0,338,55,1,0,0,0,339,341,5,
        28,0,0,340,342,3,62,31,0,341,340,1,0,0,0,341,342,1,0,0,0,342,343,
        1,0,0,0,343,344,5,29,0,0,344,345,3,50,25,0,345,346,5,50,0,0,346,
        347,3,50,25,0,347,348,5,30,0,0,348,57,1,0,0,0,349,351,5,31,0,0,350,
        352,3,62,31,0,351,350,1,0,0,0,351,352,1,0,0,0,352,353,1,0,0,0,353,
        354,5,29,0,0,354,355,3,50,25,0,355,356,5,30,0,0,356,59,1,0,0,0,357,
        358,5,32,0,0,358,359,5,29,0,0,359,360,3,50,25,0,360,362,5,30,0,0,
        361,363,3,62,31,0,362,361,1,0,0,0,362,363,1,0,0,0,363,61,1,0,0,0,
        364,365,5,33,0,0,365,366,5,48,0,0,366,63,1,0,0,0,367,374,3,66,33,
        0,368,374,5,39,0,0,369,374,5,48,0,0,370,374,5,49,0,0,371,374,3,68,
        34,0,372,374,3,72,36,0,373,367,1,0,0,0,373,368,1,0,0,0,373,369,1,
        0,0,0,373,370,1,0,0,0,373,371,1,0,0,0,373,372,1,0,0,0,374,65,1,0,
        0,0,375,376,7,3,0,0,376,67,1,0,0,0,377,384,5,34,0,0,378,380,3,64,
        32,0,379,381,3,74,37,0,380,379,1,0,0,0,380,381,1,0,0,0,381,383,1,
        0,0,0,382,378,1,0,0,0,383,386,1,0,0,0,384,382,1,0,0,0,384,385,1,
        0,0,0,385,387,1,0,0,0,386,384,1,0,0,0,387,388,5,35,0,0,388,69,1,
        0,0,0,389,390,3,64,32,0,390,391,5,19,0,0,391,393,3,64,32,0,392,394,
        3,74,37,0,393,392,1,0,0,0,393,394,1,0,0,0,394,71,1,0,0,0,395,399,
        5,11,0,0,396,398,3,70,35,0,397,396,1,0,0,0,398,401,1,0,0,0,399,397,
        1,0,0,0,399,400,1,0,0,0,400,402,1,0,0,0,401,399,1,0,0,0,402,403,
        5,12,0,0,403,73,1,0,0,0,404,405,7,4,0,0,405,75,1,0,0,0,406,407,7,
        5,0,0,407,77,1,0,0,0,54,81,87,95,107,113,126,133,136,142,150,155,
        160,163,166,173,177,182,190,195,203,208,216,221,227,233,238,241,
        244,250,253,256,264,272,277,280,283,289,296,305,313,316,320,325,
        329,334,337,341,351,362,373,380,384,393,399
    ]

class ThriftParser ( Parser ):

    grammarFileName = "Thrift.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

    decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'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'", "'['", "']'", "';'", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "'bool'", "'byte'", 
                     "'i16'", "'i32'", "'i64'", "'double'", "'string'", 
                     "'binary'", "<INVALID>", "<INVALID>", "','" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "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" ]

    RULE_document = 0
    RULE_header = 1
    RULE_include_ = 2
    RULE_namespace_ = 3
    RULE_cpp_include = 4
    RULE_definition = 5
    RULE_const_rule = 6
    RULE_typedef_ = 7
    RULE_enum_rule = 8
    RULE_enum_field = 9
    RULE_senum = 10
    RULE_struct_ = 11
    RULE_union_ = 12
    RULE_exception_ = 13
    RULE_service = 14
    RULE_field = 15
    RULE_field_id = 16
    RULE_field_req = 17
    RULE_function_ = 18
    RULE_oneway = 19
    RULE_function_type = 20
    RULE_throws_list = 21
    RULE_type_annotations = 22
    RULE_type_annotation = 23
    RULE_annotation_value = 24
    RULE_field_type = 25
    RULE_base_type = 26
    RULE_container_type = 27
    RULE_map_type = 28
    RULE_set_type = 29
    RULE_list_type = 30
    RULE_cpp_type = 31
    RULE_const_value = 32
    RULE_integer = 33
    RULE_const_list = 34
    RULE_const_map_entry = 35
    RULE_const_map = 36
    RULE_list_separator = 37
    RULE_real_base_type = 38

    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" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    T__5=6
    T__6=7
    T__7=8
    T__8=9
    T__9=10
    T__10=11
    T__11=12
    T__12=13
    T__13=14
    T__14=15
    T__15=16
    T__16=17
    T__17=18
    T__18=19
    T__19=20
    T__20=21
    T__21=22
    T__22=23
    T__23=24
    T__24=25
    T__25=26
    T__26=27
    T__27=28
    T__28=29
    T__29=30
    T__30=31
    T__31=32
    T__32=33
    T__33=34
    T__34=35
    T__35=36
    INTEGER=37
    HEX_INTEGER=38
    DOUBLE=39
    TYPE_BOOL=40
    TYPE_BYTE=41
    TYPE_I16=42
    TYPE_I32=43
    TYPE_I64=44
    TYPE_DOUBLE=45
    TYPE_STRING=46
    TYPE_BINARY=47
    LITERAL=48
    IDENTIFIER=49
    COMMA=50
    WS=51
    SL_COMMENT=52
    ML_COMMENT=53

    def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
        super().__init__(input, output)
        self.checkVersion("4.11.1")
        self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
        self._predicates = None




    class DocumentContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def EOF(self):
            return self.getToken(ThriftParser.EOF, 0)

        def header(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.HeaderContext)
            else:
                return self.getTypedRuleContext(ThriftParser.HeaderContext,i)


        def definition(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.DefinitionContext)
            else:
                return self.getTypedRuleContext(ThriftParser.DefinitionContext,i)


        def getRuleIndex(self):
            return ThriftParser.RULE_document

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDocument" ):
                listener.enterDocument(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDocument" ):
                listener.exitDocument(self)




    def document(self):

        localctx = ThriftParser.DocumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_document)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 81
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while ((_la) & ~0x3f) == 0 and ((1 << _la) & 118) != 0:
                self.state = 78
                self.header()
                self.state = 83
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 87
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while ((_la) & ~0x3f) == 0 and ((1 << _la) & 255616) != 0:
                self.state = 84
                self.definition()
                self.state = 89
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 90
            self.match(ThriftParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class HeaderContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def include_(self):
            return self.getTypedRuleContext(ThriftParser.Include_Context,0)


        def namespace_(self):
            return self.getTypedRuleContext(ThriftParser.Namespace_Context,0)


        def cpp_include(self):
            return self.getTypedRuleContext(ThriftParser.Cpp_includeContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_header

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterHeader" ):
                listener.enterHeader(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitHeader" ):
                listener.exitHeader(self)




    def header(self):

        localctx = ThriftParser.HeaderContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_header)
        try:
            self.state = 95
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [1]:
                self.enterOuterAlt(localctx, 1)
                self.state = 92
                self.include_()
                pass
            elif token in [2, 4, 5]:
                self.enterOuterAlt(localctx, 2)
                self.state = 93
                self.namespace_()
                pass
            elif token in [6]:
                self.enterOuterAlt(localctx, 3)
                self.state = 94
                self.cpp_include()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Include_Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LITERAL(self):
            return self.getToken(ThriftParser.LITERAL, 0)

        def getRuleIndex(self):
            return ThriftParser.RULE_include_

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterInclude_" ):
                listener.enterInclude_(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitInclude_" ):
                listener.exitInclude_(self)




    def include_(self):

        localctx = ThriftParser.Include_Context(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_include_)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 97
            self.match(ThriftParser.T__0)
            self.state = 98
            self.match(ThriftParser.LITERAL)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Namespace_Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self, i:int=None):
            if i is None:
                return self.getTokens(ThriftParser.IDENTIFIER)
            else:
                return self.getToken(ThriftParser.IDENTIFIER, i)

        def LITERAL(self):
            return self.getToken(ThriftParser.LITERAL, 0)

        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_namespace_

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterNamespace_" ):
                listener.enterNamespace_(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitNamespace_" ):
                listener.exitNamespace_(self)




    def namespace_(self):

        localctx = ThriftParser.Namespace_Context(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_namespace_)
        self._la = 0 # Token type
        try:
            self.state = 113
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,4,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 100
                self.match(ThriftParser.T__1)
                self.state = 101
                self.match(ThriftParser.T__2)
                self.state = 102
                _la = self._input.LA(1)
                if not(_la==48 or _la==49):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 103
                self.match(ThriftParser.T__1)
                self.state = 104
                self.match(ThriftParser.IDENTIFIER)
                self.state = 105
                _la = self._input.LA(1)
                if not(_la==48 or _la==49):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 107
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==22:
                    self.state = 106
                    self.type_annotations()


                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 109
                self.match(ThriftParser.T__3)
                self.state = 110
                self.match(ThriftParser.IDENTIFIER)
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 111
                self.match(ThriftParser.T__4)
                self.state = 112
                self.match(ThriftParser.IDENTIFIER)
                pass


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Cpp_includeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LITERAL(self):
            return self.getToken(ThriftParser.LITERAL, 0)

        def getRuleIndex(self):
            return ThriftParser.RULE_cpp_include

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCpp_include" ):
                listener.enterCpp_include(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCpp_include" ):
                listener.exitCpp_include(self)




    def cpp_include(self):

        localctx = ThriftParser.Cpp_includeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_cpp_include)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 115
            self.match(ThriftParser.T__5)
            self.state = 116
            self.match(ThriftParser.LITERAL)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DefinitionContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def const_rule(self):
            return self.getTypedRuleContext(ThriftParser.Const_ruleContext,0)


        def typedef_(self):
            return self.getTypedRuleContext(ThriftParser.Typedef_Context,0)


        def enum_rule(self):
            return self.getTypedRuleContext(ThriftParser.Enum_ruleContext,0)


        def senum(self):
            return self.getTypedRuleContext(ThriftParser.SenumContext,0)


        def struct_(self):
            return self.getTypedRuleContext(ThriftParser.Struct_Context,0)


        def union_(self):
            return self.getTypedRuleContext(ThriftParser.Union_Context,0)


        def exception_(self):
            return self.getTypedRuleContext(ThriftParser.Exception_Context,0)


        def service(self):
            return self.getTypedRuleContext(ThriftParser.ServiceContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_definition

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterDefinition" ):
                listener.enterDefinition(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitDefinition" ):
                listener.exitDefinition(self)




    def definition(self):

        localctx = ThriftParser.DefinitionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_definition)
        try:
            self.state = 126
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [7]:
                self.enterOuterAlt(localctx, 1)
                self.state = 118
                self.const_rule()
                pass
            elif token in [9]:
                self.enterOuterAlt(localctx, 2)
                self.state = 119
                self.typedef_()
                pass
            elif token in [10]:
                self.enterOuterAlt(localctx, 3)
                self.state = 120
                self.enum_rule()
                pass
            elif token in [13]:
                self.enterOuterAlt(localctx, 4)
                self.state = 121
                self.senum()
                pass
            elif token in [14]:
                self.enterOuterAlt(localctx, 5)
                self.state = 122
                self.struct_()
                pass
            elif token in [15]:
                self.enterOuterAlt(localctx, 6)
                self.state = 123
                self.union_()
                pass
            elif token in [16]:
                self.enterOuterAlt(localctx, 7)
                self.state = 124
                self.exception_()
                pass
            elif token in [17]:
                self.enterOuterAlt(localctx, 8)
                self.state = 125
                self.service()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Const_ruleContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def field_type(self):
            return self.getTypedRuleContext(ThriftParser.Field_typeContext,0)


        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def const_value(self):
            return self.getTypedRuleContext(ThriftParser.Const_valueContext,0)


        def list_separator(self):
            return self.getTypedRuleContext(ThriftParser.List_separatorContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_const_rule

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConst_rule" ):
                listener.enterConst_rule(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConst_rule" ):
                listener.exitConst_rule(self)




    def const_rule(self):

        localctx = ThriftParser.Const_ruleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_const_rule)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 128
            self.match(ThriftParser.T__6)
            self.state = 129
            self.field_type()
            self.state = 130
            self.match(ThriftParser.IDENTIFIER)
            self.state = 133
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==8:
                self.state = 131
                self.match(ThriftParser.T__7)
                self.state = 132
                self.const_value()


            self.state = 136
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==36 or _la==50:
                self.state = 135
                self.list_separator()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Typedef_Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def field_type(self):
            return self.getTypedRuleContext(ThriftParser.Field_typeContext,0)


        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_typedef_

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterTypedef_" ):
                listener.enterTypedef_(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitTypedef_" ):
                listener.exitTypedef_(self)




    def typedef_(self):

        localctx = ThriftParser.Typedef_Context(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_typedef_)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 138
            self.match(ThriftParser.T__8)
            self.state = 139
            self.field_type()
            self.state = 140
            self.match(ThriftParser.IDENTIFIER)
            self.state = 142
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 141
                self.type_annotations()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Enum_ruleContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def enum_field(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.Enum_fieldContext)
            else:
                return self.getTypedRuleContext(ThriftParser.Enum_fieldContext,i)


        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_enum_rule

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEnum_rule" ):
                listener.enterEnum_rule(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEnum_rule" ):
                listener.exitEnum_rule(self)




    def enum_rule(self):

        localctx = ThriftParser.Enum_ruleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_enum_rule)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 144
            self.match(ThriftParser.T__9)
            self.state = 145
            self.match(ThriftParser.IDENTIFIER)
            self.state = 146
            self.match(ThriftParser.T__10)
            self.state = 150
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==49:
                self.state = 147
                self.enum_field()
                self.state = 152
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 153
            self.match(ThriftParser.T__11)
            self.state = 155
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 154
                self.type_annotations()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Enum_fieldContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def integer(self):
            return self.getTypedRuleContext(ThriftParser.IntegerContext,0)


        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def list_separator(self):
            return self.getTypedRuleContext(ThriftParser.List_separatorContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_enum_field

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterEnum_field" ):
                listener.enterEnum_field(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitEnum_field" ):
                listener.exitEnum_field(self)




    def enum_field(self):

        localctx = ThriftParser.Enum_fieldContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_enum_field)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 157
            self.match(ThriftParser.IDENTIFIER)
            self.state = 160
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==8:
                self.state = 158
                self.match(ThriftParser.T__7)
                self.state = 159
                self.integer()


            self.state = 163
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 162
                self.type_annotations()


            self.state = 166
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==36 or _la==50:
                self.state = 165
                self.list_separator()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class SenumContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def LITERAL(self, i:int=None):
            if i is None:
                return self.getTokens(ThriftParser.LITERAL)
            else:
                return self.getToken(ThriftParser.LITERAL, i)

        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def list_separator(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.List_separatorContext)
            else:
                return self.getTypedRuleContext(ThriftParser.List_separatorContext,i)


        def getRuleIndex(self):
            return ThriftParser.RULE_senum

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSenum" ):
                listener.enterSenum(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSenum" ):
                listener.exitSenum(self)




    def senum(self):

        localctx = ThriftParser.SenumContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_senum)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 168
            self.match(ThriftParser.T__12)
            self.state = 169
            self.match(ThriftParser.IDENTIFIER)
            self.state = 170
            self.match(ThriftParser.T__10)
            self.state = 177
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==48:
                self.state = 171
                self.match(ThriftParser.LITERAL)
                self.state = 173
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==36 or _la==50:
                    self.state = 172
                    self.list_separator()


                self.state = 179
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 180
            self.match(ThriftParser.T__11)
            self.state = 182
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 181
                self.type_annotations()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Struct_Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def field(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.FieldContext)
            else:
                return self.getTypedRuleContext(ThriftParser.FieldContext,i)


        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_struct_

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStruct_" ):
                listener.enterStruct_(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitStruct_" ):
                listener.exitStruct_(self)




    def struct_(self):

        localctx = ThriftParser.Struct_Context(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_struct_)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 184
            self.match(ThriftParser.T__13)
            self.state = 185
            self.match(ThriftParser.IDENTIFIER)
            self.state = 186
            self.match(ThriftParser.T__10)
            self.state = 190
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while ((_la) & ~0x3f) == 0 and ((1 << _la) & 843744449396736) != 0:
                self.state = 187
                self.field()
                self.state = 192
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 193
            self.match(ThriftParser.T__11)
            self.state = 195
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 194
                self.type_annotations()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Union_Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def field(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.FieldContext)
            else:
                return self.getTypedRuleContext(ThriftParser.FieldContext,i)


        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_union_

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterUnion_" ):
                listener.enterUnion_(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitUnion_" ):
                listener.exitUnion_(self)




    def union_(self):

        localctx = ThriftParser.Union_Context(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_union_)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 197
            self.match(ThriftParser.T__14)
            self.state = 198
            self.match(ThriftParser.IDENTIFIER)
            self.state = 199
            self.match(ThriftParser.T__10)
            self.state = 203
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while ((_la) & ~0x3f) == 0 and ((1 << _la) & 843744449396736) != 0:
                self.state = 200
                self.field()
                self.state = 205
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 206
            self.match(ThriftParser.T__11)
            self.state = 208
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 207
                self.type_annotations()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Exception_Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def field(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.FieldContext)
            else:
                return self.getTypedRuleContext(ThriftParser.FieldContext,i)


        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_exception_

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterException_" ):
                listener.enterException_(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitException_" ):
                listener.exitException_(self)




    def exception_(self):

        localctx = ThriftParser.Exception_Context(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_exception_)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 210
            self.match(ThriftParser.T__15)
            self.state = 211
            self.match(ThriftParser.IDENTIFIER)
            self.state = 212
            self.match(ThriftParser.T__10)
            self.state = 216
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while ((_la) & ~0x3f) == 0 and ((1 << _la) & 843744449396736) != 0:
                self.state = 213
                self.field()
                self.state = 218
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 219
            self.match(ThriftParser.T__11)
            self.state = 221
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 220
                self.type_annotations()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ServiceContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self, i:int=None):
            if i is None:
                return self.getTokens(ThriftParser.IDENTIFIER)
            else:
                return self.getToken(ThriftParser.IDENTIFIER, i)

        def function_(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.Function_Context)
            else:
                return self.getTypedRuleContext(ThriftParser.Function_Context,i)


        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_service

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterService" ):
                listener.enterService(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitService" ):
                listener.exitService(self)




    def service(self):

        localctx = ThriftParser.ServiceContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_service)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 223
            self.match(ThriftParser.T__16)
            self.state = 224
            self.match(ThriftParser.IDENTIFIER)
            self.state = 227
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==18:
                self.state = 225
                self.match(ThriftParser.T__17)
                self.state = 226
                self.match(ThriftParser.IDENTIFIER)


            self.state = 229
            self.match(ThriftParser.T__10)
            self.state = 233
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while ((_la) & ~0x3f) == 0 and ((1 << _la) & 843332246831104) != 0:
                self.state = 230
                self.function_()
                self.state = 235
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 236
            self.match(ThriftParser.T__11)
            self.state = 238
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 237
                self.type_annotations()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class FieldContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def field_type(self):
            return self.getTypedRuleContext(ThriftParser.Field_typeContext,0)


        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def field_id(self):
            return self.getTypedRuleContext(ThriftParser.Field_idContext,0)


        def field_req(self):
            return self.getTypedRuleContext(ThriftParser.Field_reqContext,0)


        def const_value(self):
            return self.getTypedRuleContext(ThriftParser.Const_valueContext,0)


        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def list_separator(self):
            return self.getTypedRuleContext(ThriftParser.List_separatorContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_field

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterField" ):
                listener.enterField(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitField" ):
                listener.exitField(self)




    def field(self):

        localctx = ThriftParser.FieldContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_field)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 241
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==37 or _la==38:
                self.state = 240
                self.field_id()


            self.state = 244
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==20 or _la==21:
                self.state = 243
                self.field_req()


            self.state = 246
            self.field_type()
            self.state = 247
            self.match(ThriftParser.IDENTIFIER)
            self.state = 250
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==8:
                self.state = 248
                self.match(ThriftParser.T__7)
                self.state = 249
                self.const_value()


            self.state = 253
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 252
                self.type_annotations()


            self.state = 256
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==36 or _la==50:
                self.state = 255
                self.list_separator()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Field_idContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def integer(self):
            return self.getTypedRuleContext(ThriftParser.IntegerContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_field_id

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterField_id" ):
                listener.enterField_id(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitField_id" ):
                listener.exitField_id(self)




    def field_id(self):

        localctx = ThriftParser.Field_idContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_field_id)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 258
            self.integer()
            self.state = 259
            self.match(ThriftParser.T__18)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Field_reqContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ThriftParser.RULE_field_req

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterField_req" ):
                listener.enterField_req(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitField_req" ):
                listener.exitField_req(self)




    def field_req(self):

        localctx = ThriftParser.Field_reqContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_field_req)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 261
            _la = self._input.LA(1)
            if not(_la==20 or _la==21):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Function_Context(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def function_type(self):
            return self.getTypedRuleContext(ThriftParser.Function_typeContext,0)


        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def oneway(self):
            return self.getTypedRuleContext(ThriftParser.OnewayContext,0)


        def field(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.FieldContext)
            else:
                return self.getTypedRuleContext(ThriftParser.FieldContext,i)


        def throws_list(self):
            return self.getTypedRuleContext(ThriftParser.Throws_listContext,0)


        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def list_separator(self):
            return self.getTypedRuleContext(ThriftParser.List_separatorContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_function_

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFunction_" ):
                listener.enterFunction_(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFunction_" ):
                listener.exitFunction_(self)




    def function_(self):

        localctx = ThriftParser.Function_Context(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_function_)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 264
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==24 or _la==25:
                self.state = 263
                self.oneway()


            self.state = 266
            self.function_type()
            self.state = 267
            self.match(ThriftParser.IDENTIFIER)
            self.state = 268
            self.match(ThriftParser.T__21)
            self.state = 272
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while ((_la) & ~0x3f) == 0 and ((1 << _la) & 843744449396736) != 0:
                self.state = 269
                self.field()
                self.state = 274
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 275
            self.match(ThriftParser.T__22)
            self.state = 277
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==27:
                self.state = 276
                self.throws_list()


            self.state = 280
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 279
                self.type_annotations()


            self.state = 283
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==36 or _la==50:
                self.state = 282
                self.list_separator()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class OnewayContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser


        def getRuleIndex(self):
            return ThriftParser.RULE_oneway

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterOneway" ):
                listener.enterOneway(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitOneway" ):
                listener.exitOneway(self)




    def oneway(self):

        localctx = ThriftParser.OnewayContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_oneway)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 285
            _la = self._input.LA(1)
            if not(_la==24 or _la==25):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Function_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def field_type(self):
            return self.getTypedRuleContext(ThriftParser.Field_typeContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_function_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFunction_type" ):
                listener.enterFunction_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitFunction_type" ):
                listener.exitFunction_type(self)




    def function_type(self):

        localctx = ThriftParser.Function_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_function_type)
        try:
            self.state = 289
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [28, 31, 32, 40, 41, 42, 43, 44, 45, 46, 47, 49]:
                self.enterOuterAlt(localctx, 1)
                self.state = 287
                self.field_type()
                pass
            elif token in [26]:
                self.enterOuterAlt(localctx, 2)
                self.state = 288
                self.match(ThriftParser.T__25)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Throws_listContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def field(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.FieldContext)
            else:
                return self.getTypedRuleContext(ThriftParser.FieldContext,i)


        def getRuleIndex(self):
            return ThriftParser.RULE_throws_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterThrows_list" ):
                listener.enterThrows_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitThrows_list" ):
                listener.exitThrows_list(self)




    def throws_list(self):

        localctx = ThriftParser.Throws_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_throws_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 291
            self.match(ThriftParser.T__26)
            self.state = 292
            self.match(ThriftParser.T__21)
            self.state = 296
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while ((_la) & ~0x3f) == 0 and ((1 << _la) & 843744449396736) != 0:
                self.state = 293
                self.field()
                self.state = 298
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 299
            self.match(ThriftParser.T__22)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Type_annotationsContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def type_annotation(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.Type_annotationContext)
            else:
                return self.getTypedRuleContext(ThriftParser.Type_annotationContext,i)


        def getRuleIndex(self):
            return ThriftParser.RULE_type_annotations

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterType_annotations" ):
                listener.enterType_annotations(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitType_annotations" ):
                listener.exitType_annotations(self)




    def type_annotations(self):

        localctx = ThriftParser.Type_annotationsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_type_annotations)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 301
            self.match(ThriftParser.T__21)
            self.state = 305
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==49:
                self.state = 302
                self.type_annotation()
                self.state = 307
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 308
            self.match(ThriftParser.T__22)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Type_annotationContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def annotation_value(self):
            return self.getTypedRuleContext(ThriftParser.Annotation_valueContext,0)


        def list_separator(self):
            return self.getTypedRuleContext(ThriftParser.List_separatorContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_type_annotation

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterType_annotation" ):
                listener.enterType_annotation(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitType_annotation" ):
                listener.exitType_annotation(self)




    def type_annotation(self):

        localctx = ThriftParser.Type_annotationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 46, self.RULE_type_annotation)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 310
            self.match(ThriftParser.IDENTIFIER)
            self.state = 313
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==8:
                self.state = 311
                self.match(ThriftParser.T__7)
                self.state = 312
                self.annotation_value()


            self.state = 316
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==36 or _la==50:
                self.state = 315
                self.list_separator()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Annotation_valueContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def integer(self):
            return self.getTypedRuleContext(ThriftParser.IntegerContext,0)


        def LITERAL(self):
            return self.getToken(ThriftParser.LITERAL, 0)

        def getRuleIndex(self):
            return ThriftParser.RULE_annotation_value

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterAnnotation_value" ):
                listener.enterAnnotation_value(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitAnnotation_value" ):
                listener.exitAnnotation_value(self)




    def annotation_value(self):

        localctx = ThriftParser.Annotation_valueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 48, self.RULE_annotation_value)
        try:
            self.state = 320
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [37, 38]:
                self.enterOuterAlt(localctx, 1)
                self.state = 318
                self.integer()
                pass
            elif token in [48]:
                self.enterOuterAlt(localctx, 2)
                self.state = 319
                self.match(ThriftParser.LITERAL)
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Field_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def base_type(self):
            return self.getTypedRuleContext(ThriftParser.Base_typeContext,0)


        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def container_type(self):
            return self.getTypedRuleContext(ThriftParser.Container_typeContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_field_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterField_type" ):
                listener.enterField_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitField_type" ):
                listener.exitField_type(self)




    def field_type(self):

        localctx = ThriftParser.Field_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 50, self.RULE_field_type)
        try:
            self.state = 325
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [40, 41, 42, 43, 44, 45, 46, 47]:
                self.enterOuterAlt(localctx, 1)
                self.state = 322
                self.base_type()
                pass
            elif token in [49]:
                self.enterOuterAlt(localctx, 2)
                self.state = 323
                self.match(ThriftParser.IDENTIFIER)
                pass
            elif token in [28, 31, 32]:
                self.enterOuterAlt(localctx, 3)
                self.state = 324
                self.container_type()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Base_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def real_base_type(self):
            return self.getTypedRuleContext(ThriftParser.Real_base_typeContext,0)


        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_base_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterBase_type" ):
                listener.enterBase_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitBase_type" ):
                listener.exitBase_type(self)




    def base_type(self):

        localctx = ThriftParser.Base_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 52, self.RULE_base_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 327
            self.real_base_type()
            self.state = 329
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 328
                self.type_annotations()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Container_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def map_type(self):
            return self.getTypedRuleContext(ThriftParser.Map_typeContext,0)


        def set_type(self):
            return self.getTypedRuleContext(ThriftParser.Set_typeContext,0)


        def list_type(self):
            return self.getTypedRuleContext(ThriftParser.List_typeContext,0)


        def type_annotations(self):
            return self.getTypedRuleContext(ThriftParser.Type_annotationsContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_container_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterContainer_type" ):
                listener.enterContainer_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitContainer_type" ):
                listener.exitContainer_type(self)




    def container_type(self):

        localctx = ThriftParser.Container_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 54, self.RULE_container_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 334
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [28]:
                self.state = 331
                self.map_type()
                pass
            elif token in [31]:
                self.state = 332
                self.set_type()
                pass
            elif token in [32]:
                self.state = 333
                self.list_type()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 337
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==22:
                self.state = 336
                self.type_annotations()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Map_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def field_type(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.Field_typeContext)
            else:
                return self.getTypedRuleContext(ThriftParser.Field_typeContext,i)


        def COMMA(self):
            return self.getToken(ThriftParser.COMMA, 0)

        def cpp_type(self):
            return self.getTypedRuleContext(ThriftParser.Cpp_typeContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_map_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterMap_type" ):
                listener.enterMap_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitMap_type" ):
                listener.exitMap_type(self)




    def map_type(self):

        localctx = ThriftParser.Map_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 56, self.RULE_map_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 339
            self.match(ThriftParser.T__27)
            self.state = 341
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==33:
                self.state = 340
                self.cpp_type()


            self.state = 343
            self.match(ThriftParser.T__28)
            self.state = 344
            self.field_type()
            self.state = 345
            self.match(ThriftParser.COMMA)
            self.state = 346
            self.field_type()
            self.state = 347
            self.match(ThriftParser.T__29)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Set_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def field_type(self):
            return self.getTypedRuleContext(ThriftParser.Field_typeContext,0)


        def cpp_type(self):
            return self.getTypedRuleContext(ThriftParser.Cpp_typeContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_set_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterSet_type" ):
                listener.enterSet_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitSet_type" ):
                listener.exitSet_type(self)




    def set_type(self):

        localctx = ThriftParser.Set_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 58, self.RULE_set_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 349
            self.match(ThriftParser.T__30)
            self.state = 351
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==33:
                self.state = 350
                self.cpp_type()


            self.state = 353
            self.match(ThriftParser.T__28)
            self.state = 354
            self.field_type()
            self.state = 355
            self.match(ThriftParser.T__29)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class List_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def field_type(self):
            return self.getTypedRuleContext(ThriftParser.Field_typeContext,0)


        def cpp_type(self):
            return self.getTypedRuleContext(ThriftParser.Cpp_typeContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_list_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterList_type" ):
                listener.enterList_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitList_type" ):
                listener.exitList_type(self)




    def list_type(self):

        localctx = ThriftParser.List_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 60, self.RULE_list_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 357
            self.match(ThriftParser.T__31)
            self.state = 358
            self.match(ThriftParser.T__28)
            self.state = 359
            self.field_type()
            self.state = 360
            self.match(ThriftParser.T__29)
            self.state = 362
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==33:
                self.state = 361
                self.cpp_type()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Cpp_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def LITERAL(self):
            return self.getToken(ThriftParser.LITERAL, 0)

        def getRuleIndex(self):
            return ThriftParser.RULE_cpp_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterCpp_type" ):
                listener.enterCpp_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitCpp_type" ):
                listener.exitCpp_type(self)




    def cpp_type(self):

        localctx = ThriftParser.Cpp_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 62, self.RULE_cpp_type)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 364
            self.match(ThriftParser.T__32)
            self.state = 365
            self.match(ThriftParser.LITERAL)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Const_valueContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def integer(self):
            return self.getTypedRuleContext(ThriftParser.IntegerContext,0)


        def DOUBLE(self):
            return self.getToken(ThriftParser.DOUBLE, 0)

        def LITERAL(self):
            return self.getToken(ThriftParser.LITERAL, 0)

        def IDENTIFIER(self):
            return self.getToken(ThriftParser.IDENTIFIER, 0)

        def const_list(self):
            return self.getTypedRuleContext(ThriftParser.Const_listContext,0)


        def const_map(self):
            return self.getTypedRuleContext(ThriftParser.Const_mapContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_const_value

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConst_value" ):
                listener.enterConst_value(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConst_value" ):
                listener.exitConst_value(self)




    def const_value(self):

        localctx = ThriftParser.Const_valueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 64, self.RULE_const_value)
        try:
            self.state = 373
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [37, 38]:
                self.enterOuterAlt(localctx, 1)
                self.state = 367
                self.integer()
                pass
            elif token in [39]:
                self.enterOuterAlt(localctx, 2)
                self.state = 368
                self.match(ThriftParser.DOUBLE)
                pass
            elif token in [48]:
                self.enterOuterAlt(localctx, 3)
                self.state = 369
                self.match(ThriftParser.LITERAL)
                pass
            elif token in [49]:
                self.enterOuterAlt(localctx, 4)
                self.state = 370
                self.match(ThriftParser.IDENTIFIER)
                pass
            elif token in [34]:
                self.enterOuterAlt(localctx, 5)
                self.state = 371
                self.const_list()
                pass
            elif token in [11]:
                self.enterOuterAlt(localctx, 6)
                self.state = 372
                self.const_map()
                pass
            else:
                raise NoViableAltException(self)

        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class IntegerContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def INTEGER(self):
            return self.getToken(ThriftParser.INTEGER, 0)

        def HEX_INTEGER(self):
            return self.getToken(ThriftParser.HEX_INTEGER, 0)

        def getRuleIndex(self):
            return ThriftParser.RULE_integer

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterInteger" ):
                listener.enterInteger(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitInteger" ):
                listener.exitInteger(self)




    def integer(self):

        localctx = ThriftParser.IntegerContext(self, self._ctx, self.state)
        self.enterRule(localctx, 66, self.RULE_integer)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 375
            _la = self._input.LA(1)
            if not(_la==37 or _la==38):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Const_listContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def const_value(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.Const_valueContext)
            else:
                return self.getTypedRuleContext(ThriftParser.Const_valueContext,i)


        def list_separator(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.List_separatorContext)
            else:
                return self.getTypedRuleContext(ThriftParser.List_separatorContext,i)


        def getRuleIndex(self):
            return ThriftParser.RULE_const_list

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConst_list" ):
                listener.enterConst_list(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConst_list" ):
                listener.exitConst_list(self)




    def const_list(self):

        localctx = ThriftParser.Const_listContext(self, self._ctx, self.state)
        self.enterRule(localctx, 68, self.RULE_const_list)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 377
            self.match(ThriftParser.T__33)
            self.state = 384
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while ((_la) & ~0x3f) == 0 and ((1 << _la) & 845404182677504) != 0:
                self.state = 378
                self.const_value()
                self.state = 380
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==36 or _la==50:
                    self.state = 379
                    self.list_separator()


                self.state = 386
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 387
            self.match(ThriftParser.T__34)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Const_map_entryContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def const_value(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.Const_valueContext)
            else:
                return self.getTypedRuleContext(ThriftParser.Const_valueContext,i)


        def list_separator(self):
            return self.getTypedRuleContext(ThriftParser.List_separatorContext,0)


        def getRuleIndex(self):
            return ThriftParser.RULE_const_map_entry

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConst_map_entry" ):
                listener.enterConst_map_entry(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConst_map_entry" ):
                listener.exitConst_map_entry(self)




    def const_map_entry(self):

        localctx = ThriftParser.Const_map_entryContext(self, self._ctx, self.state)
        self.enterRule(localctx, 70, self.RULE_const_map_entry)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 389
            self.const_value()
            self.state = 390
            self.match(ThriftParser.T__18)
            self.state = 391
            self.const_value()
            self.state = 393
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==36 or _la==50:
                self.state = 392
                self.list_separator()


        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Const_mapContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def const_map_entry(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(ThriftParser.Const_map_entryContext)
            else:
                return self.getTypedRuleContext(ThriftParser.Const_map_entryContext,i)


        def getRuleIndex(self):
            return ThriftParser.RULE_const_map

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterConst_map" ):
                listener.enterConst_map(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitConst_map" ):
                listener.exitConst_map(self)




    def const_map(self):

        localctx = ThriftParser.Const_mapContext(self, self._ctx, self.state)
        self.enterRule(localctx, 72, self.RULE_const_map)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 395
            self.match(ThriftParser.T__10)
            self.state = 399
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while ((_la) & ~0x3f) == 0 and ((1 << _la) & 845404182677504) != 0:
                self.state = 396
                self.const_map_entry()
                self.state = 401
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 402
            self.match(ThriftParser.T__11)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class List_separatorContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def COMMA(self):
            return self.getToken(ThriftParser.COMMA, 0)

        def getRuleIndex(self):
            return ThriftParser.RULE_list_separator

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterList_separator" ):
                listener.enterList_separator(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitList_separator" ):
                listener.exitList_separator(self)




    def list_separator(self):

        localctx = ThriftParser.List_separatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 74, self.RULE_list_separator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 404
            _la = self._input.LA(1)
            if not(_la==36 or _la==50):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Real_base_typeContext(ParserRuleContext):
        __slots__ = 'parser'

        def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
            super().__init__(parent, invokingState)
            self.parser = parser

        def TYPE_BOOL(self):
            return self.getToken(ThriftParser.TYPE_BOOL, 0)

        def TYPE_BYTE(self):
            return self.getToken(ThriftParser.TYPE_BYTE, 0)

        def TYPE_I16(self):
            return self.getToken(ThriftParser.TYPE_I16, 0)

        def TYPE_I32(self):
            return self.getToken(ThriftParser.TYPE_I32, 0)

        def TYPE_I64(self):
            return self.getToken(ThriftParser.TYPE_I64, 0)

        def TYPE_DOUBLE(self):
            return self.getToken(ThriftParser.TYPE_DOUBLE, 0)

        def TYPE_STRING(self):
            return self.getToken(ThriftParser.TYPE_STRING, 0)

        def TYPE_BINARY(self):
            return self.getToken(ThriftParser.TYPE_BINARY, 0)

        def getRuleIndex(self):
            return ThriftParser.RULE_real_base_type

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterReal_base_type" ):
                listener.enterReal_base_type(self)

        def exitRule(self, listener:ParseTreeListener):
            if hasattr( listener, "exitReal_base_type" ):
                listener.exitReal_base_type(self)




    def real_base_type(self):

        localctx = ThriftParser.Real_base_typeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 76, self.RULE_real_base_type)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 406
            _la = self._input.LA(1)
            if not(((_la) & ~0x3f) == 0 and ((1 << _la) & 280375465082880) != 0):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx





