# Generated from STIXPattern.g4 by ANTLR 4.7.1
# encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys

def serializedATN():
    with StringIO() as buf:
        buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\67")
        buf.write("\u00f9\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\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3")
        buf.write("\3\7\3\64\n\3\f\3\16\3\67\13\3\3\4\3\4\3\4\3\4\3\4\3\4")
        buf.write("\7\4?\n\4\f\4\16\4B\13\4\3\5\3\5\3\5\3\5\3\5\3\5\7\5J")
        buf.write("\n\5\f\5\16\5M\13\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3")
        buf.write("\6\5\6X\n\6\3\6\3\6\3\6\3\6\3\6\3\6\7\6`\n\6\f\6\16\6")
        buf.write("c\13\6\3\7\3\7\3\7\3\7\3\7\3\7\7\7k\n\7\f\7\16\7n\13\7")
        buf.write("\3\b\3\b\3\b\3\b\3\b\3\b\7\bv\n\b\f\b\16\by\13\b\3\t\3")
        buf.write("\t\5\t}\n\t\3\t\3\t\3\t\3\t\3\t\5\t\u0084\n\t\3\t\3\t")
        buf.write("\3\t\3\t\3\t\5\t\u008b\n\t\3\t\3\t\3\t\3\t\3\t\5\t\u0092")
        buf.write("\n\t\3\t\3\t\3\t\3\t\3\t\5\t\u0099\n\t\3\t\3\t\3\t\3\t")
        buf.write("\3\t\5\t\u00a0\n\t\3\t\3\t\3\t\3\t\3\t\5\t\u00a7\n\t\3")
        buf.write("\t\3\t\3\t\3\t\3\t\3\t\3\t\5\t\u00b0\n\t\3\n\3\n\3\13")
        buf.write("\3\13\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\16\3\16\3")
        buf.write("\16\3\16\3\17\3\17\3\17\3\17\5\17\u00c7\n\17\3\20\3\20")
        buf.write("\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3\22\5\22\u00d3\n")
        buf.write("\22\3\22\3\22\7\22\u00d7\n\22\f\22\16\22\u00da\13\22\3")
        buf.write("\23\3\23\3\23\3\23\3\23\3\23\7\23\u00e2\n\23\f\23\16\23")
        buf.write("\u00e5\13\23\3\23\3\23\5\23\u00e9\n\23\3\24\3\24\5\24")
        buf.write("\u00ed\n\24\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\5")
        buf.write("\25\u00f7\n\25\3\25\2\t\4\6\b\n\f\16\"\26\2\4\6\b\n\f")
        buf.write("\16\20\22\24\26\30\32\34\36 \"$&(\2\b\3\2 !\3\2\"%\4\2")
        buf.write("\4\4\6\6\3\2\36\37\4\2\t\t\36\36\4\2\3\4\63\63\2\u0108")
        buf.write("\2*\3\2\2\2\4-\3\2\2\2\68\3\2\2\2\bC\3\2\2\2\nW\3\2\2")
        buf.write("\2\fd\3\2\2\2\16o\3\2\2\2\20\u00af\3\2\2\2\22\u00b1\3")
        buf.write("\2\2\2\24\u00b3\3\2\2\2\26\u00b5\3\2\2\2\30\u00ba\3\2")
        buf.write("\2\2\32\u00be\3\2\2\2\34\u00c2\3\2\2\2\36\u00c8\3\2\2")
        buf.write("\2 \u00ca\3\2\2\2\"\u00d2\3\2\2\2$\u00e8\3\2\2\2&\u00ec")
        buf.write("\3\2\2\2(\u00f6\3\2\2\2*+\5\4\3\2+,\7\2\2\3,\3\3\2\2\2")
        buf.write("-.\b\3\1\2./\5\6\4\2/\65\3\2\2\2\60\61\f\4\2\2\61\62\7")
        buf.write("\17\2\2\62\64\5\4\3\5\63\60\3\2\2\2\64\67\3\2\2\2\65\63")
        buf.write("\3\2\2\2\65\66\3\2\2\2\66\5\3\2\2\2\67\65\3\2\2\289\b")
        buf.write("\4\1\29:\5\b\5\2:@\3\2\2\2;<\f\4\2\2<=\7\r\2\2=?\5\6\4")
        buf.write("\5>;\3\2\2\2?B\3\2\2\2@>\3\2\2\2@A\3\2\2\2A\7\3\2\2\2")
        buf.write("B@\3\2\2\2CD\b\5\1\2DE\5\n\6\2EK\3\2\2\2FG\f\4\2\2GH\7")
        buf.write("\f\2\2HJ\5\b\5\5IF\3\2\2\2JM\3\2\2\2KI\3\2\2\2KL\3\2\2")
        buf.write("\2L\t\3\2\2\2MK\3\2\2\2NO\b\6\1\2OP\7-\2\2PQ\5\f\7\2Q")
        buf.write("R\7,\2\2RX\3\2\2\2ST\7+\2\2TU\5\4\3\2UV\7*\2\2VX\3\2\2")
        buf.write("\2WN\3\2\2\2WS\3\2\2\2Xa\3\2\2\2YZ\f\5\2\2Z`\5\26\f\2")
        buf.write("[\\\f\4\2\2\\`\5\30\r\2]^\f\3\2\2^`\5\32\16\2_Y\3\2\2")
        buf.write("\2_[\3\2\2\2_]\3\2\2\2`c\3\2\2\2a_\3\2\2\2ab\3\2\2\2b")
        buf.write("\13\3\2\2\2ca\3\2\2\2de\b\7\1\2ef\5\16\b\2fl\3\2\2\2g")
        buf.write("h\f\4\2\2hi\7\r\2\2ik\5\f\7\5jg\3\2\2\2kn\3\2\2\2lj\3")
        buf.write("\2\2\2lm\3\2\2\2m\r\3\2\2\2nl\3\2\2\2op\b\b\1\2pq\5\20")
        buf.write("\t\2qw\3\2\2\2rs\f\4\2\2st\7\f\2\2tv\5\16\b\5ur\3\2\2")
        buf.write("\2vy\3\2\2\2wu\3\2\2\2wx\3\2\2\2x\17\3\2\2\2yw\3\2\2\2")
        buf.write("z|\5\34\17\2{}\7\16\2\2|{\3\2\2\2|}\3\2\2\2}~\3\2\2\2")
        buf.write("~\177\t\2\2\2\177\u0080\5&\24\2\u0080\u00b0\3\2\2\2\u0081")
        buf.write("\u0083\5\34\17\2\u0082\u0084\7\16\2\2\u0083\u0082\3\2")
        buf.write("\2\2\u0083\u0084\3\2\2\2\u0084\u0085\3\2\2\2\u0085\u0086")
        buf.write("\t\3\2\2\u0086\u0087\5(\25\2\u0087\u00b0\3\2\2\2\u0088")
        buf.write("\u008a\5\34\17\2\u0089\u008b\7\16\2\2\u008a\u0089\3\2")
        buf.write("\2\2\u008a\u008b\3\2\2\2\u008b\u008c\3\2\2\2\u008c\u008d")
        buf.write("\7\25\2\2\u008d\u008e\5$\23\2\u008e\u00b0\3\2\2\2\u008f")
        buf.write("\u0091\5\34\17\2\u0090\u0092\7\16\2\2\u0091\u0090\3\2")
        buf.write("\2\2\u0091\u0092\3\2\2\2\u0092\u0093\3\2\2\2\u0093\u0094")
        buf.write("\7\20\2\2\u0094\u0095\5\24\13\2\u0095\u00b0\3\2\2\2\u0096")
        buf.write("\u0098\5\34\17\2\u0097\u0099\7\16\2\2\u0098\u0097\3\2")
        buf.write("\2\2\u0098\u0099\3\2\2\2\u0099\u009a\3\2\2\2\u009a\u009b")
        buf.write("\7\21\2\2\u009b\u009c\5\24\13\2\u009c\u00b0\3\2\2\2\u009d")
        buf.write("\u009f\5\34\17\2\u009e\u00a0\7\16\2\2\u009f\u009e\3\2")
        buf.write("\2\2\u009f\u00a0\3\2\2\2\u00a0\u00a1\3\2\2\2\u00a1\u00a2")
        buf.write("\7\23\2\2\u00a2\u00a3\5\24\13\2\u00a3\u00b0\3\2\2\2\u00a4")
        buf.write("\u00a6\5\34\17\2\u00a5\u00a7\7\16\2\2\u00a6\u00a5\3\2")
        buf.write("\2\2\u00a6\u00a7\3\2\2\2\u00a7\u00a8\3\2\2\2\u00a8\u00a9")
        buf.write("\7\22\2\2\u00a9\u00aa\5\24\13\2\u00aa\u00b0\3\2\2\2\u00ab")
        buf.write("\u00ac\7+\2\2\u00ac\u00ad\5\f\7\2\u00ad\u00ae\7*\2\2\u00ae")
        buf.write("\u00b0\3\2\2\2\u00afz\3\2\2\2\u00af\u0081\3\2\2\2\u00af")
        buf.write("\u0088\3\2\2\2\u00af\u008f\3\2\2\2\u00af\u0096\3\2\2\2")
        buf.write("\u00af\u009d\3\2\2\2\u00af\u00a4\3\2\2\2\u00af\u00ab\3")
        buf.write("\2\2\2\u00b0\21\3\2\2\2\u00b1\u00b2\t\3\2\2\u00b2\23\3")
        buf.write("\2\2\2\u00b3\u00b4\7\t\2\2\u00b4\25\3\2\2\2\u00b5\u00b6")
        buf.write("\7\26\2\2\u00b6\u00b7\7\13\2\2\u00b7\u00b8\7\27\2\2\u00b8")
        buf.write("\u00b9\7\13\2\2\u00b9\27\3\2\2\2\u00ba\u00bb\7\33\2\2")
        buf.write("\u00bb\u00bc\t\4\2\2\u00bc\u00bd\7\30\2\2\u00bd\31\3\2")
        buf.write("\2\2\u00be\u00bf\7\34\2\2\u00bf\u00c0\7\4\2\2\u00c0\u00c1")
        buf.write("\7\35\2\2\u00c1\33\3\2\2\2\u00c2\u00c3\5\36\20\2\u00c3")
        buf.write("\u00c4\7\'\2\2\u00c4\u00c6\5 \21\2\u00c5\u00c7\5\"\22")
        buf.write("\2\u00c6\u00c5\3\2\2\2\u00c6\u00c7\3\2\2\2\u00c7\35\3")
        buf.write("\2\2\2\u00c8\u00c9\t\5\2\2\u00c9\37\3\2\2\2\u00ca\u00cb")
        buf.write("\t\6\2\2\u00cb!\3\2\2\2\u00cc\u00cd\b\22\1\2\u00cd\u00ce")
        buf.write("\7(\2\2\u00ce\u00d3\t\6\2\2\u00cf\u00d0\7-\2\2\u00d0\u00d1")
        buf.write("\t\7\2\2\u00d1\u00d3\7,\2\2\u00d2\u00cc\3\2\2\2\u00d2")
        buf.write("\u00cf\3\2\2\2\u00d3\u00d8\3\2\2\2\u00d4\u00d5\f\5\2\2")
        buf.write("\u00d5\u00d7\5\"\22\6\u00d6\u00d4\3\2\2\2\u00d7\u00da")
        buf.write("\3\2\2\2\u00d8\u00d6\3\2\2\2\u00d8\u00d9\3\2\2\2\u00d9")
        buf.write("#\3\2\2\2\u00da\u00d8\3\2\2\2\u00db\u00dc\7+\2\2\u00dc")
        buf.write("\u00e9\7*\2\2\u00dd\u00de\7+\2\2\u00de\u00e3\5&\24\2\u00df")
        buf.write("\u00e0\7)\2\2\u00e0\u00e2\5&\24\2\u00e1\u00df\3\2\2\2")
        buf.write("\u00e2\u00e5\3\2\2\2\u00e3\u00e1\3\2\2\2\u00e3\u00e4\3")
        buf.write("\2\2\2\u00e4\u00e6\3\2\2\2\u00e5\u00e3\3\2\2\2\u00e6\u00e7")
        buf.write("\7*\2\2\u00e7\u00e9\3\2\2\2\u00e8\u00db\3\2\2\2\u00e8")
        buf.write("\u00dd\3\2\2\2\u00e9%\3\2\2\2\u00ea\u00ed\5(\25\2\u00eb")
        buf.write("\u00ed\7\n\2\2\u00ec\u00ea\3\2\2\2\u00ec\u00eb\3\2\2\2")
        buf.write("\u00ed\'\3\2\2\2\u00ee\u00f7\7\4\2\2\u00ef\u00f7\7\3\2")
        buf.write("\2\u00f0\u00f7\7\6\2\2\u00f1\u00f7\7\5\2\2\u00f2\u00f7")
        buf.write("\5\24\13\2\u00f3\u00f7\7\b\2\2\u00f4\u00f7\7\7\2\2\u00f5")
        buf.write("\u00f7\7\13\2\2\u00f6\u00ee\3\2\2\2\u00f6\u00ef\3\2\2")
        buf.write("\2\u00f6\u00f0\3\2\2\2\u00f6\u00f1\3\2\2\2\u00f6\u00f2")
        buf.write("\3\2\2\2\u00f6\u00f3\3\2\2\2\u00f6\u00f4\3\2\2\2\u00f6")
        buf.write("\u00f5\3\2\2\2\u00f7)\3\2\2\2\31\65@KW_alw|\u0083\u008a")
        buf.write("\u0091\u0098\u009f\u00a6\u00af\u00c6\u00d2\u00d8\u00e3")
        buf.write("\u00e8\u00ec\u00f6")
        return buf.getvalue()


