# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Generated from MetricAlertCondition.g4 by ANTLR 4.7.2
# encoding: utf-8
# pylint: disable=all
from antlr4 import *
from io import StringIO
import sys


def serializedATN():
    with StringIO() as buf:
        buf.write(u"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3")
        buf.write(u"\34\u00b5\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7")
        buf.write(u"\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t")
        buf.write(u"\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22")
        buf.write(u"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4")
        buf.write(u"\30\t\30\3\2\3\2\3\2\3\2\7\2\65\n\2\f\2\16\28\13\2\3")
        buf.write(u"\2\3\2\3\2\3\2\3\2\3\2\5\2@\n\2\3\2\3\2\3\2\5\2E\n\2")
        buf.write(u"\3\2\3\2\7\2I\n\2\f\2\16\2L\13\2\3\2\7\2O\n\2\f\2\16")
        buf.write(u"\2R\13\2\3\3\3\3\3\3\3\4\6\4X\n\4\r\4\16\4Y\3\5\6\5]")
        buf.write(u"\n\5\r\5\16\5^\3\6\3\6\3\6\3\7\3\7\3\b\3\b\3\b\3\t\3")
        buf.write(u"\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\7\tr\n\t\f\t\16\tu\13")
        buf.write(u"\t\3\n\3\n\3\n\3\13\3\13\3\13\3\f\3\f\3\f\3\r\3\r\3\16")
        buf.write(u"\3\16\3\16\3\17\6\17\u0086\n\17\r\17\16\17\u0087\3\20")
        buf.write(u"\3\20\3\20\3\21\3\21\3\21\3\21\3\21\7\21\u0092\n\21\f")
        buf.write(u"\21\16\21\u0095\13\21\3\22\3\22\3\22\3\22\3\23\3\23\3")
        buf.write(u"\23\3\24\3\24\3\24\3\25\3\25\3\25\3\26\3\26\3\26\3\27")
        buf.write(u"\3\27\3\27\3\27\7\27\u00ab\n\27\f\27\16\27\u00ae\13\27")
        buf.write(u"\3\30\6\30\u00b1\n\30\r\30\16\30\u00b2\3\30\2\2\31\2")
        buf.write(u"\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\2\t\5")
        buf.write(u"\2\3\4\30\30\34\34\6\2\3\13\30\30\32\32\34\34\b\2\3\3")
        buf.write(u"\7\7\t\t\f\f\30\30\34\34\4\2\n\n\20\20\3\2\21\22\4\2")
        buf.write(u"\n\n\23\23\t\2\3\3\5\5\7\13\r\16\30\30\32\32\34\34\2")
        buf.write(u"\u00a9\2\60\3\2\2\2\4S\3\2\2\2\6W\3\2\2\2\b\\\3\2\2\2")
        buf.write(u"\n`\3\2\2\2\fc\3\2\2\2\16e\3\2\2\2\20h\3\2\2\2\22v\3")
        buf.write(u"\2\2\2\24y\3\2\2\2\26|\3\2\2\2\30\177\3\2\2\2\32\u0081")
        buf.write(u"\3\2\2\2\34\u0085\3\2\2\2\36\u0089\3\2\2\2 \u008c\3\2")
        buf.write(u"\2\2\"\u0096\3\2\2\2$\u009a\3\2\2\2&\u009d\3\2\2\2(\u00a0")
        buf.write(u"\3\2\2\2*\u00a3\3\2\2\2,\u00a6\3\2\2\2.\u00b0\3\2\2\2")
        buf.write(u"\60\66\5\4\3\2\61\62\5\6\4\2\62\63\7\3\2\2\63\65\3\2")
        buf.write(u"\2\2\64\61\3\2\2\2\658\3\2\2\2\66\64\3\2\2\2\66\67\3")
        buf.write(u"\2\2\2\67?\3\2\2\28\66\3\2\2\29:\7\31\2\2:;\5\b\5\2;")
        buf.write(u"<\7\31\2\2<=\7\32\2\2=@\3\2\2\2>@\5\b\5\2?9\3\2\2\2?")
        buf.write(u">\3\2\2\2@A\3\2\2\2AD\5\n\6\2BE\5\f\7\2CE\5\20\t\2DB")
        buf.write(u"\3\2\2\2DC\3\2\2\2EJ\3\2\2\2FG\7\32\2\2GI\5 \21\2HF\3")
        buf.write(u"\2\2\2IL\3\2\2\2JH\3\2\2\2JK\3\2\2\2KP\3\2\2\2LJ\3\2")
        buf.write(u"\2\2MO\7\33\2\2NM\3\2\2\2OR\3\2\2\2PN\3\2\2\2PQ\3\2\2")
        buf.write(u"\2Q\3\3\2\2\2RP\3\2\2\2ST\7\34\2\2TU\7\32\2\2U\5\3\2")
        buf.write(u"\2\2VX\t\2\2\2WV\3\2\2\2XY\3\2\2\2YW\3\2\2\2YZ\3\2\2")
        buf.write(u"\2Z\7\3\2\2\2[]\t\3\2\2\\[\3\2\2\2]^\3\2\2\2^\\\3\2\2")
        buf.write(u"\2^_\3\2\2\2_\t\3\2\2\2`a\7\27\2\2ab\7\32\2\2b\13\3\2")
        buf.write(u"\2\2cd\7\30\2\2d\r\3\2\2\2ef\7\24\2\2fg\7\32\2\2g\17")
        buf.write(u"\3\2\2\2hi\5\16\b\2ij\5\22\n\2jk\5\24\13\2kl\5\26\f\2")
        buf.write(u"ls\5\30\r\2mn\7\32\2\2no\5\32\16\2op\5\34\17\2pr\3\2")
        buf.write(u"\2\2qm\3\2\2\2ru\3\2\2\2sq\3\2\2\2st\3\2\2\2t\21\3\2")
        buf.write(u"\2\2us\3\2\2\2vw\7\34\2\2wx\7\32\2\2x\23\3\2\2\2yz\7")
        buf.write(u"\30\2\2z{\7\32\2\2{\25\3\2\2\2|}\7\25\2\2}~\7\32\2\2")
        buf.write(u"~\27\3\2\2\2\177\u0080\7\30\2\2\u0080\31\3\2\2\2\u0081")
        buf.write(u"\u0082\7\26\2\2\u0082\u0083\7\32\2\2\u0083\33\3\2\2\2")
        buf.write(u"\u0084\u0086\t\4\2\2\u0085\u0084\3\2\2\2\u0086\u0087")
        buf.write(u"\3\2\2\2\u0087\u0085\3\2\2\2\u0087\u0088\3\2\2\2\u0088")
        buf.write(u"\35\3\2\2\2\u0089\u008a\7\17\2\2\u008a\u008b\7\32\2\2")
        buf.write(u"\u008b\37\3\2\2\2\u008c\u008d\5\36\20\2\u008d\u0093\5")
        buf.write(u"\"\22\2\u008e\u008f\5$\23\2\u008f\u0090\5\"\22\2\u0090")
        buf.write(u"\u0092\3\2\2\2\u0091\u008e\3\2\2\2\u0092\u0095\3\2\2")
        buf.write(u"\2\u0093\u0091\3\2\2\2\u0093\u0094\3\2\2\2\u0094!\3\2")
        buf.write(u"\2\2\u0095\u0093\3\2\2\2\u0096\u0097\5*\26\2\u0097\u0098")
        buf.write(u"\5&\24\2\u0098\u0099\5,\27\2\u0099#\3\2\2\2\u009a\u009b")
        buf.write(u"\t\5\2\2\u009b\u009c\7\32\2\2\u009c%\3\2\2\2\u009d\u009e")
        buf.write(u"\t\6\2\2\u009e\u009f\7\32\2\2\u009f\'\3\2\2\2\u00a0\u00a1")
        buf.write(u"\t\7\2\2\u00a1\u00a2\7\32\2\2\u00a2)\3\2\2\2\u00a3\u00a4")
        buf.write(u"\7\34\2\2\u00a4\u00a5\7\32\2\2\u00a5+\3\2\2\2\u00a6\u00ac")
        buf.write(u"\5.\30\2\u00a7\u00a8\5(\25\2\u00a8\u00a9\5.\30\2\u00a9")
        buf.write(u"\u00ab\3\2\2\2\u00aa\u00a7\3\2\2\2\u00ab\u00ae\3\2\2")
        buf.write(u"\2\u00ac\u00aa\3\2\2\2\u00ac\u00ad\3\2\2\2\u00ad-\3\2")
        buf.write(u"\2\2\u00ae\u00ac\3\2\2\2\u00af\u00b1\t\b\2\2\u00b0\u00af")
        buf.write(u"\3\2\2\2\u00b1\u00b2\3\2\2\2\u00b2\u00b0\3\2\2\2\u00b2")
        buf.write(u"\u00b3\3\2\2\2\u00b3/\3\2\2\2\16\66?DJPY^s\u0087\u0093")
        buf.write(u"\u00ac\u00b2")
        return buf.getvalue()


