Exemple #1
0
        public static MatchRecognizeSkipEnum ParseSkip(
            CommonTokenStream tokenStream,
            EsperEPL2GrammarParser.MatchRecogMatchesAfterSkipContext ctx)
        {
            if (!string.Equals(ctx.i1.GetText(), "MATCH", StringComparison.InvariantCultureIgnoreCase) ||
                !string.Equals(ctx.i2.GetText(), "SKIP", StringComparison.InvariantCultureIgnoreCase) ||
                !string.Equals(ctx.i5.GetText(), "ROW", StringComparison.InvariantCultureIgnoreCase)
            )
            {
                throw ASTWalkException.From(MESSAGE, tokenStream, ctx);
            }

            var i3 = ctx.i3.GetText();
            if (!string.Equals(i3, "TO", StringComparison.InvariantCultureIgnoreCase) &&
                !string.Equals(i3, "PAST", StringComparison.InvariantCultureIgnoreCase))
            {
                throw ASTWalkException.From(MESSAGE, tokenStream, ctx);
            }

            var i4 = ctx.i4.GetText();
            if (string.Equals(i4, "LAST", StringComparison.InvariantCultureIgnoreCase))
            {
                return MatchRecognizeSkipEnum.PAST_LAST_ROW;
            }

            if (string.Equals(i4, "NEXT", StringComparison.InvariantCultureIgnoreCase))
            {
                return MatchRecognizeSkipEnum.TO_NEXT_ROW;
            }

            if (string.Equals(i4, "CURRENT", StringComparison.InvariantCultureIgnoreCase))
            {
                return MatchRecognizeSkipEnum.TO_CURRENT_ROW;
            }

            throw ASTWalkException.From(MESSAGE);
        }
        public static MatchRecognizeSkipEnum ParseSkip(CommonTokenStream tokenStream, EsperEPL2GrammarParser.MatchRecogMatchesAfterSkipContext ctx)
        {
            if ((!ctx.i1.GetText().ToUpper().Equals("MATCH")) ||
                (!ctx.i2.GetText().ToUpper().Equals("SKIP")) ||
                (!ctx.i5.GetText().ToUpper().Equals("ROW"))
                )
            {
                throw ASTWalkException.From(Message, tokenStream, ctx);
            }

            if ((!ctx.i3.GetText().ToUpper().Equals("TO")) &&
                (!ctx.i3.GetText().ToUpper().Equals("PAST"))
                )
            {
                throw ASTWalkException.From(Message, tokenStream, ctx);
            }

            if (ctx.i4.GetText().ToUpper().Equals("LAST"))
            {
                return(MatchRecognizeSkipEnum.PAST_LAST_ROW);
            }
            else if (ctx.i4.GetText().ToUpper().Equals("NEXT"))
            {
                return(MatchRecognizeSkipEnum.TO_NEXT_ROW);
            }
            else if (ctx.i4.GetText().ToUpper().Equals("CURRENT"))
            {
                return(MatchRecognizeSkipEnum.TO_CURRENT_ROW);
            }
            throw ASTWalkException.From(Message);
        }