# Generated from UVL.g4 by ANTLR 4.9
# 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\34")
        buf.write("\u00bf\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\3\2\5\2\60\n")
        buf.write("\2\3\2\3\2\5\2\64\n\2\3\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4")
        buf.write("\7\4>\n\4\f\4\16\4A\13\4\3\4\5\4D\n\4\3\5\3\5\3\5\7\5")
        buf.write("I\n\5\f\5\16\5L\13\5\3\5\5\5O\n\5\3\6\3\6\5\6S\n\6\3\6")
        buf.write("\5\6V\n\6\3\7\3\7\7\7Z\n\7\f\7\16\7]\13\7\3\7\3\7\3\b")
        buf.write("\3\b\3\b\3\b\3\b\7\bf\n\b\f\b\16\bi\13\b\3\b\3\b\5\bm")
        buf.write("\n\b\3\t\3\t\3\t\3\t\3\t\5\tt\n\t\3\n\3\n\3\13\3\13\3")
        buf.write("\f\3\f\3\r\3\r\3\r\3\r\5\r\u0080\n\r\7\r\u0082\n\r\f\r")
        buf.write("\16\r\u0085\13\r\3\r\3\r\3\16\3\16\3\16\3\16\3\16\3\16")
        buf.write("\3\16\5\16\u0090\n\16\3\17\3\17\3\17\3\20\3\20\3\20\3")
        buf.write("\20\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\3\23\3\23")
        buf.write("\3\23\3\23\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\26")
        buf.write("\3\26\3\26\7\26\u00b0\n\26\f\26\16\26\u00b3\13\26\3\26")
        buf.write("\3\26\3\27\3\27\3\27\5\27\u00ba\n\27\3\27\5\27\u00bd\n")
        buf.write("\27\3\27\2\2\30\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36")
        buf.write(" \"$&(*,\2\4\3\3\34\34\3\2\25\30\2\u00bf\2/\3\2\2\2\4")
        buf.write("\65\3\2\2\2\6:\3\2\2\2\bE\3\2\2\2\nP\3\2\2\2\f[\3\2\2")
        buf.write("\2\16l\3\2\2\2\20n\3\2\2\2\22u\3\2\2\2\24w\3\2\2\2\26")
        buf.write("y\3\2\2\2\30{\3\2\2\2\32\u008f\3\2\2\2\34\u0091\3\2\2")
        buf.write("\2\36\u0094\3\2\2\2 \u0098\3\2\2\2\"\u009c\3\2\2\2$\u00a0")
        buf.write("\3\2\2\2&\u00a4\3\2\2\2(\u00a8\3\2\2\2*\u00ac\3\2\2\2")
        buf.write(",\u00b6\3\2\2\2.\60\5*\26\2/.\3\2\2\2/\60\3\2\2\2\60\61")
        buf.write("\3\2\2\2\61\63\5\4\3\2\62\64\5\30\r\2\63\62\3\2\2\2\63")
        buf.write("\64\3\2\2\2\64\3\3\2\2\2\65\66\7\3\2\2\66\67\7\33\2\2")
        buf.write("\678\5\6\4\289\7\34\2\29\5\3\2\2\2:C\5\n\6\2;?\7\33\2")
        buf.write("\2<>\5\b\5\2=<\3\2\2\2>A\3\2\2\2?=\3\2\2\2?@\3\2\2\2@")
        buf.write("B\3\2\2\2A?\3\2\2\2BD\t\2\2\2C;\3\2\2\2CD\3\2\2\2D\7\3")
        buf.write("\2\2\2EN\5\26\f\2FJ\7\33\2\2GI\5\6\4\2HG\3\2\2\2IL\3\2")
        buf.write("\2\2JH\3\2\2\2JK\3\2\2\2KM\3\2\2\2LJ\3\2\2\2MO\t\2\2\2")
        buf.write("NF\3\2\2\2NO\3\2\2\2O\t\3\2\2\2PR\5\f\7\2QS\5\16\b\2R")
        buf.write("Q\3\2\2\2RS\3\2\2\2SU\3\2\2\2TV\7\31\2\2UT\3\2\2\2UV\3")
        buf.write("\2\2\2V\13\3\2\2\2WX\7\25\2\2XZ\7\4\2\2YW\3\2\2\2Z]\3")
        buf.write("\2\2\2[Y\3\2\2\2[\\\3\2\2\2\\^\3\2\2\2][\3\2\2\2^_\7\25")
        buf.write("\2\2_\r\3\2\2\2`m\7\5\2\2ab\7\6\2\2bg\5\20\t\2cd\7\7\2")
        buf.write("\2df\5\20\t\2ec\3\2\2\2fi\3\2\2\2ge\3\2\2\2gh\3\2\2\2")
        buf.write("hj\3\2\2\2ig\3\2\2\2jk\7\b\2\2km\3\2\2\2l`\3\2\2\2la\3")
        buf.write("\2\2\2m\17\3\2\2\2ns\5\22\n\2op\7\t\2\2pq\5\24\13\2qr")
        buf.write("\7\t\2\2rt\3\2\2\2so\3\2\2\2st\3\2\2\2t\21\3\2\2\2uv\7")
        buf.write("\25\2\2v\23\3\2\2\2wx\t\3\2\2x\25\3\2\2\2yz\7\24\2\2z")
        buf.write("\27\3\2\2\2{|\7\n\2\2|\u0083\7\33\2\2}\177\5\32\16\2~")
        buf.write("\u0080\7\31\2\2\177~\3\2\2\2\177\u0080\3\2\2\2\u0080\u0082")
        buf.write("\3\2\2\2\u0081}\3\2\2\2\u0082\u0085\3\2\2\2\u0083\u0081")
        buf.write("\3\2\2\2\u0083\u0084\3\2\2\2\u0084\u0086\3\2\2\2\u0085")
        buf.write("\u0083\3\2\2\2\u0086\u0087\t\2\2\2\u0087\31\3\2\2\2\u0088")
        buf.write("\u0090\5\34\17\2\u0089\u0090\5\36\20\2\u008a\u0090\5 ")
        buf.write("\21\2\u008b\u0090\5\"\22\2\u008c\u0090\5$\23\2\u008d\u0090")
        buf.write("\5&\24\2\u008e\u0090\5(\25\2\u008f\u0088\3\2\2\2\u008f")
        buf.write("\u0089\3\2\2\2\u008f\u008a\3\2\2\2\u008f\u008b\3\2\2\2")
        buf.write("\u008f\u008c\3\2\2\2\u008f\u008d\3\2\2\2\u008f\u008e\3")
        buf.write("\2\2\2\u0090\33\3\2\2\2\u0091\u0092\7\13\2\2\u0092\u0093")
        buf.write("\7\25\2\2\u0093\35\3\2\2\2\u0094\u0095\7\25\2\2\u0095")
        buf.write("\u0096\7\f\2\2\u0096\u0097\7\25\2\2\u0097\37\3\2\2\2\u0098")
        buf.write("\u0099\7\25\2\2\u0099\u009a\7\r\2\2\u009a\u009b\7\25\2")
        buf.write("\2\u009b!\3\2\2\2\u009c\u009d\7\25\2\2\u009d\u009e\7\16")
        buf.write("\2\2\u009e\u009f\7\25\2\2\u009f#\3\2\2\2\u00a0\u00a1\7")
        buf.write("\25\2\2\u00a1\u00a2\7\17\2\2\u00a2\u00a3\7\25\2\2\u00a3")
        buf.write("%\3\2\2\2\u00a4\u00a5\7\25\2\2\u00a5\u00a6\7\20\2\2\u00a6")
        buf.write("\u00a7\7\25\2\2\u00a7\'\3\2\2\2\u00a8\u00a9\7\25\2\2\u00a9")
        buf.write("\u00aa\7\21\2\2\u00aa\u00ab\7\25\2\2\u00ab)\3\2\2\2\u00ac")
        buf.write("\u00ad\7\22\2\2\u00ad\u00b1\7\33\2\2\u00ae\u00b0\5,\27")
        buf.write("\2\u00af\u00ae\3\2\2\2\u00b0\u00b3\3\2\2\2\u00b1\u00af")
        buf.write("\3\2\2\2\u00b1\u00b2\3\2\2\2\u00b2\u00b4\3\2\2\2\u00b3")
        buf.write("\u00b1\3\2\2\2\u00b4\u00b5\7\34\2\2\u00b5+\3\2\2\2\u00b6")
        buf.write("\u00b9\7\25\2\2\u00b7\u00b8\7\23\2\2\u00b8\u00ba\7\25")
        buf.write("\2\2\u00b9\u00b7\3\2\2\2\u00b9\u00ba\3\2\2\2\u00ba\u00bc")
        buf.write("\3\2\2\2\u00bb\u00bd\7\31\2\2\u00bc\u00bb\3\2\2\2\u00bc")
        buf.write("\u00bd\3\2\2\2\u00bd-\3\2\2\2\24/\63?CJNRU[gls\177\u0083")
        buf.write("\u008f\u00b1\u00b9\u00bc")
        return buf.getvalue()