class MetricAlertConditionParser ( Parser ):

    grammarFileName = "MetricAlertCondition.g4"

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

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

    sharedContextCache = PredictionContextCache()

    literalNames = [ u"<INVALID>", u"'.'", u"'/'", u"'_'", u"'\\'", u"':'", 
                     u"'%'", u"'-'", u"','", u"'|'", u"'+'", u"'*'", u"'~'" ]

    symbolicNames = [ u"<INVALID>", u"<INVALID>", u"<INVALID>", u"<INVALID>", 
                      u"<INVALID>", u"<INVALID>", u"<INVALID>", u"<INVALID>", 
                      u"<INVALID>", u"<INVALID>", u"<INVALID>", u"<INVALID>", 
                      u"<INVALID>", u"WHERE", u"AND", u"INCLUDES", u"EXCLUDES", 
                      u"OR", u"DYNAMIC", u"OF", u"SINCE", u"OPERATOR", u"NUMBER", 
                      u"QUOTE", u"WHITESPACE", u"NEWLINE", u"WORD" ]

    RULE_expression = 0
    RULE_aggregation = 1
    RULE_namespace = 2
    RULE_metric = 3
    RULE_operator = 4
    RULE_threshold = 5
    RULE_dynamic = 6
    RULE_dynamics = 7
    RULE_dyn_sensitivity = 8
    RULE_dyn_violations = 9
    RULE_dyn_of_separator = 10
    RULE_dyn_windows = 11
    RULE_dyn_since_seperator = 12
    RULE_dyn_datetime = 13
    RULE_where = 14
    RULE_dimensions = 15
    RULE_dimension = 16
    RULE_dim_separator = 17
    RULE_dim_operator = 18
    RULE_dim_val_separator = 19
    RULE_dim_name = 20
    RULE_dim_values = 21
    RULE_dim_value = 22

    ruleNames =  [ u"expression", u"aggregation", u"namespace", u"metric", 
                   u"operator", u"threshold", u"dynamic", u"dynamics", u"dyn_sensitivity", 
                   u"dyn_violations", u"dyn_of_separator", u"dyn_windows", 
                   u"dyn_since_seperator", u"dyn_datetime", u"where", u"dimensions", 
                   u"dimension", u"dim_separator", u"dim_operator", u"dim_val_separator", 
                   u"dim_name", u"dim_values", u"dim_value" ]

    EOF = Token.EOF
    T__0=1
    T__1=2
    T__2=3
    T__3=4
    T__4=5
    T__5=6
    T__6=7
    T__7=8
    T__8=9
    T__9=10
    T__10=11
    T__11=12
    WHERE=13
    AND=14
    INCLUDES=15
    EXCLUDES=16
    OR=17
    DYNAMIC=18
    OF=19
    SINCE=20
    OPERATOR=21
    NUMBER=22
    QUOTE=23
    WHITESPACE=24
    NEWLINE=25
    WORD=26

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




    class ExpressionContext(ParserRuleContext):

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

        def aggregation(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.AggregationContext,0)


        def operator(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.OperatorContext,0)


        def QUOTE(self, i=None):
            if i is None:
                return self.getTokens(MetricAlertConditionParser.QUOTE)
            else:
                return self.getToken(MetricAlertConditionParser.QUOTE, i)

        def metric(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.MetricContext,0)


        def WHITESPACE(self, i=None):
            if i is None:
                return self.getTokens(MetricAlertConditionParser.WHITESPACE)
            else:
                return self.getToken(MetricAlertConditionParser.WHITESPACE, i)

        def threshold(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.ThresholdContext,0)


        def dynamics(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.DynamicsContext,0)


        def namespace(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(MetricAlertConditionParser.NamespaceContext)
            else:
                return self.getTypedRuleContext(MetricAlertConditionParser.NamespaceContext,i)


        def dimensions(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(MetricAlertConditionParser.DimensionsContext)
            else:
                return self.getTypedRuleContext(MetricAlertConditionParser.DimensionsContext,i)


        def NEWLINE(self, i=None):
            if i is None:
                return self.getTokens(MetricAlertConditionParser.NEWLINE)
            else:
                return self.getToken(MetricAlertConditionParser.NEWLINE, i)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_expression

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

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




    def expression(self):

        localctx = MetricAlertConditionParser.ExpressionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_expression)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 46
            self.aggregation()
            self.state = 52
            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:
                    self.state = 47
                    self.namespace()
                    self.state = 48
                    self.match(MetricAlertConditionParser.T__0) 
                self.state = 54
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,0,self._ctx)

            self.state = 61
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MetricAlertConditionParser.QUOTE]:
                self.state = 55
                self.match(MetricAlertConditionParser.QUOTE)
                self.state = 56
                self.metric()
                self.state = 57
                self.match(MetricAlertConditionParser.QUOTE)
                self.state = 58
                self.match(MetricAlertConditionParser.WHITESPACE)
                pass
            elif token in [MetricAlertConditionParser.T__0, MetricAlertConditionParser.T__1, MetricAlertConditionParser.T__2, MetricAlertConditionParser.T__3, MetricAlertConditionParser.T__4, MetricAlertConditionParser.T__5, MetricAlertConditionParser.T__6, MetricAlertConditionParser.T__7, MetricAlertConditionParser.T__8, MetricAlertConditionParser.NUMBER, MetricAlertConditionParser.WHITESPACE, MetricAlertConditionParser.WORD]:
                self.state = 60
                self.metric()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 63
            self.operator()
            self.state = 66
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [MetricAlertConditionParser.NUMBER]:
                self.state = 64
                self.threshold()
                pass
            elif token in [MetricAlertConditionParser.DYNAMIC]:
                self.state = 65
                self.dynamics()
                pass
            else:
                raise NoViableAltException(self)

            self.state = 72
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==MetricAlertConditionParser.WHITESPACE:
                self.state = 68
                self.match(MetricAlertConditionParser.WHITESPACE)
                self.state = 69
                self.dimensions()
                self.state = 74
                self._errHandler.sync(self)
                _la = self._input.LA(1)

            self.state = 78
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==MetricAlertConditionParser.NEWLINE:
                self.state = 75
                self.match(MetricAlertConditionParser.NEWLINE)
                self.state = 80
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class AggregationContext(ParserRuleContext):

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

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

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_aggregation

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

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




    def aggregation(self):

        localctx = MetricAlertConditionParser.AggregationContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_aggregation)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 81
            self.match(MetricAlertConditionParser.WORD)
            self.state = 82
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class NamespaceContext(ParserRuleContext):

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

        def NUMBER(self, i=None):
            if i is None:
                return self.getTokens(MetricAlertConditionParser.NUMBER)
            else:
                return self.getToken(MetricAlertConditionParser.NUMBER, i)

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

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_namespace

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

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




    def namespace(self):

        localctx = MetricAlertConditionParser.NamespaceContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_namespace)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 85 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 84
                    _la = self._input.LA(1)
                    if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MetricAlertConditionParser.T__0) | (1 << MetricAlertConditionParser.T__1) | (1 << MetricAlertConditionParser.NUMBER) | (1 << MetricAlertConditionParser.WORD))) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()

                else:
                    raise NoViableAltException(self)
                self.state = 87 
                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.exitRule()
        return localctx


    class MetricContext(ParserRuleContext):

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

        def NUMBER(self, i=None):
            if i is None:
                return self.getTokens(MetricAlertConditionParser.NUMBER)
            else:
                return self.getToken(MetricAlertConditionParser.NUMBER, i)

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

        def WHITESPACE(self, i=None):
            if i is None:
                return self.getTokens(MetricAlertConditionParser.WHITESPACE)
            else:
                return self.getToken(MetricAlertConditionParser.WHITESPACE, i)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_metric

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

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




    def metric(self):

        localctx = MetricAlertConditionParser.MetricContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_metric)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 90 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 89
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MetricAlertConditionParser.T__0) | (1 << MetricAlertConditionParser.T__1) | (1 << MetricAlertConditionParser.T__2) | (1 << MetricAlertConditionParser.T__3) | (1 << MetricAlertConditionParser.T__4) | (1 << MetricAlertConditionParser.T__5) | (1 << MetricAlertConditionParser.T__6) | (1 << MetricAlertConditionParser.T__7) | (1 << MetricAlertConditionParser.T__8) | (1 << MetricAlertConditionParser.NUMBER) | (1 << MetricAlertConditionParser.WHITESPACE) | (1 << MetricAlertConditionParser.WORD))) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 92 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MetricAlertConditionParser.T__0) | (1 << MetricAlertConditionParser.T__1) | (1 << MetricAlertConditionParser.T__2) | (1 << MetricAlertConditionParser.T__3) | (1 << MetricAlertConditionParser.T__4) | (1 << MetricAlertConditionParser.T__5) | (1 << MetricAlertConditionParser.T__6) | (1 << MetricAlertConditionParser.T__7) | (1 << MetricAlertConditionParser.T__8) | (1 << MetricAlertConditionParser.NUMBER) | (1 << MetricAlertConditionParser.WHITESPACE) | (1 << MetricAlertConditionParser.WORD))) != 0)):
                    break

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


    class OperatorContext(ParserRuleContext):

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

        def OPERATOR(self):
            return self.getToken(MetricAlertConditionParser.OPERATOR, 0)

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_operator

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

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




    def operator(self):

        localctx = MetricAlertConditionParser.OperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_operator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 94
            self.match(MetricAlertConditionParser.OPERATOR)
            self.state = 95
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class ThresholdContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_threshold

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

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




    def threshold(self):

        localctx = MetricAlertConditionParser.ThresholdContext(self, self._ctx, self.state)
        self.enterRule(localctx, 10, self.RULE_threshold)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 97
            self.match(MetricAlertConditionParser.NUMBER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DynamicContext(ParserRuleContext):

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

        def DYNAMIC(self):
            return self.getToken(MetricAlertConditionParser.DYNAMIC, 0)

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dynamic

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

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




    def dynamic(self):

        localctx = MetricAlertConditionParser.DynamicContext(self, self._ctx, self.state)
        self.enterRule(localctx, 12, self.RULE_dynamic)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 99
            self.match(MetricAlertConditionParser.DYNAMIC)
            self.state = 100
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DynamicsContext(ParserRuleContext):

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

        def dynamic(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.DynamicContext,0)


        def dyn_sensitivity(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.Dyn_sensitivityContext,0)


        def dyn_violations(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.Dyn_violationsContext,0)


        def dyn_of_separator(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.Dyn_of_separatorContext,0)


        def dyn_windows(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.Dyn_windowsContext,0)


        def WHITESPACE(self, i=None):
            if i is None:
                return self.getTokens(MetricAlertConditionParser.WHITESPACE)
            else:
                return self.getToken(MetricAlertConditionParser.WHITESPACE, i)

        def dyn_since_seperator(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(MetricAlertConditionParser.Dyn_since_seperatorContext)
            else:
                return self.getTypedRuleContext(MetricAlertConditionParser.Dyn_since_seperatorContext,i)


        def dyn_datetime(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(MetricAlertConditionParser.Dyn_datetimeContext)
            else:
                return self.getTypedRuleContext(MetricAlertConditionParser.Dyn_datetimeContext,i)


        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dynamics

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

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




    def dynamics(self):

        localctx = MetricAlertConditionParser.DynamicsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 14, self.RULE_dynamics)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 102
            self.dynamic()
            self.state = 103
            self.dyn_sensitivity()
            self.state = 104
            self.dyn_violations()
            self.state = 105
            self.dyn_of_separator()
            self.state = 106
            self.dyn_windows()
            self.state = 113
            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:
                    self.state = 107
                    self.match(MetricAlertConditionParser.WHITESPACE)
                    self.state = 108
                    self.dyn_since_seperator()
                    self.state = 109
                    self.dyn_datetime() 
                self.state = 115
                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.exitRule()
        return localctx


    class Dyn_sensitivityContext(ParserRuleContext):

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

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

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dyn_sensitivity

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

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




    def dyn_sensitivity(self):

        localctx = MetricAlertConditionParser.Dyn_sensitivityContext(self, self._ctx, self.state)
        self.enterRule(localctx, 16, self.RULE_dyn_sensitivity)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 116
            self.match(MetricAlertConditionParser.WORD)
            self.state = 117
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Dyn_violationsContext(ParserRuleContext):

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

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

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dyn_violations

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

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




    def dyn_violations(self):

        localctx = MetricAlertConditionParser.Dyn_violationsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 18, self.RULE_dyn_violations)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 119
            self.match(MetricAlertConditionParser.NUMBER)
            self.state = 120
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Dyn_of_separatorContext(ParserRuleContext):

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

        def OF(self):
            return self.getToken(MetricAlertConditionParser.OF, 0)

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dyn_of_separator

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

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




    def dyn_of_separator(self):

        localctx = MetricAlertConditionParser.Dyn_of_separatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 20, self.RULE_dyn_of_separator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 122
            self.match(MetricAlertConditionParser.OF)
            self.state = 123
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Dyn_windowsContext(ParserRuleContext):

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

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

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dyn_windows

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

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




    def dyn_windows(self):

        localctx = MetricAlertConditionParser.Dyn_windowsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 22, self.RULE_dyn_windows)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 125
            self.match(MetricAlertConditionParser.NUMBER)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Dyn_since_seperatorContext(ParserRuleContext):

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

        def SINCE(self):
            return self.getToken(MetricAlertConditionParser.SINCE, 0)

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dyn_since_seperator

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

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




    def dyn_since_seperator(self):

        localctx = MetricAlertConditionParser.Dyn_since_seperatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 24, self.RULE_dyn_since_seperator)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 127
            self.match(MetricAlertConditionParser.SINCE)
            self.state = 128
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Dyn_datetimeContext(ParserRuleContext):

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

        def NUMBER(self, i=None):
            if i is None:
                return self.getTokens(MetricAlertConditionParser.NUMBER)
            else:
                return self.getToken(MetricAlertConditionParser.NUMBER, i)

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

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dyn_datetime

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

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




    def dyn_datetime(self):

        localctx = MetricAlertConditionParser.Dyn_datetimeContext(self, self._ctx, self.state)
        self.enterRule(localctx, 26, self.RULE_dyn_datetime)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 131 
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while True:
                self.state = 130
                _la = self._input.LA(1)
                if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MetricAlertConditionParser.T__0) | (1 << MetricAlertConditionParser.T__4) | (1 << MetricAlertConditionParser.T__6) | (1 << MetricAlertConditionParser.T__9) | (1 << MetricAlertConditionParser.NUMBER) | (1 << MetricAlertConditionParser.WORD))) != 0)):
                    self._errHandler.recoverInline(self)
                else:
                    self._errHandler.reportMatch(self)
                    self.consume()
                self.state = 133 
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MetricAlertConditionParser.T__0) | (1 << MetricAlertConditionParser.T__4) | (1 << MetricAlertConditionParser.T__6) | (1 << MetricAlertConditionParser.T__9) | (1 << MetricAlertConditionParser.NUMBER) | (1 << MetricAlertConditionParser.WORD))) != 0)):
                    break

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


    class WhereContext(ParserRuleContext):

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

        def WHERE(self):
            return self.getToken(MetricAlertConditionParser.WHERE, 0)

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_where

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

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




    def where(self):

        localctx = MetricAlertConditionParser.WhereContext(self, self._ctx, self.state)
        self.enterRule(localctx, 28, self.RULE_where)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 135
            self.match(MetricAlertConditionParser.WHERE)
            self.state = 136
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class DimensionsContext(ParserRuleContext):

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

        def where(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.WhereContext,0)


        def dimension(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(MetricAlertConditionParser.DimensionContext)
            else:
                return self.getTypedRuleContext(MetricAlertConditionParser.DimensionContext,i)


        def dim_separator(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(MetricAlertConditionParser.Dim_separatorContext)
            else:
                return self.getTypedRuleContext(MetricAlertConditionParser.Dim_separatorContext,i)


        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dimensions

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

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




    def dimensions(self):

        localctx = MetricAlertConditionParser.DimensionsContext(self, self._ctx, self.state)
        self.enterRule(localctx, 30, self.RULE_dimensions)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 138
            self.where()
            self.state = 139
            self.dimension()
            self.state = 145
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==MetricAlertConditionParser.T__7 or _la==MetricAlertConditionParser.AND:
                self.state = 140
                self.dim_separator()
                self.state = 141
                self.dimension()
                self.state = 147
                self._errHandler.sync(self)
                _la = self._input.LA(1)

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


    class DimensionContext(ParserRuleContext):

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

        def dim_name(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.Dim_nameContext,0)


        def dim_operator(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.Dim_operatorContext,0)


        def dim_values(self):
            return self.getTypedRuleContext(MetricAlertConditionParser.Dim_valuesContext,0)


        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dimension

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

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




    def dimension(self):

        localctx = MetricAlertConditionParser.DimensionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 32, self.RULE_dimension)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 148
            self.dim_name()
            self.state = 149
            self.dim_operator()
            self.state = 150
            self.dim_values()
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Dim_separatorContext(ParserRuleContext):

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

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

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

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dim_separator

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

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




    def dim_separator(self):

        localctx = MetricAlertConditionParser.Dim_separatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 34, self.RULE_dim_separator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 152
            _la = self._input.LA(1)
            if not(_la==MetricAlertConditionParser.T__7 or _la==MetricAlertConditionParser.AND):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 153
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Dim_operatorContext(ParserRuleContext):

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

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

        def INCLUDES(self):
            return self.getToken(MetricAlertConditionParser.INCLUDES, 0)

        def EXCLUDES(self):
            return self.getToken(MetricAlertConditionParser.EXCLUDES, 0)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dim_operator

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

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




    def dim_operator(self):

        localctx = MetricAlertConditionParser.Dim_operatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 36, self.RULE_dim_operator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 155
            _la = self._input.LA(1)
            if not(_la==MetricAlertConditionParser.INCLUDES or _la==MetricAlertConditionParser.EXCLUDES):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 156
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Dim_val_separatorContext(ParserRuleContext):

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

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

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

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dim_val_separator

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

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




    def dim_val_separator(self):

        localctx = MetricAlertConditionParser.Dim_val_separatorContext(self, self._ctx, self.state)
        self.enterRule(localctx, 38, self.RULE_dim_val_separator)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 158
            _la = self._input.LA(1)
            if not(_la==MetricAlertConditionParser.T__7 or _la==MetricAlertConditionParser.OR):
                self._errHandler.recoverInline(self)
            else:
                self._errHandler.reportMatch(self)
                self.consume()
            self.state = 159
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Dim_nameContext(ParserRuleContext):

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

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

        def WHITESPACE(self):
            return self.getToken(MetricAlertConditionParser.WHITESPACE, 0)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dim_name

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

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




    def dim_name(self):

        localctx = MetricAlertConditionParser.Dim_nameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 40, self.RULE_dim_name)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 161
            self.match(MetricAlertConditionParser.WORD)
            self.state = 162
            self.match(MetricAlertConditionParser.WHITESPACE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
            self._errHandler.recover(self, re)
        finally:
            self.exitRule()
        return localctx


    class Dim_valuesContext(ParserRuleContext):

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

        def dim_value(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(MetricAlertConditionParser.Dim_valueContext)
            else:
                return self.getTypedRuleContext(MetricAlertConditionParser.Dim_valueContext,i)


        def dim_val_separator(self, i=None):
            if i is None:
                return self.getTypedRuleContexts(MetricAlertConditionParser.Dim_val_separatorContext)
            else:
                return self.getTypedRuleContext(MetricAlertConditionParser.Dim_val_separatorContext,i)


        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dim_values

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

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




    def dim_values(self):

        localctx = MetricAlertConditionParser.Dim_valuesContext(self, self._ctx, self.state)
        self.enterRule(localctx, 42, self.RULE_dim_values)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 164
            self.dim_value()
            self.state = 170
            self._errHandler.sync(self)
            _alt = self._interp.adaptivePredict(self._input,10,self._ctx)
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt==1:
                    self.state = 165
                    self.dim_val_separator()
                    self.state = 166
                    self.dim_value() 
                self.state = 172
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,10,self._ctx)

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


    class Dim_valueContext(ParserRuleContext):

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

        def NUMBER(self, i=None):
            if i is None:
                return self.getTokens(MetricAlertConditionParser.NUMBER)
            else:
                return self.getToken(MetricAlertConditionParser.NUMBER, i)

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

        def WHITESPACE(self, i=None):
            if i is None:
                return self.getTokens(MetricAlertConditionParser.WHITESPACE)
            else:
                return self.getToken(MetricAlertConditionParser.WHITESPACE, i)

        def getRuleIndex(self):
            return MetricAlertConditionParser.RULE_dim_value

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

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




    def dim_value(self):

        localctx = MetricAlertConditionParser.Dim_valueContext(self, self._ctx, self.state)
        self.enterRule(localctx, 44, self.RULE_dim_value)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 174 
            self._errHandler.sync(self)
            _alt = 1
            while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
                if _alt == 1:
                    self.state = 173
                    _la = self._input.LA(1)
                    if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << MetricAlertConditionParser.T__0) | (1 << MetricAlertConditionParser.T__2) | (1 << MetricAlertConditionParser.T__4) | (1 << MetricAlertConditionParser.T__5) | (1 << MetricAlertConditionParser.T__6) | (1 << MetricAlertConditionParser.T__7) | (1 << MetricAlertConditionParser.T__8) | (1 << MetricAlertConditionParser.T__10) | (1 << MetricAlertConditionParser.T__11) | (1 << MetricAlertConditionParser.NUMBER) | (1 << MetricAlertConditionParser.WHITESPACE) | (1 << MetricAlertConditionParser.WORD))) != 0)):
                        self._errHandler.recoverInline(self)
                    else:
                        self._errHandler.reportMatch(self)
                        self.consume()

                else:
                    raise NoViableAltException(self)
                self.state = 176 
                self._errHandler.sync(self)
                _alt = self._interp.adaptivePredict(self._input,11,self._ctx)

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





