# Generated from /vsot/antlr/HTMLParser.g4 by ANTLR 4.8
# 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():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3 ")
        buf.write("\u00ee\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
        buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
        buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
        buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\3\2")
        buf.write("\3\2\6\2\63\n\2\r\2\16\2\64\3\2\3\2\3\3\3\3\3\3\3\3\3")
        buf.write("\4\3\4\6\4?\n\4\r\4\16\4@\3\4\3\4\3\5\3\5\3\6\3\6\3\6")
        buf.write("\3\6\3\6\7\6L\n\6\f\6\16\6O\13\6\3\6\5\6R\n\6\3\6\3\6")
        buf.write("\3\6\3\6\3\6\7\6Y\n\6\f\6\16\6\\\13\6\3\6\5\6_\n\6\3\6")
        buf.write("\3\6\3\6\3\6\3\6\7\6f\n\6\f\6\16\6i\13\6\3\6\7\6l\n\6")
        buf.write("\f\6\16\6o\13\6\3\7\7\7r\n\7\f\7\16\7u\13\7\3\7\3\7\7")
        buf.write("\7y\n\7\f\7\16\7|\13\7\3\b\3\b\3\b\7\b\u0081\n\b\f\b\16")
        buf.write("\b\u0084\13\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b")
        buf.write("\7\b\u0090\n\b\f\b\16\b\u0093\13\b\3\b\3\b\3\b\3\b\3\b")
        buf.write("\7\b\u009a\n\b\f\b\16\b\u009d\13\b\3\b\3\b\3\b\3\b\3\b")
        buf.write("\3\b\3\b\3\b\5\b\u00a7\n\b\3\t\5\t\u00aa\n\t\3\t\3\t\3")
        buf.write("\t\5\t\u00af\n\t\3\t\5\t\u00b2\n\t\7\t\u00b4\n\t\f\t\16")
        buf.write("\t\u00b7\13\t\3\n\3\n\3\n\3\n\3\n\5\n\u00be\n\n\3\13\3")
        buf.write("\13\3\f\3\f\3\r\3\r\3\16\3\16\3\17\3\17\5\17\u00ca\n\17")
        buf.write("\3\20\3\20\3\21\3\21\3\22\3\22\3\23\3\23\3\24\3\24\3\25")
        buf.write("\3\25\7\25\u00d8\n\25\f\25\16\25\u00db\13\25\3\25\3\25")
        buf.write("\3\25\3\26\3\26\3\27\3\27\7\27\u00e4\n\27\f\27\16\27\u00e7")
        buf.write("\13\27\3\27\3\27\3\27\3\30\3\30\3\30\2\2\31\2\4\6\b\n")
        buf.write("\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\2\6\4\2\r\r\21")
        buf.write("\21\3\2\7\b\3\2\33\34\3\2\35\36\2\u0100\2\60\3\2\2\2\4")
        buf.write("8\3\2\2\2\6<\3\2\2\2\bD\3\2\2\2\nM\3\2\2\2\fs\3\2\2\2")
        buf.write("\16\u00a6\3\2\2\2\20\u00a9\3\2\2\2\22\u00bd\3\2\2\2\24")
        buf.write("\u00bf\3\2\2\2\26\u00c1\3\2\2\2\30\u00c3\3\2\2\2\32\u00c5")
        buf.write("\3\2\2\2\34\u00c9\3\2\2\2\36\u00cb\3\2\2\2 \u00cd\3\2")
        buf.write("\2\2\"\u00cf\3\2\2\2$\u00d1\3\2\2\2&\u00d3\3\2\2\2(\u00d5")
        buf.write("\3\2\2\2*\u00df\3\2\2\2,\u00e1\3\2\2\2.\u00eb\3\2\2\2")
        buf.write("\60\62\7\3\2\2\61\63\5\b\5\2\62\61\3\2\2\2\63\64\3\2\2")
        buf.write("\2\64\62\3\2\2\2\64\65\3\2\2\2\65\66\3\2\2\2\66\67\7\22")
        buf.write("\2\2\67\3\3\2\2\289\7\5\2\29:\5\20\t\2:;\7\6\2\2;\5\3")
        buf.write("\2\2\2<>\7\4\2\2=?\5\b\5\2>=\3\2\2\2?@\3\2\2\2@>\3\2\2")
        buf.write("\2@A\3\2\2\2AB\3\2\2\2BC\7\22\2\2C\7\3\2\2\2DE\7\23\2")
        buf.write("\2E\t\3\2\2\2FL\5&\24\2GL\5\2\2\2HL\5\4\3\2IL\5\6\4\2")
        buf.write("JL\7\r\2\2KF\3\2\2\2KG\3\2\2\2KH\3\2\2\2KI\3\2\2\2KJ\3")
        buf.write("\2\2\2LO\3\2\2\2MK\3\2\2\2MN\3\2\2\2NQ\3\2\2\2OM\3\2\2")
        buf.write("\2PR\5$\23\2QP\3\2\2\2QR\3\2\2\2RZ\3\2\2\2SY\5&\24\2T")
        buf.write("Y\5\2\2\2UY\5\4\3\2VY\5\6\4\2WY\7\r\2\2XS\3\2\2\2XT\3")
        buf.write("\2\2\2XU\3\2\2\2XV\3\2\2\2XW\3\2\2\2Y\\\3\2\2\2ZX\3\2")
        buf.write("\2\2Z[\3\2\2\2[^\3\2\2\2\\Z\3\2\2\2]_\5\"\22\2^]\3\2\2")
        buf.write("\2^_\3\2\2\2_g\3\2\2\2`f\5&\24\2af\5\2\2\2bf\5\4\3\2c")
        buf.write("f\5\6\4\2df\7\r\2\2e`\3\2\2\2ea\3\2\2\2eb\3\2\2\2ec\3")
        buf.write("\2\2\2ed\3\2\2\2fi\3\2\2\2ge\3\2\2\2gh\3\2\2\2hm\3\2\2")
        buf.write("\2ig\3\2\2\2jl\5\f\7\2kj\3\2\2\2lo\3\2\2\2mk\3\2\2\2m")
        buf.write("n\3\2\2\2n\13\3\2\2\2om\3\2\2\2pr\5\34\17\2qp\3\2\2\2")
        buf.write("ru\3\2\2\2sq\3\2\2\2st\3\2\2\2tv\3\2\2\2us\3\2\2\2vz\5")
        buf.write("\16\b\2wy\5\34\17\2xw\3\2\2\2y|\3\2\2\2zx\3\2\2\2z{\3")
        buf.write("\2\2\2{\r\3\2\2\2|z\3\2\2\2}~\7\20\2\2~\u0082\5\30\r\2")
        buf.write("\177\u0081\5\22\n\2\u0080\177\3\2\2\2\u0081\u0084\3\2")
        buf.write("\2\2\u0082\u0080\3\2\2\2\u0082\u0083\3\2\2\2\u0083\u0085")
        buf.write("\3\2\2\2\u0084\u0082\3\2\2\2\u0085\u0086\7\25\2\2\u0086")
        buf.write("\u0087\5\20\t\2\u0087\u0088\7\20\2\2\u0088\u0089\7\27")
        buf.write("\2\2\u0089\u008a\5\30\r\2\u008a\u008b\7\25\2\2\u008b\u00a7")
        buf.write("\3\2\2\2\u008c\u008d\7\20\2\2\u008d\u0091\5\30\r\2\u008e")
        buf.write("\u0090\5\22\n\2\u008f\u008e\3\2\2\2\u0090\u0093\3\2\2")
        buf.write("\2\u0091\u008f\3\2\2\2\u0091\u0092\3\2\2\2\u0092\u0094")
        buf.write("\3\2\2\2\u0093\u0091\3\2\2\2\u0094\u0095\7\26\2\2\u0095")
        buf.write("\u00a7\3\2\2\2\u0096\u0097\7\20\2\2\u0097\u009b\5\30\r")
        buf.write("\2\u0098\u009a\5\22\n\2\u0099\u0098\3\2\2\2\u009a\u009d")
        buf.write("\3\2\2\2\u009b\u0099\3\2\2\2\u009b\u009c\3\2\2\2\u009c")
        buf.write("\u009e\3\2\2\2\u009d\u009b\3\2\2\2\u009e\u009f\7\25\2")
        buf.write("\2\u009f\u00a7\3\2\2\2\u00a0\u00a7\5&\24\2\u00a1\u00a7")
        buf.write("\5(\25\2\u00a2\u00a7\5,\27\2\u00a3\u00a7\5\2\2\2\u00a4")
        buf.write("\u00a7\5\4\3\2\u00a5\u00a7\5\6\4\2\u00a6}\3\2\2\2\u00a6")
        buf.write("\u008c\3\2\2\2\u00a6\u0096\3\2\2\2\u00a6\u00a0\3\2\2\2")
        buf.write("\u00a6\u00a1\3\2\2\2\u00a6\u00a2\3\2\2\2\u00a6\u00a3\3")
        buf.write("\2\2\2\u00a6\u00a4\3\2\2\2\u00a6\u00a5\3\2\2\2\u00a7\17")
        buf.write("\3\2\2\2\u00a8\u00aa\5\32\16\2\u00a9\u00a8\3\2\2\2\u00a9")
        buf.write("\u00aa\3\2\2\2\u00aa\u00b5\3\2\2\2\u00ab\u00af\5\16\b")
        buf.write("\2\u00ac\u00af\5 \21\2\u00ad\u00af\5\36\20\2\u00ae\u00ab")
        buf.write("\3\2\2\2\u00ae\u00ac\3\2\2\2\u00ae\u00ad\3\2\2\2\u00af")
        buf.write("\u00b1\3\2\2\2\u00b0\u00b2\5\32\16\2\u00b1\u00b0\3\2\2")
        buf.write("\2\u00b1\u00b2\3\2\2\2\u00b2\u00b4\3\2\2\2\u00b3\u00ae")
        buf.write("\3\2\2\2\u00b4\u00b7\3\2\2\2\u00b5\u00b3\3\2\2\2\u00b5")
        buf.write("\u00b6\3\2\2\2\u00b6\21\3\2\2\2\u00b7\u00b5\3\2\2\2\u00b8")
        buf.write("\u00b9\5\24\13\2\u00b9\u00ba\7\30\2\2\u00ba\u00bb\5\26")
        buf.write("\f\2\u00bb\u00be\3\2\2\2\u00bc\u00be\5\24\13\2\u00bd\u00b8")
        buf.write("\3\2\2\2\u00bd\u00bc\3\2\2\2\u00be\23\3\2\2\2\u00bf\u00c0")
        buf.write("\7\31\2\2\u00c0\25\3\2\2\2\u00c1\u00c2\7\37\2\2\u00c2")
        buf.write("\27\3\2\2\2\u00c3\u00c4\7\31\2\2\u00c4\31\3\2\2\2\u00c5")
        buf.write("\u00c6\t\2\2\2\u00c6\33\3\2\2\2\u00c7\u00ca\5\36\20\2")
        buf.write("\u00c8\u00ca\7\r\2\2\u00c9\u00c7\3\2\2\2\u00c9\u00c8\3")
        buf.write("\2\2\2\u00ca\35\3\2\2\2\u00cb\u00cc\t\3\2\2\u00cc\37\3")
        buf.write("\2\2\2\u00cd\u00ce\7\n\2\2\u00ce!\3\2\2\2\u00cf\u00d0")
        buf.write("\7\13\2\2\u00d0#\3\2\2\2\u00d1\u00d2\7\t\2\2\u00d2%\3")
        buf.write("\2\2\2\u00d3\u00d4\7\f\2\2\u00d4\'\3\2\2\2\u00d5\u00d9")
        buf.write("\7\16\2\2\u00d6\u00d8\5\22\n\2\u00d7\u00d6\3\2\2\2\u00d8")
        buf.write("\u00db\3\2\2\2\u00d9\u00d7\3\2\2\2\u00d9\u00da\3\2\2\2")
        buf.write("\u00da\u00dc\3\2\2\2\u00db\u00d9\3\2\2\2\u00dc\u00dd\7")
        buf.write("\25\2\2\u00dd\u00de\5*\26\2\u00de)\3\2\2\2\u00df\u00e0")
        buf.write("\t\4\2\2\u00e0+\3\2\2\2\u00e1\u00e5\7\17\2\2\u00e2\u00e4")
        buf.write("\5\22\n\2\u00e3\u00e2\3\2\2\2\u00e4\u00e7\3\2\2\2\u00e5")
        buf.write("\u00e3\3\2\2\2\u00e5\u00e6\3\2\2\2\u00e6\u00e8\3\2\2\2")
        buf.write("\u00e7\u00e5\3\2\2\2\u00e8\u00e9\7\25\2\2\u00e9\u00ea")
        buf.write("\5.\30\2\u00ea-\3\2\2\2\u00eb\u00ec\t\5\2\2\u00ec/\3\2")
        buf.write("\2\2\33\64@KMQXZ^egmsz\u0082\u0091\u009b\u00a6\u00a9\u00ae")
        buf.write("\u00b1\u00b5\u00bd\u00c9\u00d9\u00e5")
        return buf.getvalue()


class HTMLParser ( Parser ):

    grammarFileName = "HTMLParser.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'{%'", "'{{'", "'{#'", "'#}'", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'<'", "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'>'", "'/>'", "'/'", "'='" ]

    symbolicNames = [ "<INVALID>", "TEMPLATE_TAG_OPEN", "TEMPLATE_VARIABLE_OPEN", 
                      "TEMPLATE_COMMENT_OPEN", "TEMPLATE_COMMENT_CLOSE", 
                      "HTML_COMMENT", "HTML_CONDITIONAL_COMMENT", "XML_DECLARATION", 
                      "CDATA", "DTD", "SCRIPTLET", "SEA_WS", "SCRIPT_OPEN", 
                      "STYLE_OPEN", "TAG_OPEN", "HTML_TEXT", "TEMPLATE_TAG_CLOSE", 
                      "TEMPLATE_CONTENT", "TEMPLATE_WS", "TAG_CLOSE", "TAG_SLASH_CLOSE", 
                      "TAG_SLASH", "TAG_EQUALS", "TAG_NAME", "TAG_WHITESPACE", 
                      "SCRIPT_BODY", "SCRIPT_SHORT_BODY", "STYLE_BODY", 
                      "STYLE_SHORT_BODY", "ATTVALUE_VALUE", "ATTRIBUTE" ]

    RULE_templateTag = 0
    RULE_templateComment = 1
    RULE_templateVariable = 2
    RULE_templateContent = 3
    RULE_htmlDocument = 4
    RULE_htmlElements = 5
    RULE_htmlElement = 6
    RULE_htmlContent = 7
    RULE_htmlAttribute = 8
    RULE_htmlAttributeName = 9
    RULE_htmlAttributeValue = 10
    RULE_htmlTagName = 11
    RULE_htmlChardata = 12
    RULE_htmlMisc = 13
    RULE_htmlComment = 14
    RULE_xhtmlCDATA = 15
    RULE_dtd = 16
    RULE_xml = 17
    RULE_scriptlet = 18
    RULE_script = 19
    RULE_scriptBody = 20
    RULE_style = 21
    RULE_styleBody = 22

    ruleNames =  [ "templateTag", "templateComment", "templateVariable", 
                   "templateContent", "htmlDocument", "htmlElements", "htmlElement", 
                   "htmlContent", "htmlAttribute", "htmlAttributeName", 
                   "htmlAttributeValue", "htmlTagName", "htmlChardata", 
                   "htmlMisc", "htmlComment", "xhtmlCDATA", "dtd", "xml", 
                   "scriptlet", "script", "scriptBody", "style", "styleBody" ]

    EOF = Token.EOF
    TEMPLATE_TAG_OPEN=1
    TEMPLATE_VARIABLE_OPEN=2
    TEMPLATE_COMMENT_OPEN=3
    TEMPLATE_COMMENT_CLOSE=4
    HTML_COMMENT=5
    HTML_CONDITIONAL_COMMENT=6
    XML_DECLARATION=7
    CDATA=8
    DTD=9
    SCRIPTLET=10
    SEA_WS=11
    SCRIPT_OPEN=12
    STYLE_OPEN=13
    TAG_OPEN=14
    HTML_TEXT=15
    TEMPLATE_TAG_CLOSE=16
    TEMPLATE_CONTENT=17
    TEMPLATE_WS=18
    TAG_CLOSE=19
    TAG_SLASH_CLOSE=20
    TAG_SLASH=21
    TAG_EQUALS=22
    TAG_NAME=23
    TAG_WHITESPACE=24
    SCRIPT_BODY=25
    SCRIPT_SHORT_BODY=26
    STYLE_BODY=27
    STYLE_SHORT_BODY=28
    ATTVALUE_VALUE=29
    ATTRIBUTE=30

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




    class TemplateTagContext(ParserRuleContext):

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

        def TEMPLATE_TAG_OPEN(self):
            return self.getToken(HTMLParser.TEMPLATE_TAG_OPEN, 0)

        def TEMPLATE_TAG_CLOSE(self):
            return self.getToken(HTMLParser.TEMPLATE_TAG_CLOSE, 0)

        def templateContent(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.TemplateContentContext)
            else:
                return self.getTypedRuleContext(HTMLParser.TemplateContentContext,i)


        def getRuleIndex(self):
            return HTMLParser.RULE_templateTag

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTemplateTag" ):
                return visitor.visitTemplateTag(self)
            else:
                return visitor.visitChildren(self)




    def templateTag(self):

        localctx = HTMLParser.TemplateTagContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_templateTag)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 46
            localctx.openTag = self.match(HTMLParser.TEMPLATE_TAG_OPEN)
            self.state = 48 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 47
                self.templateContent()
                self.state = 50 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==HTMLParser.TEMPLATE_CONTENT):
                    break

            self.state = 52
            localctx.closeTag = self.match(HTMLParser.TEMPLATE_TAG_CLOSE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TemplateCommentContext(ParserRuleContext):

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

        def TEMPLATE_COMMENT_OPEN(self):
            return self.getToken(HTMLParser.TEMPLATE_COMMENT_OPEN, 0)

        def htmlContent(self):
            return self.getTypedRuleContext(HTMLParser.HtmlContentContext,0)


        def TEMPLATE_COMMENT_CLOSE(self):
            return self.getToken(HTMLParser.TEMPLATE_COMMENT_CLOSE, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_templateComment

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTemplateComment" ):
                return visitor.visitTemplateComment(self)
            else:
                return visitor.visitChildren(self)




    def templateComment(self):

        localctx = HTMLParser.TemplateCommentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_templateComment)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 54
            self.match(HTMLParser.TEMPLATE_COMMENT_OPEN)
            self.state = 55
            self.htmlContent()
            self.state = 56
            self.match(HTMLParser.TEMPLATE_COMMENT_CLOSE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TemplateVariableContext(ParserRuleContext):

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

        def TEMPLATE_VARIABLE_OPEN(self):
            return self.getToken(HTMLParser.TEMPLATE_VARIABLE_OPEN, 0)

        def TEMPLATE_TAG_CLOSE(self):
            return self.getToken(HTMLParser.TEMPLATE_TAG_CLOSE, 0)

        def templateContent(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.TemplateContentContext)
            else:
                return self.getTypedRuleContext(HTMLParser.TemplateContentContext,i)


        def getRuleIndex(self):
            return HTMLParser.RULE_templateVariable

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTemplateVariable" ):
                return visitor.visitTemplateVariable(self)
            else:
                return visitor.visitChildren(self)




    def templateVariable(self):

        localctx = HTMLParser.TemplateVariableContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_templateVariable)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 58
            self.match(HTMLParser.TEMPLATE_VARIABLE_OPEN)
            self.state = 60 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 59
                self.templateContent()
                self.state = 62 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not (_la==HTMLParser.TEMPLATE_CONTENT):
                    break

            self.state = 64
            self.match(HTMLParser.TEMPLATE_TAG_CLOSE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class TemplateContentContext(ParserRuleContext):

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

        def TEMPLATE_CONTENT(self):
            return self.getToken(HTMLParser.TEMPLATE_CONTENT, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_templateContent

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTemplateContent" ):
                return visitor.visitTemplateContent(self)
            else:
                return visitor.visitChildren(self)




    def templateContent(self):

        localctx = HTMLParser.TemplateContentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_templateContent)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 66
            self.match(HTMLParser.TEMPLATE_CONTENT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class HtmlDocumentContext(ParserRuleContext):

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

        def scriptlet(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.ScriptletContext)
            else:
                return self.getTypedRuleContext(HTMLParser.ScriptletContext,i)


        def templateTag(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.TemplateTagContext)
            else:
                return self.getTypedRuleContext(HTMLParser.TemplateTagContext,i)


        def templateComment(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.TemplateCommentContext)
            else:
                return self.getTypedRuleContext(HTMLParser.TemplateCommentContext,i)


        def templateVariable(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.TemplateVariableContext)
            else:
                return self.getTypedRuleContext(HTMLParser.TemplateVariableContext,i)


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

        def xml(self):
            return self.getTypedRuleContext(HTMLParser.XmlContext,0)


        def dtd(self):
            return self.getTypedRuleContext(HTMLParser.DtdContext,0)


        def htmlElements(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.HtmlElementsContext)
            else:
                return self.getTypedRuleContext(HTMLParser.HtmlElementsContext,i)


        def getRuleIndex(self):
            return HTMLParser.RULE_htmlDocument

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHtmlDocument" ):
                return visitor.visitHtmlDocument(self)
            else:
                return visitor.visitChildren(self)




    def htmlDocument(self):

        localctx = HTMLParser.HtmlDocumentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_htmlDocument)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 75
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,3,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 73
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [HTMLParser.SCRIPTLET]:
                        self.state = 68
                        self.scriptlet()
                        pass
                    elif token in [HTMLParser.TEMPLATE_TAG_OPEN]:
                        self.state = 69
                        self.templateTag()
                        pass
                    elif token in [HTMLParser.TEMPLATE_COMMENT_OPEN]:
                        self.state = 70
                        self.templateComment()
                        pass
                    elif token in [HTMLParser.TEMPLATE_VARIABLE_OPEN]:
                        self.state = 71
                        self.templateVariable()
                        pass
                    elif token in [HTMLParser.SEA_WS]:
                        self.state = 72
                        self.match(HTMLParser.SEA_WS)
                        pass
                    else:
                        raise NoViableAltException(self)
             
                self.state = 77
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,3,self._ctx)

            self.state = 79
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==HTMLParser.XML_DECLARATION:
                self.state = 78
                self.xml()


            self.state = 88
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,6,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 86
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [HTMLParser.SCRIPTLET]:
                        self.state = 81
                        self.scriptlet()
                        pass
                    elif token in [HTMLParser.TEMPLATE_TAG_OPEN]:
                        self.state = 82
                        self.templateTag()
                        pass
                    elif token in [HTMLParser.TEMPLATE_COMMENT_OPEN]:
                        self.state = 83
                        self.templateComment()
                        pass
                    elif token in [HTMLParser.TEMPLATE_VARIABLE_OPEN]:
                        self.state = 84
                        self.templateVariable()
                        pass
                    elif token in [HTMLParser.SEA_WS]:
                        self.state = 85
                        self.match(HTMLParser.SEA_WS)
                        pass
                    else:
                        raise NoViableAltException(self)
             
                self.state = 90
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,6,self._ctx)

            self.state = 92
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==HTMLParser.DTD:
                self.state = 91
                self.dtd()


            self.state = 101
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,9,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 99
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [HTMLParser.SCRIPTLET]:
                        self.state = 94
                        self.scriptlet()
                        pass
                    elif token in [HTMLParser.TEMPLATE_TAG_OPEN]:
                        self.state = 95
                        self.templateTag()
                        pass
                    elif token in [HTMLParser.TEMPLATE_COMMENT_OPEN]:
                        self.state = 96
                        self.templateComment()
                        pass
                    elif token in [HTMLParser.TEMPLATE_VARIABLE_OPEN]:
                        self.state = 97
                        self.templateVariable()
                        pass
                    elif token in [HTMLParser.SEA_WS]:
                        self.state = 98
                        self.match(HTMLParser.SEA_WS)
                        pass
                    else:
                        raise NoViableAltException(self)
             
                self.state = 103
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,9,self._ctx)

            self.state = 107
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << HTMLParser.TEMPLATE_TAG_OPEN) | (1 << HTMLParser.TEMPLATE_VARIABLE_OPEN) | (1 << HTMLParser.TEMPLATE_COMMENT_OPEN) | (1 << HTMLParser.HTML_COMMENT) | (1 << HTMLParser.HTML_CONDITIONAL_COMMENT) | (1 << HTMLParser.SCRIPTLET) | (1 << HTMLParser.SEA_WS) | (1 << HTMLParser.SCRIPT_OPEN) | (1 << HTMLParser.STYLE_OPEN) | (1 << HTMLParser.TAG_OPEN))) != 0):
                self.state = 104
                self.htmlElements()
                self.state = 109
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class HtmlElementsContext(ParserRuleContext):

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

        def htmlElement(self):
            return self.getTypedRuleContext(HTMLParser.HtmlElementContext,0)


        def htmlMisc(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.HtmlMiscContext)
            else:
                return self.getTypedRuleContext(HTMLParser.HtmlMiscContext,i)


        def getRuleIndex(self):
            return HTMLParser.RULE_htmlElements

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHtmlElements" ):
                return visitor.visitHtmlElements(self)
            else:
                return visitor.visitChildren(self)




    def htmlElements(self):

        localctx = HTMLParser.HtmlElementsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_htmlElements)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 113
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while (((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << HTMLParser.HTML_COMMENT) | (1 << HTMLParser.HTML_CONDITIONAL_COMMENT) | (1 << HTMLParser.SEA_WS))) != 0):
                self.state = 110
                self.htmlMisc()
                self.state = 115
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 116
            self.htmlElement()
            self.state = 120
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,12,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 117
                    self.htmlMisc() 
                self.state = 122
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,12,self._ctx)

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


    class HtmlElementContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return HTMLParser.RULE_htmlElement

     
        def copyFrom(self, ctx:ParserRuleContext):
            super().copyFrom(ctx)



    class DummyContext(HtmlElementContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a HTMLParser.HtmlElementContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def script(self):
            return self.getTypedRuleContext(HTMLParser.ScriptContext,0)

        def templateTag(self):
            return self.getTypedRuleContext(HTMLParser.TemplateTagContext,0)

        def templateComment(self):
            return self.getTypedRuleContext(HTMLParser.TemplateCommentContext,0)

        def templateVariable(self):
            return self.getTypedRuleContext(HTMLParser.TemplateVariableContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDummy" ):
                return visitor.visitDummy(self)
            else:
                return visitor.visitChildren(self)


    class RawTagContext(HtmlElementContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a HTMLParser.HtmlElementContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def scriptlet(self):
            return self.getTypedRuleContext(HTMLParser.ScriptletContext,0)

        def style(self):
            return self.getTypedRuleContext(HTMLParser.StyleContext,0)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitRawTag" ):
                return visitor.visitRawTag(self)
            else:
                return visitor.visitChildren(self)


    class TagContext(HtmlElementContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a HTMLParser.HtmlElementContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TAG_OPEN(self, i:int=None):
            if i is None:
                return self.getTokens(HTMLParser.TAG_OPEN)
            else:
                return self.getToken(HTMLParser.TAG_OPEN, i)
        def htmlTagName(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.HtmlTagNameContext)
            else:
                return self.getTypedRuleContext(HTMLParser.HtmlTagNameContext,i)

        def TAG_CLOSE(self, i:int=None):
            if i is None:
                return self.getTokens(HTMLParser.TAG_CLOSE)
            else:
                return self.getToken(HTMLParser.TAG_CLOSE, i)
        def htmlContent(self):
            return self.getTypedRuleContext(HTMLParser.HtmlContentContext,0)

        def TAG_SLASH(self):
            return self.getToken(HTMLParser.TAG_SLASH, 0)
        def htmlAttribute(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.HtmlAttributeContext)
            else:
                return self.getTypedRuleContext(HTMLParser.HtmlAttributeContext,i)


        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitTag" ):
                return visitor.visitTag(self)
            else:
                return visitor.visitChildren(self)


    class SelfClosingTagContext(HtmlElementContext):

        def __init__(self, parser, ctx:ParserRuleContext): # actually a HTMLParser.HtmlElementContext
            super().__init__(parser)
            self.copyFrom(ctx)

        def TAG_OPEN(self):
            return self.getToken(HTMLParser.TAG_OPEN, 0)
        def htmlTagName(self):
            return self.getTypedRuleContext(HTMLParser.HtmlTagNameContext,0)

        def TAG_SLASH_CLOSE(self):
            return self.getToken(HTMLParser.TAG_SLASH_CLOSE, 0)
        def htmlAttribute(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.HtmlAttributeContext)
            else:
                return self.getTypedRuleContext(HTMLParser.HtmlAttributeContext,i)

        def TAG_CLOSE(self):
            return self.getToken(HTMLParser.TAG_CLOSE, 0)

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitSelfClosingTag" ):
                return visitor.visitSelfClosingTag(self)
            else:
                return visitor.visitChildren(self)



    def htmlElement(self):

        localctx = HTMLParser.HtmlElementContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_htmlElement)
        self._la = 0 # Token type
        try:
            self.state = 164
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,16,self._ctx)
            if la_ == 1:
                localctx = HTMLParser.TagContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 123
                self.match(HTMLParser.TAG_OPEN)
                self.state = 124
                self.htmlTagName()
                self.state = 128
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==HTMLParser.TAG_NAME:
                    self.state = 125
                    self.htmlAttribute()
                    self.state = 130
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 131
                self.match(HTMLParser.TAG_CLOSE)
                self.state = 132
                self.htmlContent()
                self.state = 133
                self.match(HTMLParser.TAG_OPEN)
                self.state = 134
                self.match(HTMLParser.TAG_SLASH)
                self.state = 135
                self.htmlTagName()
                self.state = 136
                self.match(HTMLParser.TAG_CLOSE)
                pass

            elif la_ == 2:
                localctx = HTMLParser.SelfClosingTagContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 138
                self.match(HTMLParser.TAG_OPEN)
                self.state = 139
                self.htmlTagName()
                self.state = 143
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==HTMLParser.TAG_NAME:
                    self.state = 140
                    self.htmlAttribute()
                    self.state = 145
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 146
                self.match(HTMLParser.TAG_SLASH_CLOSE)
                pass

            elif la_ == 3:
                localctx = HTMLParser.SelfClosingTagContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 148
                self.match(HTMLParser.TAG_OPEN)
                self.state = 149
                self.htmlTagName()
                self.state = 153
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==HTMLParser.TAG_NAME:
                    self.state = 150
                    self.htmlAttribute()
                    self.state = 155
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 156
                self.match(HTMLParser.TAG_CLOSE)
                pass

            elif la_ == 4:
                localctx = HTMLParser.RawTagContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 158
                self.scriptlet()
                pass

            elif la_ == 5:
                localctx = HTMLParser.DummyContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 159
                self.script()
                pass

            elif la_ == 6:
                localctx = HTMLParser.RawTagContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 160
                self.style()
                pass

            elif la_ == 7:
                localctx = HTMLParser.DummyContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 161
                self.templateTag()
                pass

            elif la_ == 8:
                localctx = HTMLParser.DummyContext(self, localctx)
                self.enterOuterAlt(localctx, 8)
                self.state = 162
                self.templateComment()
                pass

            elif la_ == 9:
                localctx = HTMLParser.DummyContext(self, localctx)
                self.enterOuterAlt(localctx, 9)
                self.state = 163
                self.templateVariable()
                pass


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


    class HtmlContentContext(ParserRuleContext):

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

        def htmlChardata(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.HtmlChardataContext)
            else:
                return self.getTypedRuleContext(HTMLParser.HtmlChardataContext,i)


        def htmlElement(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.HtmlElementContext)
            else:
                return self.getTypedRuleContext(HTMLParser.HtmlElementContext,i)


        def xhtmlCDATA(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.XhtmlCDATAContext)
            else:
                return self.getTypedRuleContext(HTMLParser.XhtmlCDATAContext,i)


        def htmlComment(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.HtmlCommentContext)
            else:
                return self.getTypedRuleContext(HTMLParser.HtmlCommentContext,i)


        def getRuleIndex(self):
            return HTMLParser.RULE_htmlContent

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHtmlContent" ):
                return visitor.visitHtmlContent(self)
            else:
                return visitor.visitChildren(self)




    def htmlContent(self):

        localctx = HTMLParser.HtmlContentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_htmlContent)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 167
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==HTMLParser.SEA_WS or _la==HTMLParser.HTML_TEXT:
                self.state = 166
                self.htmlChardata()


            self.state = 179
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,20,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 172
                    self._errHandler.sync(self)
                    token = self._input.LA(1)
                    if token in [HTMLParser.TEMPLATE_TAG_OPEN, HTMLParser.TEMPLATE_VARIABLE_OPEN, HTMLParser.TEMPLATE_COMMENT_OPEN, HTMLParser.SCRIPTLET, HTMLParser.SCRIPT_OPEN, HTMLParser.STYLE_OPEN, HTMLParser.TAG_OPEN]:
                        self.state = 169
                        self.htmlElement()
                        pass
                    elif token in [HTMLParser.CDATA]:
                        self.state = 170
                        self.xhtmlCDATA()
                        pass
                    elif token in [HTMLParser.HTML_COMMENT, HTMLParser.HTML_CONDITIONAL_COMMENT]:
                        self.state = 171
                        self.htmlComment()
                        pass
                    else:
                        raise NoViableAltException(self)

                    self.state = 175
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)
                    if _la==HTMLParser.SEA_WS or _la==HTMLParser.HTML_TEXT:
                        self.state = 174
                        self.htmlChardata()

             
                self.state = 181
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,20,self._ctx)

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


    class HtmlAttributeContext(ParserRuleContext):

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

        def htmlAttributeName(self):
            return self.getTypedRuleContext(HTMLParser.HtmlAttributeNameContext,0)


        def TAG_EQUALS(self):
            return self.getToken(HTMLParser.TAG_EQUALS, 0)

        def htmlAttributeValue(self):
            return self.getTypedRuleContext(HTMLParser.HtmlAttributeValueContext,0)


        def getRuleIndex(self):
            return HTMLParser.RULE_htmlAttribute

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHtmlAttribute" ):
                return visitor.visitHtmlAttribute(self)
            else:
                return visitor.visitChildren(self)




    def htmlAttribute(self):

        localctx = HTMLParser.HtmlAttributeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_htmlAttribute)
        try:
            self.state = 187
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,21,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 182
                self.htmlAttributeName()
                self.state = 183
                self.match(HTMLParser.TAG_EQUALS)
                self.state = 184
                self.htmlAttributeValue()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 186
                self.htmlAttributeName()
                pass


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


    class HtmlAttributeNameContext(ParserRuleContext):

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

        def TAG_NAME(self):
            return self.getToken(HTMLParser.TAG_NAME, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_htmlAttributeName

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHtmlAttributeName" ):
                return visitor.visitHtmlAttributeName(self)
            else:
                return visitor.visitChildren(self)




    def htmlAttributeName(self):

        localctx = HTMLParser.HtmlAttributeNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_htmlAttributeName)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 189
            self.match(HTMLParser.TAG_NAME)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class HtmlAttributeValueContext(ParserRuleContext):

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

        def ATTVALUE_VALUE(self):
            return self.getToken(HTMLParser.ATTVALUE_VALUE, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_htmlAttributeValue

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHtmlAttributeValue" ):
                return visitor.visitHtmlAttributeValue(self)
            else:
                return visitor.visitChildren(self)




    def htmlAttributeValue(self):

        localctx = HTMLParser.HtmlAttributeValueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_htmlAttributeValue)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 191
            self.match(HTMLParser.ATTVALUE_VALUE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class HtmlTagNameContext(ParserRuleContext):

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

        def TAG_NAME(self):
            return self.getToken(HTMLParser.TAG_NAME, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_htmlTagName

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHtmlTagName" ):
                return visitor.visitHtmlTagName(self)
            else:
                return visitor.visitChildren(self)




    def htmlTagName(self):

        localctx = HTMLParser.HtmlTagNameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_htmlTagName)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 193
            self.match(HTMLParser.TAG_NAME)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class HtmlChardataContext(ParserRuleContext):

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

        def HTML_TEXT(self):
            return self.getToken(HTMLParser.HTML_TEXT, 0)

        def SEA_WS(self):
            return self.getToken(HTMLParser.SEA_WS, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_htmlChardata

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHtmlChardata" ):
                return visitor.visitHtmlChardata(self)
            else:
                return visitor.visitChildren(self)




    def htmlChardata(self):

        localctx = HTMLParser.HtmlChardataContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_htmlChardata)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 195
            _la = self._input.LA(1)
            if not(_la==HTMLParser.SEA_WS or _la==HTMLParser.HTML_TEXT):
                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 HtmlMiscContext(ParserRuleContext):

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

        def htmlComment(self):
            return self.getTypedRuleContext(HTMLParser.HtmlCommentContext,0)


        def SEA_WS(self):
            return self.getToken(HTMLParser.SEA_WS, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_htmlMisc

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHtmlMisc" ):
                return visitor.visitHtmlMisc(self)
            else:
                return visitor.visitChildren(self)




    def htmlMisc(self):

        localctx = HTMLParser.HtmlMiscContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_htmlMisc)
        try:
            self.state = 199
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [HTMLParser.HTML_COMMENT, HTMLParser.HTML_CONDITIONAL_COMMENT]:
                self.enterOuterAlt(localctx, 1)
                self.state = 197
                self.htmlComment()
                pass
            elif token in [HTMLParser.SEA_WS]:
                self.enterOuterAlt(localctx, 2)
                self.state = 198
                self.match(HTMLParser.SEA_WS)
                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 HtmlCommentContext(ParserRuleContext):

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

        def HTML_COMMENT(self):
            return self.getToken(HTMLParser.HTML_COMMENT, 0)

        def HTML_CONDITIONAL_COMMENT(self):
            return self.getToken(HTMLParser.HTML_CONDITIONAL_COMMENT, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_htmlComment

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitHtmlComment" ):
                return visitor.visitHtmlComment(self)
            else:
                return visitor.visitChildren(self)




    def htmlComment(self):

        localctx = HTMLParser.HtmlCommentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_htmlComment)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 201
            _la = self._input.LA(1)
            if not(_la==HTMLParser.HTML_COMMENT or _la==HTMLParser.HTML_CONDITIONAL_COMMENT):
                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 XhtmlCDATAContext(ParserRuleContext):

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

        def CDATA(self):
            return self.getToken(HTMLParser.CDATA, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_xhtmlCDATA

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitXhtmlCDATA" ):
                return visitor.visitXhtmlCDATA(self)
            else:
                return visitor.visitChildren(self)




    def xhtmlCDATA(self):

        localctx = HTMLParser.XhtmlCDATAContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_xhtmlCDATA)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 203
            self.match(HTMLParser.CDATA)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DtdContext(ParserRuleContext):

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

        def DTD(self):
            return self.getToken(HTMLParser.DTD, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_dtd

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitDtd" ):
                return visitor.visitDtd(self)
            else:
                return visitor.visitChildren(self)




    def dtd(self):

        localctx = HTMLParser.DtdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_dtd)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 205
            self.match(HTMLParser.DTD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class XmlContext(ParserRuleContext):

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

        def XML_DECLARATION(self):
            return self.getToken(HTMLParser.XML_DECLARATION, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_xml

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitXml" ):
                return visitor.visitXml(self)
            else:
                return visitor.visitChildren(self)




    def xml(self):

        localctx = HTMLParser.XmlContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_xml)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 207
            self.match(HTMLParser.XML_DECLARATION)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ScriptletContext(ParserRuleContext):

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

        def SCRIPTLET(self):
            return self.getToken(HTMLParser.SCRIPTLET, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_scriptlet

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitScriptlet" ):
                return visitor.visitScriptlet(self)
            else:
                return visitor.visitChildren(self)




    def scriptlet(self):

        localctx = HTMLParser.ScriptletContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_scriptlet)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 209
            self.match(HTMLParser.SCRIPTLET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ScriptContext(ParserRuleContext):

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

        def SCRIPT_OPEN(self):
            return self.getToken(HTMLParser.SCRIPT_OPEN, 0)

        def TAG_CLOSE(self):
            return self.getToken(HTMLParser.TAG_CLOSE, 0)

        def scriptBody(self):
            return self.getTypedRuleContext(HTMLParser.ScriptBodyContext,0)


        def htmlAttribute(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.HtmlAttributeContext)
            else:
                return self.getTypedRuleContext(HTMLParser.HtmlAttributeContext,i)


        def getRuleIndex(self):
            return HTMLParser.RULE_script

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitScript" ):
                return visitor.visitScript(self)
            else:
                return visitor.visitChildren(self)




    def script(self):

        localctx = HTMLParser.ScriptContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_script)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 211
            self.match(HTMLParser.SCRIPT_OPEN)
            self.state = 215
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HTMLParser.TAG_NAME:
                self.state = 212
                self.htmlAttribute()
                self.state = 217
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 218
            self.match(HTMLParser.TAG_CLOSE)
            self.state = 219
            self.scriptBody()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ScriptBodyContext(ParserRuleContext):

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

        def SCRIPT_BODY(self):
            return self.getToken(HTMLParser.SCRIPT_BODY, 0)

        def SCRIPT_SHORT_BODY(self):
            return self.getToken(HTMLParser.SCRIPT_SHORT_BODY, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_scriptBody

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitScriptBody" ):
                return visitor.visitScriptBody(self)
            else:
                return visitor.visitChildren(self)




    def scriptBody(self):

        localctx = HTMLParser.ScriptBodyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_scriptBody)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 221
            _la = self._input.LA(1)
            if not(_la==HTMLParser.SCRIPT_BODY or _la==HTMLParser.SCRIPT_SHORT_BODY):
                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 StyleContext(ParserRuleContext):

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

        def STYLE_OPEN(self):
            return self.getToken(HTMLParser.STYLE_OPEN, 0)

        def TAG_CLOSE(self):
            return self.getToken(HTMLParser.TAG_CLOSE, 0)

        def styleBody(self):
            return self.getTypedRuleContext(HTMLParser.StyleBodyContext,0)


        def htmlAttribute(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(HTMLParser.HtmlAttributeContext)
            else:
                return self.getTypedRuleContext(HTMLParser.HtmlAttributeContext,i)


        def getRuleIndex(self):
            return HTMLParser.RULE_style

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStyle" ):
                return visitor.visitStyle(self)
            else:
                return visitor.visitChildren(self)




    def style(self):

        localctx = HTMLParser.StyleContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_style)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 223
            self.match(HTMLParser.STYLE_OPEN)
            self.state = 227
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==HTMLParser.TAG_NAME:
                self.state = 224
                self.htmlAttribute()
                self.state = 229
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 230
            self.match(HTMLParser.TAG_CLOSE)
            self.state = 231
            self.styleBody()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class StyleBodyContext(ParserRuleContext):

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

        def STYLE_BODY(self):
            return self.getToken(HTMLParser.STYLE_BODY, 0)

        def STYLE_SHORT_BODY(self):
            return self.getToken(HTMLParser.STYLE_SHORT_BODY, 0)

        def getRuleIndex(self):
            return HTMLParser.RULE_styleBody

        def accept(self, visitor:ParseTreeVisitor):
            if hasattr( visitor, "visitStyleBody" ):
                return visitor.visitStyleBody(self)
            else:
                return visitor.visitChildren(self)




    def styleBody(self):

        localctx = HTMLParser.StyleBodyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_styleBody)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 233
            _la = self._input.LA(1)
            if not(_la==HTMLParser.STYLE_BODY or _la==HTMLParser.STYLE_SHORT_BODY):
                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