class UVLParser ( Parser ):

    grammarFileName = "UVL.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ "<INVALID>", "'features'", "'.'", "'{}'", "'{'", "','", 
                     "'}'", "'\"'", "'constraints'", "'!'", "'&'", "'|'", 
                     "'=>'", "'<=>'", "'requires'", "'excludes'", "'imports'", 
                     "'as'" ]

    symbolicNames = [ "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                      "<INVALID>", "<INVALID>", "RELATION_WORD", "WORD", 
                      "BOOLEAN", "NUMBER", "VECTOR", "NL", "WS", "INDENT", 
                      "DEDENT" ]

    RULE_feature_model = 0
    RULE_features = 1
    RULE_child = 2
    RULE_relation = 3
    RULE_feature_spec = 4
    RULE_ref = 5
    RULE_attributes = 6
    RULE_attribute = 7
    RULE_key = 8
    RULE_value = 9
    RULE_relation_spec = 10
    RULE_constraints = 11
    RULE_constraint = 12
    RULE_negation = 13
    RULE_conjunction = 14
    RULE_disjuction = 15
    RULE_implication = 16
    RULE_equivalence = 17
    RULE_requires = 18
    RULE_excludes = 19
    RULE_imports = 20
    RULE_imp = 21

    ruleNames =  [ "feature_model", "features", "child", "relation", "feature_spec", 
                   "ref", "attributes", "attribute", "key", "value", "relation_spec", 
                   "constraints", "constraint", "negation", "conjunction", 
                   "disjuction", "implication", "equivalence", "requires", 
                   "excludes", "imports", "imp" ]

    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
    RELATION_WORD=18
    WORD=19
    BOOLEAN=20
    NUMBER=21
    VECTOR=22
    NL=23
    WS=24
    INDENT=25
    DEDENT=26

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




    class Feature_modelContext(ParserRuleContext):

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

        def features(self):
            return self.getTypedRuleContext(UVLParser.FeaturesContext,0)


        def imports(self):
            return self.getTypedRuleContext(UVLParser.ImportsContext,0)


        def constraints(self):
            return self.getTypedRuleContext(UVLParser.ConstraintsContext,0)


        def getRuleIndex(self):
            return UVLParser.RULE_feature_model




    def feature_model(self):

        localctx = UVLParser.Feature_modelContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_feature_model)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 45
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UVLParser.T__15:
                self.state = 44
                self.imports()


            self.state = 47
            self.features()
            self.state = 49
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UVLParser.T__7:
                self.state = 48
                self.constraints()


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


    class FeaturesContext(ParserRuleContext):

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

        def INDENT(self):
            return self.getToken(UVLParser.INDENT, 0)

        def child(self):
            return self.getTypedRuleContext(UVLParser.ChildContext,0)


        def DEDENT(self):
            return self.getToken(UVLParser.DEDENT, 0)

        def getRuleIndex(self):
            return UVLParser.RULE_features




    def features(self):

        localctx = UVLParser.FeaturesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_features)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 51
            self.match(UVLParser.T__0)
            self.state = 52
            self.match(UVLParser.INDENT)
            self.state = 53
            self.child()
            self.state = 54
            self.match(UVLParser.DEDENT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ChildContext(ParserRuleContext):

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

        def feature_spec(self):
            return self.getTypedRuleContext(UVLParser.Feature_specContext,0)


        def INDENT(self):
            return self.getToken(UVLParser.INDENT, 0)

        def DEDENT(self):
            return self.getToken(UVLParser.DEDENT, 0)

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

        def relation(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UVLParser.RelationContext)
            else:
                return self.getTypedRuleContext(UVLParser.RelationContext,i)


        def getRuleIndex(self):
            return UVLParser.RULE_child




    def child(self):

        localctx = UVLParser.ChildContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_child)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 56
            self.feature_spec()
            self.state = 65
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UVLParser.INDENT:
                self.state = 57
                self.match(UVLParser.INDENT)
                self.state = 61
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==UVLParser.RELATION_WORD:
                    self.state = 58
                    self.relation()
                    self.state = 63
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 64
                _la = self._input.LA(1)
                if not(_la==UVLParser.EOF or _la==UVLParser.DEDENT):
                    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 RelationContext(ParserRuleContext):

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

        def relation_spec(self):
            return self.getTypedRuleContext(UVLParser.Relation_specContext,0)


        def INDENT(self):
            return self.getToken(UVLParser.INDENT, 0)

        def DEDENT(self):
            return self.getToken(UVLParser.DEDENT, 0)

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

        def child(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UVLParser.ChildContext)
            else:
                return self.getTypedRuleContext(UVLParser.ChildContext,i)


        def getRuleIndex(self):
            return UVLParser.RULE_relation




    def relation(self):

        localctx = UVLParser.RelationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_relation)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 67
            self.relation_spec()
            self.state = 76
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UVLParser.INDENT:
                self.state = 68
                self.match(UVLParser.INDENT)
                self.state = 72
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==UVLParser.WORD:
                    self.state = 69
                    self.child()
                    self.state = 74
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 75
                _la = self._input.LA(1)
                if not(_la==UVLParser.EOF or _la==UVLParser.DEDENT):
                    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 Feature_specContext(ParserRuleContext):

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

        def ref(self):
            return self.getTypedRuleContext(UVLParser.RefContext,0)


        def attributes(self):
            return self.getTypedRuleContext(UVLParser.AttributesContext,0)


        def NL(self):
            return self.getToken(UVLParser.NL, 0)

        def getRuleIndex(self):
            return UVLParser.RULE_feature_spec




    def feature_spec(self):

        localctx = UVLParser.Feature_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_feature_spec)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 78
            self.ref()
            self.state = 80
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UVLParser.T__2 or _la==UVLParser.T__3:
                self.state = 79
                self.attributes()


            self.state = 83
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UVLParser.NL:
                self.state = 82
                self.match(UVLParser.NL)


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


    class RefContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return UVLParser.RULE_ref




    def ref(self):

        localctx = UVLParser.RefContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_ref)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 89
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,8,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 85
                    self.match(UVLParser.WORD)
                    self.state = 86
                    self.match(UVLParser.T__1) 
                self.state = 91
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,8,self._ctx)

            self.state = 92
            self.match(UVLParser.WORD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class AttributesContext(ParserRuleContext):

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

        def attribute(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UVLParser.AttributeContext)
            else:
                return self.getTypedRuleContext(UVLParser.AttributeContext,i)


        def getRuleIndex(self):
            return UVLParser.RULE_attributes




    def attributes(self):

        localctx = UVLParser.AttributesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_attributes)
        self._la = 0 # Token type
        try:
            self.state = 106
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [UVLParser.T__2]:
                self.enterOuterAlt(localctx, 1)
                self.state = 94
                self.match(UVLParser.T__2)
                pass
            elif token in [UVLParser.T__3]:
                self.enterOuterAlt(localctx, 2)
                self.state = 95
                self.match(UVLParser.T__3)
                self.state = 96
                self.attribute()
                self.state = 101
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==UVLParser.T__4:
                    self.state = 97
                    self.match(UVLParser.T__4)
                    self.state = 98
                    self.attribute()
                    self.state = 103
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 104
                self.match(UVLParser.T__5)
                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 AttributeContext(ParserRuleContext):

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

        def key(self):
            return self.getTypedRuleContext(UVLParser.KeyContext,0)


        def value(self):
            return self.getTypedRuleContext(UVLParser.ValueContext,0)


        def getRuleIndex(self):
            return UVLParser.RULE_attribute




    def attribute(self):

        localctx = UVLParser.AttributeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_attribute)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 108
            self.key()
            self.state = 113
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UVLParser.T__6:
                self.state = 109
                self.match(UVLParser.T__6)
                self.state = 110
                self.value()
                self.state = 111
                self.match(UVLParser.T__6)


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


    class KeyContext(ParserRuleContext):

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

        def WORD(self):
            return self.getToken(UVLParser.WORD, 0)

        def getRuleIndex(self):
            return UVLParser.RULE_key




    def key(self):

        localctx = UVLParser.KeyContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_key)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 115
            self.match(UVLParser.WORD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ValueContext(ParserRuleContext):

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

        def BOOLEAN(self):
            return self.getToken(UVLParser.BOOLEAN, 0)

        def NUMBER(self):
            return self.getToken(UVLParser.NUMBER, 0)

        def WORD(self):
            return self.getToken(UVLParser.WORD, 0)

        def VECTOR(self):
            return self.getToken(UVLParser.VECTOR, 0)

        def getRuleIndex(self):
            return UVLParser.RULE_value




    def value(self):

        localctx = UVLParser.ValueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_value)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 117
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << UVLParser.WORD) | (1 << UVLParser.BOOLEAN) | (1 << UVLParser.NUMBER) | (1 << UVLParser.VECTOR))) != 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


    class Relation_specContext(ParserRuleContext):

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

        def RELATION_WORD(self):
            return self.getToken(UVLParser.RELATION_WORD, 0)

        def getRuleIndex(self):
            return UVLParser.RULE_relation_spec




    def relation_spec(self):

        localctx = UVLParser.Relation_specContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_relation_spec)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 119
            self.match(UVLParser.RELATION_WORD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ConstraintsContext(ParserRuleContext):

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

        def INDENT(self):
            return self.getToken(UVLParser.INDENT, 0)

        def DEDENT(self):
            return self.getToken(UVLParser.DEDENT, 0)

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

        def constraint(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UVLParser.ConstraintContext)
            else:
                return self.getTypedRuleContext(UVLParser.ConstraintContext,i)


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

        def getRuleIndex(self):
            return UVLParser.RULE_constraints




    def constraints(self):

        localctx = UVLParser.ConstraintsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_constraints)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 121
            self.match(UVLParser.T__7)
            self.state = 122
            self.match(UVLParser.INDENT)
            self.state = 129
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==UVLParser.T__8 or _la==UVLParser.WORD:
                self.state = 123
                self.constraint()
                self.state = 125
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==UVLParser.NL:
                    self.state = 124
                    self.match(UVLParser.NL)


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

            self.state = 132
            _la = self._input.LA(1)
            if not(_la==UVLParser.EOF or _la==UVLParser.DEDENT):
                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 ConstraintContext(ParserRuleContext):

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

        def negation(self):
            return self.getTypedRuleContext(UVLParser.NegationContext,0)


        def conjunction(self):
            return self.getTypedRuleContext(UVLParser.ConjunctionContext,0)


        def disjuction(self):
            return self.getTypedRuleContext(UVLParser.DisjuctionContext,0)


        def implication(self):
            return self.getTypedRuleContext(UVLParser.ImplicationContext,0)


        def equivalence(self):
            return self.getTypedRuleContext(UVLParser.EquivalenceContext,0)


        def requires(self):
            return self.getTypedRuleContext(UVLParser.RequiresContext,0)


        def excludes(self):
            return self.getTypedRuleContext(UVLParser.ExcludesContext,0)


        def getRuleIndex(self):
            return UVLParser.RULE_constraint




    def constraint(self):

        localctx = UVLParser.ConstraintContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_constraint)
        try:
            self.state = 141
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,14,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 134
                self.negation()
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 135
                self.conjunction()
                pass

            elif la_ == 3:
                self.enterOuterAlt(localctx, 3)
                self.state = 136
                self.disjuction()
                pass

            elif la_ == 4:
                self.enterOuterAlt(localctx, 4)
                self.state = 137
                self.implication()
                pass

            elif la_ == 5:
                self.enterOuterAlt(localctx, 5)
                self.state = 138
                self.equivalence()
                pass

            elif la_ == 6:
                self.enterOuterAlt(localctx, 6)
                self.state = 139
                self.requires()
                pass

            elif la_ == 7:
                self.enterOuterAlt(localctx, 7)
                self.state = 140
                self.excludes()
                pass


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


    class NegationContext(ParserRuleContext):

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

        def WORD(self):
            return self.getToken(UVLParser.WORD, 0)

        def getRuleIndex(self):
            return UVLParser.RULE_negation




    def negation(self):

        localctx = UVLParser.NegationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_negation)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 143
            self.match(UVLParser.T__8)
            self.state = 144
            self.match(UVLParser.WORD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ConjunctionContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return UVLParser.RULE_conjunction




    def conjunction(self):

        localctx = UVLParser.ConjunctionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_conjunction)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 146
            self.match(UVLParser.WORD)
            self.state = 147
            self.match(UVLParser.T__9)
            self.state = 148
            self.match(UVLParser.WORD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DisjuctionContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return UVLParser.RULE_disjuction




    def disjuction(self):

        localctx = UVLParser.DisjuctionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_disjuction)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 150
            self.match(UVLParser.WORD)
            self.state = 151
            self.match(UVLParser.T__10)
            self.state = 152
            self.match(UVLParser.WORD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ImplicationContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return UVLParser.RULE_implication




    def implication(self):

        localctx = UVLParser.ImplicationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_implication)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 154
            self.match(UVLParser.WORD)
            self.state = 155
            self.match(UVLParser.T__11)
            self.state = 156
            self.match(UVLParser.WORD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class EquivalenceContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return UVLParser.RULE_equivalence




    def equivalence(self):

        localctx = UVLParser.EquivalenceContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_equivalence)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 158
            self.match(UVLParser.WORD)
            self.state = 159
            self.match(UVLParser.T__12)
            self.state = 160
            self.match(UVLParser.WORD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class RequiresContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return UVLParser.RULE_requires




    def requires(self):

        localctx = UVLParser.RequiresContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_requires)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 162
            self.match(UVLParser.WORD)
            self.state = 163
            self.match(UVLParser.T__13)
            self.state = 164
            self.match(UVLParser.WORD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ExcludesContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return UVLParser.RULE_excludes




    def excludes(self):

        localctx = UVLParser.ExcludesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_excludes)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 166
            self.match(UVLParser.WORD)
            self.state = 167
            self.match(UVLParser.T__14)
            self.state = 168
            self.match(UVLParser.WORD)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ImportsContext(ParserRuleContext):

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

        def INDENT(self):
            return self.getToken(UVLParser.INDENT, 0)

        def DEDENT(self):
            return self.getToken(UVLParser.DEDENT, 0)

        def imp(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(UVLParser.ImpContext)
            else:
                return self.getTypedRuleContext(UVLParser.ImpContext,i)


        def getRuleIndex(self):
            return UVLParser.RULE_imports




    def imports(self):

        localctx = UVLParser.ImportsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_imports)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 170
            self.match(UVLParser.T__15)
            self.state = 171
            self.match(UVLParser.INDENT)
            self.state = 175
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==UVLParser.WORD:
                self.state = 172
                self.imp()
                self.state = 177
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 178
            self.match(UVLParser.DEDENT)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ImpContext(ParserRuleContext):

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

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

        def NL(self):
            return self.getToken(UVLParser.NL, 0)

        def getRuleIndex(self):
            return UVLParser.RULE_imp




    def imp(self):

        localctx = UVLParser.ImpContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_imp)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 180
            self.match(UVLParser.WORD)
            self.state = 183
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UVLParser.T__16:
                self.state = 181
                self.match(UVLParser.T__16)
                self.state = 182
                self.match(UVLParser.WORD)


            self.state = 186
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==UVLParser.NL:
                self.state = 185
                self.match(UVLParser.NL)


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