class STIXPatternParser ( Parser ):

    grammarFileName = "STIXPattern.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>", "'AND'", "'OR'", "'NOT'", 
                     "'FOLLOWEDBY'", "'LIKE'", "'MATCHES'", "'ISSUPERSET'", 
                     "'ISSUBSET'", "'LAST'", "'IN'", "'START'", "'STOP'", 
                     "'SECONDS'", "'true'", "'false'", "'WITHIN'", "'REPEATS'", 
                     "'TIMES'", "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>", 
                     "'<'", "'<='", "'>'", "'>='", "'''", "':'", "'.'", 
                     "','", "')'", "'('", "']'", "'['", "'+'", "<INVALID>", 
                     "'-'", "'^'", "'/'", "'*'" ]

    symbolicNames = [ "<INVALID>", "IntNegLiteral", "IntPosLiteral", "FloatNegLiteral", 
                      "FloatPosLiteral", "HexLiteral", "BinaryLiteral", 
                      "StringLiteral", "BoolLiteral", "TimestampLiteral", 
                      "AND", "OR", "NOT", "FOLLOWEDBY", "LIKE", "MATCHES", 
                      "ISSUPERSET", "ISSUBSET", "LAST", "IN", "START", "STOP", 
                      "SECONDS", "TRUE", "FALSE", "WITHIN", "REPEATS", "TIMES", 
                      "IdentifierWithoutHyphen", "IdentifierWithHyphen", 
                      "EQ", "NEQ", "LT", "LE", "GT", "GE", "QUOTE", "COLON", 
                      "DOT", "COMMA", "RPAREN", "LPAREN", "RBRACK", "LBRACK", 
                      "PLUS", "HYPHEN", "MINUS", "POWER_OP", "DIVIDE", "ASTERISK", 
                      "WS", "COMMENT", "LINE_COMMENT", "InvalidCharacter" ]

    RULE_pattern = 0
    RULE_observationExpressions = 1
    RULE_observationExpressionOr = 2
    RULE_observationExpressionAnd = 3
    RULE_observationExpression = 4
    RULE_comparisonExpression = 5
    RULE_comparisonExpressionAnd = 6
    RULE_propTest = 7
    RULE_orderingComparator = 8
    RULE_stringLiteral = 9
    RULE_startStopQualifier = 10
    RULE_withinQualifier = 11
    RULE_repeatedQualifier = 12
    RULE_objectPath = 13
    RULE_objectType = 14
    RULE_firstPathComponent = 15
    RULE_objectPathComponent = 16
    RULE_setLiteral = 17
    RULE_primitiveLiteral = 18
    RULE_orderableLiteral = 19

    ruleNames =  [ "pattern", "observationExpressions", "observationExpressionOr", 
                   "observationExpressionAnd", "observationExpression", 
                   "comparisonExpression", "comparisonExpressionAnd", "propTest", 
                   "orderingComparator", "stringLiteral", "startStopQualifier", 
                   "withinQualifier", "repeatedQualifier", "objectPath", 
                   "objectType", "firstPathComponent", "objectPathComponent", 
                   "setLiteral", "primitiveLiteral", "orderableLiteral" ]

    EOF = Token.EOF
    IntNegLiteral=1
    IntPosLiteral=2
    FloatNegLiteral=3
    FloatPosLiteral=4
    HexLiteral=5
    BinaryLiteral=6
    StringLiteral=7
    BoolLiteral=8
    TimestampLiteral=9
    AND=10
    OR=11
    NOT=12
    FOLLOWEDBY=13
    LIKE=14
    MATCHES=15
    ISSUPERSET=16
    ISSUBSET=17
    LAST=18
    IN=19
    START=20
    STOP=21
    SECONDS=22
    TRUE=23
    FALSE=24
    WITHIN=25
    REPEATS=26
    TIMES=27
    IdentifierWithoutHyphen=28
    IdentifierWithHyphen=29
    EQ=30
    NEQ=31
    LT=32
    LE=33
    GT=34
    GE=35
    QUOTE=36
    COLON=37
    DOT=38
    COMMA=39
    RPAREN=40
    LPAREN=41
    RBRACK=42
    LBRACK=43
    PLUS=44
    HYPHEN=45
    MINUS=46
    POWER_OP=47
    DIVIDE=48
    ASTERISK=49
    WS=50
    COMMENT=51
    LINE_COMMENT=52
    InvalidCharacter=53

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



    class PatternContext(ParserRuleContext):

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

        def observationExpressions(self):
            return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionsContext,0)


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

        def getRuleIndex(self):
            return STIXPatternParser.RULE_pattern

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

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

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




    def pattern(self):

        localctx = STIXPatternParser.PatternContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_pattern)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 40
            self.observationExpressions(0)
            self.state = 41
            self.match(STIXPatternParser.EOF)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ObservationExpressionsContext(ParserRuleContext):

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

        def observationExpressionOr(self):
            return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionOrContext,0)


        def observationExpressions(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(STIXPatternParser.ObservationExpressionsContext)
            else:
                return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionsContext,i)


        def FOLLOWEDBY(self):
            return self.getToken(STIXPatternParser.FOLLOWEDBY, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_observationExpressions

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

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

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



    def observationExpressions(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = STIXPatternParser.ObservationExpressionsContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 2
        self.enterRecursionRule(localctx, 2, self.RULE_observationExpressions, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 44
            self.observationExpressionOr(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 51
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,0,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = STIXPatternParser.ObservationExpressionsContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_observationExpressions)
                    self.state = 46
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 47
                    self.match(STIXPatternParser.FOLLOWEDBY)
                    self.state = 48
                    self.observationExpressions(3) 
                self.state = 53
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,0,self._ctx)

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

    class ObservationExpressionOrContext(ParserRuleContext):

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

        def observationExpressionAnd(self):
            return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionAndContext,0)


        def observationExpressionOr(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(STIXPatternParser.ObservationExpressionOrContext)
            else:
                return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionOrContext,i)


        def OR(self):
            return self.getToken(STIXPatternParser.OR, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_observationExpressionOr

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

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

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



    def observationExpressionOr(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = STIXPatternParser.ObservationExpressionOrContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 4
        self.enterRecursionRule(localctx, 4, self.RULE_observationExpressionOr, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 55
            self.observationExpressionAnd(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 62
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,1,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = STIXPatternParser.ObservationExpressionOrContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_observationExpressionOr)
                    self.state = 57
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 58
                    self.match(STIXPatternParser.OR)
                    self.state = 59
                    self.observationExpressionOr(3) 
                self.state = 64
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,1,self._ctx)

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

    class ObservationExpressionAndContext(ParserRuleContext):

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

        def observationExpression(self):
            return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionContext,0)


        def observationExpressionAnd(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(STIXPatternParser.ObservationExpressionAndContext)
            else:
                return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionAndContext,i)


        def AND(self):
            return self.getToken(STIXPatternParser.AND, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_observationExpressionAnd

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

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

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



    def observationExpressionAnd(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = STIXPatternParser.ObservationExpressionAndContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 6
        self.enterRecursionRule(localctx, 6, self.RULE_observationExpressionAnd, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 66
            self.observationExpression(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 73
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,2,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = STIXPatternParser.ObservationExpressionAndContext(self, _parentctx, _parentState)
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_observationExpressionAnd)
                    self.state = 68
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 69
                    self.match(STIXPatternParser.AND)
                    self.state = 70
                    self.observationExpressionAnd(3) 
                self.state = 75
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,2,self._ctx)

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

    class ObservationExpressionContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return STIXPatternParser.RULE_observationExpression

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


    class ObservationExpressionRepeatedContext(ObservationExpressionContext):

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

        def observationExpression(self):
            return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionContext,0)

        def repeatedQualifier(self):
            return self.getTypedRuleContext(STIXPatternParser.RepeatedQualifierContext,0)


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

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

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


    class ObservationExpressionSimpleContext(ObservationExpressionContext):

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

        def LBRACK(self):
            return self.getToken(STIXPatternParser.LBRACK, 0)
        def comparisonExpression(self):
            return self.getTypedRuleContext(STIXPatternParser.ComparisonExpressionContext,0)

        def RBRACK(self):
            return self.getToken(STIXPatternParser.RBRACK, 0)

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

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

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


    class ObservationExpressionCompoundContext(ObservationExpressionContext):

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

        def LPAREN(self):
            return self.getToken(STIXPatternParser.LPAREN, 0)
        def observationExpressions(self):
            return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionsContext,0)

        def RPAREN(self):
            return self.getToken(STIXPatternParser.RPAREN, 0)

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

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

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


    class ObservationExpressionWithinContext(ObservationExpressionContext):

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

        def observationExpression(self):
            return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionContext,0)

        def withinQualifier(self):
            return self.getTypedRuleContext(STIXPatternParser.WithinQualifierContext,0)


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

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

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


    class ObservationExpressionStartStopContext(ObservationExpressionContext):

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

        def observationExpression(self):
            return self.getTypedRuleContext(STIXPatternParser.ObservationExpressionContext,0)

        def startStopQualifier(self):
            return self.getTypedRuleContext(STIXPatternParser.StartStopQualifierContext,0)


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

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

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



    def observationExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = STIXPatternParser.ObservationExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 8
        self.enterRecursionRule(localctx, 8, self.RULE_observationExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 85
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [STIXPatternParser.LBRACK]:
                localctx = STIXPatternParser.ObservationExpressionSimpleContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 77
                self.match(STIXPatternParser.LBRACK)
                self.state = 78
                self.comparisonExpression(0)
                self.state = 79
                self.match(STIXPatternParser.RBRACK)
                pass
            elif token in [STIXPatternParser.LPAREN]:
                localctx = STIXPatternParser.ObservationExpressionCompoundContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 81
                self.match(STIXPatternParser.LPAREN)
                self.state = 82
                self.observationExpressions(0)
                self.state = 83
                self.match(STIXPatternParser.RPAREN)
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 95
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,5,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    self.state = 93
                    self._errHandler.sync(self)
                    la_ = self._interp.adaptivePredict(self._input,4,self._ctx)
                    if la_ == 1:
                        localctx = STIXPatternParser.ObservationExpressionStartStopContext(self, STIXPatternParser.ObservationExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_observationExpression)
                        self.state = 87
                        if not self.precpred(self._ctx, 3):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                        self.state = 88
                        self.startStopQualifier()
                        pass

                    elif la_ == 2:
                        localctx = STIXPatternParser.ObservationExpressionWithinContext(self, STIXPatternParser.ObservationExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_observationExpression)
                        self.state = 89
                        if not self.precpred(self._ctx, 2):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                        self.state = 90
                        self.withinQualifier()
                        pass

                    elif la_ == 3:
                        localctx = STIXPatternParser.ObservationExpressionRepeatedContext(self, STIXPatternParser.ObservationExpressionContext(self, _parentctx, _parentState))
                        self.pushNewRecursionContext(localctx, _startState, self.RULE_observationExpression)
                        self.state = 91
                        if not self.precpred(self._ctx, 1):
                            from antlr4.error.Errors import FailedPredicateException
                            raise FailedPredicateException(self, "self.precpred(self._ctx, 1)")
                        self.state = 92
                        self.repeatedQualifier()
                        pass

             
                self.state = 97
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,5,self._ctx)

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

    class ComparisonExpressionContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return STIXPatternParser.RULE_comparisonExpression

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


    class ComparisonExpressionAnd_Context(ComparisonExpressionContext):

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

        def comparisonExpressionAnd(self):
            return self.getTypedRuleContext(STIXPatternParser.ComparisonExpressionAndContext,0)


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

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

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


    class ComparisonExpressionOredContext(ComparisonExpressionContext):

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

        def comparisonExpression(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(STIXPatternParser.ComparisonExpressionContext)
            else:
                return self.getTypedRuleContext(STIXPatternParser.ComparisonExpressionContext,i)

        def OR(self):
            return self.getToken(STIXPatternParser.OR, 0)

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

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

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



    def comparisonExpression(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = STIXPatternParser.ComparisonExpressionContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 10
        self.enterRecursionRule(localctx, 10, self.RULE_comparisonExpression, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = STIXPatternParser.ComparisonExpressionAnd_Context(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 99
            self.comparisonExpressionAnd(0)
            self._ctx.stop = self._input.LT(-1)
            self.state = 106
            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:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = STIXPatternParser.ComparisonExpressionOredContext(self, STIXPatternParser.ComparisonExpressionContext(self, _parentctx, _parentState))
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_comparisonExpression)
                    self.state = 101
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 102
                    self.match(STIXPatternParser.OR)
                    self.state = 103
                    self.comparisonExpression(3) 
                self.state = 108
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,6,self._ctx)

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

    class ComparisonExpressionAndContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return STIXPatternParser.RULE_comparisonExpressionAnd

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


    class ComparisonExpressionAndPropTestContext(ComparisonExpressionAndContext):

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

        def propTest(self):
            return self.getTypedRuleContext(STIXPatternParser.PropTestContext,0)


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

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

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


    class ComparisonExpressionAndedContext(ComparisonExpressionAndContext):

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

        def comparisonExpressionAnd(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(STIXPatternParser.ComparisonExpressionAndContext)
            else:
                return self.getTypedRuleContext(STIXPatternParser.ComparisonExpressionAndContext,i)

        def AND(self):
            return self.getToken(STIXPatternParser.AND, 0)

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

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

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



    def comparisonExpressionAnd(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = STIXPatternParser.ComparisonExpressionAndContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 12
        self.enterRecursionRule(localctx, 12, self.RULE_comparisonExpressionAnd, _p)
        try:
            self.enterOuterAlt(localctx, 1)
            localctx = STIXPatternParser.ComparisonExpressionAndPropTestContext(self, localctx)
            self._ctx = localctx
            _prevctx = localctx

            self.state = 110
            self.propTest()
            self._ctx.stop = self._input.LT(-1)
            self.state = 117
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,7,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = STIXPatternParser.ComparisonExpressionAndedContext(self, STIXPatternParser.ComparisonExpressionAndContext(self, _parentctx, _parentState))
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_comparisonExpressionAnd)
                    self.state = 112
                    if not self.precpred(self._ctx, 2):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 2)")
                    self.state = 113
                    self.match(STIXPatternParser.AND)
                    self.state = 114
                    self.comparisonExpressionAnd(3) 
                self.state = 119
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,7,self._ctx)

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

    class PropTestContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return STIXPatternParser.RULE_propTest

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



    class PropTestRegexContext(PropTestContext):

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

        def objectPath(self):
            return self.getTypedRuleContext(STIXPatternParser.ObjectPathContext,0)

        def MATCHES(self):
            return self.getToken(STIXPatternParser.MATCHES, 0)
        def stringLiteral(self):
            return self.getTypedRuleContext(STIXPatternParser.StringLiteralContext,0)

        def NOT(self):
            return self.getToken(STIXPatternParser.NOT, 0)

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

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

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


    class PropTestOrderContext(PropTestContext):

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

        def objectPath(self):
            return self.getTypedRuleContext(STIXPatternParser.ObjectPathContext,0)

        def orderableLiteral(self):
            return self.getTypedRuleContext(STIXPatternParser.OrderableLiteralContext,0)

        def GT(self):
            return self.getToken(STIXPatternParser.GT, 0)
        def LT(self):
            return self.getToken(STIXPatternParser.LT, 0)
        def GE(self):
            return self.getToken(STIXPatternParser.GE, 0)
        def LE(self):
            return self.getToken(STIXPatternParser.LE, 0)
        def NOT(self):
            return self.getToken(STIXPatternParser.NOT, 0)

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

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

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


    class PropTestLikeContext(PropTestContext):

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

        def objectPath(self):
            return self.getTypedRuleContext(STIXPatternParser.ObjectPathContext,0)

        def LIKE(self):
            return self.getToken(STIXPatternParser.LIKE, 0)
        def stringLiteral(self):
            return self.getTypedRuleContext(STIXPatternParser.StringLiteralContext,0)

        def NOT(self):
            return self.getToken(STIXPatternParser.NOT, 0)

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

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

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


    class PropTestEqualContext(PropTestContext):

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

        def objectPath(self):
            return self.getTypedRuleContext(STIXPatternParser.ObjectPathContext,0)

        def primitiveLiteral(self):
            return self.getTypedRuleContext(STIXPatternParser.PrimitiveLiteralContext,0)

        def EQ(self):
            return self.getToken(STIXPatternParser.EQ, 0)
        def NEQ(self):
            return self.getToken(STIXPatternParser.NEQ, 0)
        def NOT(self):
            return self.getToken(STIXPatternParser.NOT, 0)

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

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

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


    class PropTestSetContext(PropTestContext):

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

        def objectPath(self):
            return self.getTypedRuleContext(STIXPatternParser.ObjectPathContext,0)

        def IN(self):
            return self.getToken(STIXPatternParser.IN, 0)
        def setLiteral(self):
            return self.getTypedRuleContext(STIXPatternParser.SetLiteralContext,0)

        def NOT(self):
            return self.getToken(STIXPatternParser.NOT, 0)

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

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

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


    class PropTestIsSubsetContext(PropTestContext):

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

        def objectPath(self):
            return self.getTypedRuleContext(STIXPatternParser.ObjectPathContext,0)

        def ISSUBSET(self):
            return self.getToken(STIXPatternParser.ISSUBSET, 0)
        def stringLiteral(self):
            return self.getTypedRuleContext(STIXPatternParser.StringLiteralContext,0)

        def NOT(self):
            return self.getToken(STIXPatternParser.NOT, 0)

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

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

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


    class PropTestParenContext(PropTestContext):

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

        def LPAREN(self):
            return self.getToken(STIXPatternParser.LPAREN, 0)
        def comparisonExpression(self):
            return self.getTypedRuleContext(STIXPatternParser.ComparisonExpressionContext,0)

        def RPAREN(self):
            return self.getToken(STIXPatternParser.RPAREN, 0)

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

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

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


    class PropTestIsSupersetContext(PropTestContext):

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

        def objectPath(self):
            return self.getTypedRuleContext(STIXPatternParser.ObjectPathContext,0)

        def ISSUPERSET(self):
            return self.getToken(STIXPatternParser.ISSUPERSET, 0)
        def stringLiteral(self):
            return self.getTypedRuleContext(STIXPatternParser.StringLiteralContext,0)

        def NOT(self):
            return self.getToken(STIXPatternParser.NOT, 0)

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

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

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



    def propTest(self):

        localctx = STIXPatternParser.PropTestContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_propTest)
        self._la = 0 # Token type
        try:
            self.state = 173
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,15,self._ctx)
            if la_ == 1:
                localctx = STIXPatternParser.PropTestEqualContext(self, localctx)
                self.enterOuterAlt(localctx, 1)
                self.state = 120
                self.objectPath()
                self.state = 122
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==STIXPatternParser.NOT:
                    self.state = 121
                    self.match(STIXPatternParser.NOT)


                self.state = 124
                _la = self._input.LA(1)
                if not(_la==STIXPatternParser.EQ or _la==STIXPatternParser.NEQ):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 125
                self.primitiveLiteral()
                pass

            elif la_ == 2:
                localctx = STIXPatternParser.PropTestOrderContext(self, localctx)
                self.enterOuterAlt(localctx, 2)
                self.state = 127
                self.objectPath()
                self.state = 129
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==STIXPatternParser.NOT:
                    self.state = 128
                    self.match(STIXPatternParser.NOT)


                self.state = 131
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << STIXPatternParser.LT) | (1 << STIXPatternParser.LE) | (1 << STIXPatternParser.GT) | (1 << STIXPatternParser.GE))) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 132
                self.orderableLiteral()
                pass

            elif la_ == 3:
                localctx = STIXPatternParser.PropTestSetContext(self, localctx)
                self.enterOuterAlt(localctx, 3)
                self.state = 134
                self.objectPath()
                self.state = 136
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==STIXPatternParser.NOT:
                    self.state = 135
                    self.match(STIXPatternParser.NOT)


                self.state = 138
                self.match(STIXPatternParser.IN)
                self.state = 139
                self.setLiteral()
                pass

            elif la_ == 4:
                localctx = STIXPatternParser.PropTestLikeContext(self, localctx)
                self.enterOuterAlt(localctx, 4)
                self.state = 141
                self.objectPath()
                self.state = 143
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==STIXPatternParser.NOT:
                    self.state = 142
                    self.match(STIXPatternParser.NOT)


                self.state = 145
                self.match(STIXPatternParser.LIKE)
                self.state = 146
                self.stringLiteral()
                pass

            elif la_ == 5:
                localctx = STIXPatternParser.PropTestRegexContext(self, localctx)
                self.enterOuterAlt(localctx, 5)
                self.state = 148
                self.objectPath()
                self.state = 150
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==STIXPatternParser.NOT:
                    self.state = 149
                    self.match(STIXPatternParser.NOT)


                self.state = 152
                self.match(STIXPatternParser.MATCHES)
                self.state = 153
                self.stringLiteral()
                pass

            elif la_ == 6:
                localctx = STIXPatternParser.PropTestIsSubsetContext(self, localctx)
                self.enterOuterAlt(localctx, 6)
                self.state = 155
                self.objectPath()
                self.state = 157
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==STIXPatternParser.NOT:
                    self.state = 156
                    self.match(STIXPatternParser.NOT)


                self.state = 159
                self.match(STIXPatternParser.ISSUBSET)
                self.state = 160
                self.stringLiteral()
                pass

            elif la_ == 7:
                localctx = STIXPatternParser.PropTestIsSupersetContext(self, localctx)
                self.enterOuterAlt(localctx, 7)
                self.state = 162
                self.objectPath()
                self.state = 164
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if _la==STIXPatternParser.NOT:
                    self.state = 163
                    self.match(STIXPatternParser.NOT)


                self.state = 166
                self.match(STIXPatternParser.ISSUPERSET)
                self.state = 167
                self.stringLiteral()
                pass

            elif la_ == 8:
                localctx = STIXPatternParser.PropTestParenContext(self, localctx)
                self.enterOuterAlt(localctx, 8)
                self.state = 169
                self.match(STIXPatternParser.LPAREN)
                self.state = 170
                self.comparisonExpression(0)
                self.state = 171
                self.match(STIXPatternParser.RPAREN)
                pass


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

    class OrderingComparatorContext(ParserRuleContext):

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

        def GT(self):
            return self.getToken(STIXPatternParser.GT, 0)

        def LT(self):
            return self.getToken(STIXPatternParser.LT, 0)

        def GE(self):
            return self.getToken(STIXPatternParser.GE, 0)

        def LE(self):
            return self.getToken(STIXPatternParser.LE, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_orderingComparator

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

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

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




    def orderingComparator(self):

        localctx = STIXPatternParser.OrderingComparatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_orderingComparator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 175
            _la = self._input.LA(1)
            if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << STIXPatternParser.LT) | (1 << STIXPatternParser.LE) | (1 << STIXPatternParser.GT) | (1 << STIXPatternParser.GE))) != 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 StringLiteralContext(ParserRuleContext):

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

        def StringLiteral(self):
            return self.getToken(STIXPatternParser.StringLiteral, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_stringLiteral

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

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

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




    def stringLiteral(self):

        localctx = STIXPatternParser.StringLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_stringLiteral)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 177
            self.match(STIXPatternParser.StringLiteral)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class StartStopQualifierContext(ParserRuleContext):

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

        def START(self):
            return self.getToken(STIXPatternParser.START, 0)

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

        def STOP(self):
            return self.getToken(STIXPatternParser.STOP, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_startStopQualifier

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

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

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




    def startStopQualifier(self):

        localctx = STIXPatternParser.StartStopQualifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_startStopQualifier)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 179
            self.match(STIXPatternParser.START)
            self.state = 180
            self.match(STIXPatternParser.TimestampLiteral)
            self.state = 181
            self.match(STIXPatternParser.STOP)
            self.state = 182
            self.match(STIXPatternParser.TimestampLiteral)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class WithinQualifierContext(ParserRuleContext):

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

        def WITHIN(self):
            return self.getToken(STIXPatternParser.WITHIN, 0)

        def SECONDS(self):
            return self.getToken(STIXPatternParser.SECONDS, 0)

        def IntPosLiteral(self):
            return self.getToken(STIXPatternParser.IntPosLiteral, 0)

        def FloatPosLiteral(self):
            return self.getToken(STIXPatternParser.FloatPosLiteral, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_withinQualifier

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

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

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




    def withinQualifier(self):

        localctx = STIXPatternParser.WithinQualifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_withinQualifier)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 184
            self.match(STIXPatternParser.WITHIN)
            self.state = 185
            _la = self._input.LA(1)
            if not(_la==STIXPatternParser.IntPosLiteral or _la==STIXPatternParser.FloatPosLiteral):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 186
            self.match(STIXPatternParser.SECONDS)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class RepeatedQualifierContext(ParserRuleContext):

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

        def REPEATS(self):
            return self.getToken(STIXPatternParser.REPEATS, 0)

        def IntPosLiteral(self):
            return self.getToken(STIXPatternParser.IntPosLiteral, 0)

        def TIMES(self):
            return self.getToken(STIXPatternParser.TIMES, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_repeatedQualifier

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

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

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




    def repeatedQualifier(self):

        localctx = STIXPatternParser.RepeatedQualifierContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_repeatedQualifier)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 188
            self.match(STIXPatternParser.REPEATS)
            self.state = 189
            self.match(STIXPatternParser.IntPosLiteral)
            self.state = 190
            self.match(STIXPatternParser.TIMES)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx

    class ObjectPathContext(ParserRuleContext):

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

        def objectType(self):
            return self.getTypedRuleContext(STIXPatternParser.ObjectTypeContext,0)


        def COLON(self):
            return self.getToken(STIXPatternParser.COLON, 0)

        def firstPathComponent(self):
            return self.getTypedRuleContext(STIXPatternParser.FirstPathComponentContext,0)


        def objectPathComponent(self):
            return self.getTypedRuleContext(STIXPatternParser.ObjectPathComponentContext,0)


        def getRuleIndex(self):
            return STIXPatternParser.RULE_objectPath

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

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

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




    def objectPath(self):

        localctx = STIXPatternParser.ObjectPathContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_objectPath)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 192
            self.objectType()
            self.state = 193
            self.match(STIXPatternParser.COLON)
            self.state = 194
            self.firstPathComponent()
            self.state = 196
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            if _la==STIXPatternParser.DOT or _la==STIXPatternParser.LBRACK:
                self.state = 195
                self.objectPathComponent(0)


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

    class ObjectTypeContext(ParserRuleContext):

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

        def IdentifierWithoutHyphen(self):
            return self.getToken(STIXPatternParser.IdentifierWithoutHyphen, 0)

        def IdentifierWithHyphen(self):
            return self.getToken(STIXPatternParser.IdentifierWithHyphen, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_objectType

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

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

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




    def objectType(self):

        localctx = STIXPatternParser.ObjectTypeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_objectType)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 198
            _la = self._input.LA(1)
            if not(_la==STIXPatternParser.IdentifierWithoutHyphen or _la==STIXPatternParser.IdentifierWithHyphen):
                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 FirstPathComponentContext(ParserRuleContext):

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

        def IdentifierWithoutHyphen(self):
            return self.getToken(STIXPatternParser.IdentifierWithoutHyphen, 0)

        def StringLiteral(self):
            return self.getToken(STIXPatternParser.StringLiteral, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_firstPathComponent

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

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

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




    def firstPathComponent(self):

        localctx = STIXPatternParser.FirstPathComponentContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_firstPathComponent)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 200
            _la = self._input.LA(1)
            if not(_la==STIXPatternParser.StringLiteral or _la==STIXPatternParser.IdentifierWithoutHyphen):
                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 ObjectPathComponentContext(ParserRuleContext):

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


        def getRuleIndex(self):
            return STIXPatternParser.RULE_objectPathComponent

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


    class IndexPathStepContext(ObjectPathComponentContext):

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

        def LBRACK(self):
            return self.getToken(STIXPatternParser.LBRACK, 0)
        def RBRACK(self):
            return self.getToken(STIXPatternParser.RBRACK, 0)
        def IntPosLiteral(self):
            return self.getToken(STIXPatternParser.IntPosLiteral, 0)
        def IntNegLiteral(self):
            return self.getToken(STIXPatternParser.IntNegLiteral, 0)
        def ASTERISK(self):
            return self.getToken(STIXPatternParser.ASTERISK, 0)

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

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

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


    class PathStepContext(ObjectPathComponentContext):

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

        def objectPathComponent(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(STIXPatternParser.ObjectPathComponentContext)
            else:
                return self.getTypedRuleContext(STIXPatternParser.ObjectPathComponentContext,i)


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

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

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


    class KeyPathStepContext(ObjectPathComponentContext):

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

        def IdentifierWithoutHyphen(self):
            return self.getToken(STIXPatternParser.IdentifierWithoutHyphen, 0)
        def StringLiteral(self):
            return self.getToken(STIXPatternParser.StringLiteral, 0)

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

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

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



    def objectPathComponent(self, _p:int=0):
        _parentctx = self._ctx
        _parentState = self.state
        localctx = STIXPatternParser.ObjectPathComponentContext(self, self._ctx, _parentState)
        _prevctx = localctx
        _startState = 32
        self.enterRecursionRule(localctx, 32, self.RULE_objectPathComponent, _p)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 208
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [STIXPatternParser.DOT]:
                localctx = STIXPatternParser.KeyPathStepContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx

                self.state = 203
                self.match(STIXPatternParser.DOT)
                self.state = 204
                _la = self._input.LA(1)
                if not(_la==STIXPatternParser.StringLiteral or _la==STIXPatternParser.IdentifierWithoutHyphen):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                pass
            elif token in [STIXPatternParser.LBRACK]:
                localctx = STIXPatternParser.IndexPathStepContext(self, localctx)
                self._ctx = localctx
                _prevctx = localctx
                self.state = 205
                self.match(STIXPatternParser.LBRACK)
                self.state = 206
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << STIXPatternParser.IntNegLiteral) | (1 << STIXPatternParser.IntPosLiteral) | (1 << STIXPatternParser.ASTERISK))) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 207
                self.match(STIXPatternParser.RBRACK)
                pass
            else:
                raise NoViableAltException(self)

            self._ctx.stop = self._input.LT(-1)
            self.state = 214
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,18,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    if self._parseListeners is not None:
                        self.triggerExitRuleEvent()
                    _prevctx = localctx
                    localctx = STIXPatternParser.PathStepContext(self, STIXPatternParser.ObjectPathComponentContext(self, _parentctx, _parentState))
                    self.pushNewRecursionContext(localctx, _startState, self.RULE_objectPathComponent)
                    self.state = 210
                    if not self.precpred(self._ctx, 3):
                        from antlr4.error.Errors import FailedPredicateException
                        raise FailedPredicateException(self, "self.precpred(self._ctx, 3)")
                    self.state = 211
                    self.objectPathComponent(4) 
                self.state = 216
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,18,self._ctx)

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

    class SetLiteralContext(ParserRuleContext):

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

        def LPAREN(self):
            return self.getToken(STIXPatternParser.LPAREN, 0)

        def RPAREN(self):
            return self.getToken(STIXPatternParser.RPAREN, 0)

        def primitiveLiteral(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(STIXPatternParser.PrimitiveLiteralContext)
            else:
                return self.getTypedRuleContext(STIXPatternParser.PrimitiveLiteralContext,i)


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

        def getRuleIndex(self):
            return STIXPatternParser.RULE_setLiteral

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

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

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




    def setLiteral(self):

        localctx = STIXPatternParser.SetLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_setLiteral)
        self._la = 0 # Token type
        try:
            self.state = 230
            self._errHandler.sync(self)
            la_ = self._interp.adaptivePredict(self._input,20,self._ctx)
            if la_ == 1:
                self.enterOuterAlt(localctx, 1)
                self.state = 217
                self.match(STIXPatternParser.LPAREN)
                self.state = 218
                self.match(STIXPatternParser.RPAREN)
                pass

            elif la_ == 2:
                self.enterOuterAlt(localctx, 2)
                self.state = 219
                self.match(STIXPatternParser.LPAREN)
                self.state = 220
                self.primitiveLiteral()
                self.state = 225
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==STIXPatternParser.COMMA:
                    self.state = 221
                    self.match(STIXPatternParser.COMMA)
                    self.state = 222
                    self.primitiveLiteral()
                    self.state = 227
                    self._errHandler.sync(self)
                    _la = self._input.LA(1)

                self.state = 228
                self.match(STIXPatternParser.RPAREN)
                pass


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

    class PrimitiveLiteralContext(ParserRuleContext):

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

        def orderableLiteral(self):
            return self.getTypedRuleContext(STIXPatternParser.OrderableLiteralContext,0)


        def BoolLiteral(self):
            return self.getToken(STIXPatternParser.BoolLiteral, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_primitiveLiteral

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

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

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




    def primitiveLiteral(self):

        localctx = STIXPatternParser.PrimitiveLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_primitiveLiteral)
        try:
            self.state = 234
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [STIXPatternParser.IntNegLiteral, STIXPatternParser.IntPosLiteral, STIXPatternParser.FloatNegLiteral, STIXPatternParser.FloatPosLiteral, STIXPatternParser.HexLiteral, STIXPatternParser.BinaryLiteral, STIXPatternParser.StringLiteral, STIXPatternParser.TimestampLiteral]:
                self.enterOuterAlt(localctx, 1)
                self.state = 232
                self.orderableLiteral()
                pass
            elif token in [STIXPatternParser.BoolLiteral]:
                self.enterOuterAlt(localctx, 2)
                self.state = 233
                self.match(STIXPatternParser.BoolLiteral)
                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 OrderableLiteralContext(ParserRuleContext):

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

        def IntPosLiteral(self):
            return self.getToken(STIXPatternParser.IntPosLiteral, 0)

        def IntNegLiteral(self):
            return self.getToken(STIXPatternParser.IntNegLiteral, 0)

        def FloatPosLiteral(self):
            return self.getToken(STIXPatternParser.FloatPosLiteral, 0)

        def FloatNegLiteral(self):
            return self.getToken(STIXPatternParser.FloatNegLiteral, 0)

        def stringLiteral(self):
            return self.getTypedRuleContext(STIXPatternParser.StringLiteralContext,0)


        def BinaryLiteral(self):
            return self.getToken(STIXPatternParser.BinaryLiteral, 0)

        def HexLiteral(self):
            return self.getToken(STIXPatternParser.HexLiteral, 0)

        def TimestampLiteral(self):
            return self.getToken(STIXPatternParser.TimestampLiteral, 0)

        def getRuleIndex(self):
            return STIXPatternParser.RULE_orderableLiteral

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

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

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




    def orderableLiteral(self):

        localctx = STIXPatternParser.OrderableLiteralContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_orderableLiteral)
        try:
            self.state = 244
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [STIXPatternParser.IntPosLiteral]:
                self.enterOuterAlt(localctx, 1)
                self.state = 236
                self.match(STIXPatternParser.IntPosLiteral)
                pass
            elif token in [STIXPatternParser.IntNegLiteral]:
                self.enterOuterAlt(localctx, 2)
                self.state = 237
                self.match(STIXPatternParser.IntNegLiteral)
                pass
            elif token in [STIXPatternParser.FloatPosLiteral]:
                self.enterOuterAlt(localctx, 3)
                self.state = 238
                self.match(STIXPatternParser.FloatPosLiteral)
                pass
            elif token in [STIXPatternParser.FloatNegLiteral]:
                self.enterOuterAlt(localctx, 4)
                self.state = 239
                self.match(STIXPatternParser.FloatNegLiteral)
                pass
            elif token in [STIXPatternParser.StringLiteral]:
                self.enterOuterAlt(localctx, 5)
                self.state = 240
                self.stringLiteral()
                pass
            elif token in [STIXPatternParser.BinaryLiteral]:
                self.enterOuterAlt(localctx, 6)
                self.state = 241
                self.match(STIXPatternParser.BinaryLiteral)
                pass
            elif token in [STIXPatternParser.HexLiteral]:
                self.enterOuterAlt(localctx, 7)
                self.state = 242
                self.match(STIXPatternParser.HexLiteral)
                pass
            elif token in [STIXPatternParser.TimestampLiteral]:
                self.enterOuterAlt(localctx, 8)
                self.state = 243
                self.match(STIXPatternParser.TimestampLiteral)
                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



    def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int):
        if self._predicates == None:
            self._predicates = dict()
        self._predicates[1] = self.observationExpressions_sempred
        self._predicates[2] = self.observationExpressionOr_sempred
        self._predicates[3] = self.observationExpressionAnd_sempred
        self._predicates[4] = self.observationExpression_sempred
        self._predicates[5] = self.comparisonExpression_sempred
        self._predicates[6] = self.comparisonExpressionAnd_sempred
        self._predicates[16] = self.objectPathComponent_sempred
        pred = self._predicates.get(ruleIndex, None)
        if pred is None:
            raise Exception("No predicate with index:" + str(ruleIndex))
        else:
            return pred(localctx, predIndex)

    def observationExpressions_sempred(self, localctx:ObservationExpressionsContext, predIndex:int):
            if predIndex == 0:
                return self.precpred(self._ctx, 2)
         

    def observationExpressionOr_sempred(self, localctx:ObservationExpressionOrContext, predIndex:int):
            if predIndex == 1:
                return self.precpred(self._ctx, 2)
         

    def observationExpressionAnd_sempred(self, localctx:ObservationExpressionAndContext, predIndex:int):
            if predIndex == 2:
                return self.precpred(self._ctx, 2)
         

    def observationExpression_sempred(self, localctx:ObservationExpressionContext, predIndex:int):
            if predIndex == 3:
                return self.precpred(self._ctx, 3)
         

            if predIndex == 4:
                return self.precpred(self._ctx, 2)
         

            if predIndex == 5:
                return self.precpred(self._ctx, 1)
         

    def comparisonExpression_sempred(self, localctx:ComparisonExpressionContext, predIndex:int):
            if predIndex == 6:
                return self.precpred(self._ctx, 2)
         

    def comparisonExpressionAnd_sempred(self, localctx:ComparisonExpressionAndContext, predIndex:int):
            if predIndex == 7:
                return self.precpred(self._ctx, 2)
         

    def objectPathComponent_sempred(self, localctx:ObjectPathComponentContext, predIndex:int):
            if predIndex == 8:
                return self.precpred(self._ctx, 3)
         




