Examples of EsperEPL2GrammarParser


Examples of com.espertech.esper.epl.generated.EsperEPL2GrammarParser

            throw new PropertyAccessException("IOException parsing property name '" + propertyName + '\'', ex);
        }

        EsperEPL2GrammarLexer lex = new EsperEPL2GrammarLexer(input);
        CommonTokenStream tokens = new CommonTokenStream(lex);
        EsperEPL2GrammarParser g = new EsperEPL2GrammarParser(tokens);
        EsperEPL2GrammarParser.startEventPropertyRule_return r;

        try
        {
             r = g.startEventPropertyRule();
        }
        catch (RuntimeException e)
        {
            if (log.isDebugEnabled())
            {
                log.debug("Error parsing property expression [" + propertyName + "]", e);
            }
            if (e.getCause() instanceof RecognitionException)
            {
                throw ExceptionConvertor.convertProperty((RecognitionException)e.getCause(), propertyName, true, g);
            }
            else
            {
                throw e;
            }
        }
        catch (RecognitionException e)
        {
            // Check for keywords and escape each, parse again
            String escapedPropertyName = escapeKeywords(tokens);

            CharStream inputEscaped;
            try
            {
                inputEscaped = new NoCaseSensitiveStream(new StringReader(escapedPropertyName));
            }
            catch (IOException ex)
            {
                throw new PropertyAccessException("IOException parsing property name '" + propertyName + '\'', ex);
            }

            EsperEPL2GrammarLexer lexEscaped = new EsperEPL2GrammarLexer(inputEscaped);
            CommonTokenStream tokensEscaped = new CommonTokenStream(lexEscaped);
            EsperEPL2GrammarParser gEscaped = new EsperEPL2GrammarParser(tokensEscaped);
            EsperEPL2GrammarParser.startEventPropertyRule_return rEscaped;

            try
            {
                rEscaped = gEscaped.startEventPropertyRule();
                return (Tree) rEscaped.getTree();
            }
            catch (Exception eEscaped)
            {
            }
View Full Code Here

Examples of com.espertech.esper.epl.generated.EsperEPL2GrammarParser

    private synchronized static String escapeKeywords(CommonTokenStream tokens) {

        if (keywordCache == null) {
            keywordCache = new HashSet<String>();
            Set<String> keywords = new EsperEPL2GrammarParser(tokens).getKeywords();
            for (String keyword : keywords) {
                if (keyword.charAt(0) == '\'' && keyword.charAt(keyword.length() - 1) == '\'') {
                    keywordCache.add(keyword.substring(1, keyword.length() - 1));
                }
            }
View Full Code Here

Examples of com.espertech.esper.epl.generated.EsperEPL2GrammarParser

            throw new PropertyAccessException("IOException parsing property name '" + propertyName + '\'', ex);
        }

        EsperEPL2GrammarLexer lex = new EsperEPL2GrammarLexer(input);
        CommonTokenStream tokens = new CommonTokenStream(lex);
        EsperEPL2GrammarParser g = new EsperEPL2GrammarParser(tokens);
        EsperEPL2GrammarParser.startEventPropertyRule_return r;

        try
        {
             r = g.startEventPropertyRule();
        }
        catch (RuntimeException e)
        {
            if (log.isDebugEnabled())
            {
                log.debug("Error parsing property expression [" + propertyName + "]", e);
            }
            if (e.getCause() instanceof RecognitionException)
            {
                throw ExceptionConvertor.convertProperty((RecognitionException)e.getCause(), propertyName, true, g);
            }
            else
            {
                throw e;
            }
        }
        catch (RecognitionException e)
        {
            // Check for keywords and escape each, parse again
            String escapedPropertyName = escapeKeywords(tokens);

            CharStream inputEscaped;
            try
            {
                inputEscaped = new NoCaseSensitiveStream(new StringReader(escapedPropertyName));
            }
            catch (IOException ex)
            {
                throw new PropertyAccessException("IOException parsing property name '" + propertyName + '\'', ex);
            }

            EsperEPL2GrammarLexer lexEscaped = new EsperEPL2GrammarLexer(inputEscaped);
            CommonTokenStream tokensEscaped = new CommonTokenStream(lexEscaped);
            EsperEPL2GrammarParser gEscaped = new EsperEPL2GrammarParser(tokensEscaped);
            EsperEPL2GrammarParser.startEventPropertyRule_return rEscaped;

            try
            {
                rEscaped = gEscaped.startEventPropertyRule();
                return (Tree) rEscaped.getTree();
            }
            catch (Exception eEscaped)
            {
            }
View Full Code Here

Examples of com.espertech.esper.epl.generated.EsperEPL2GrammarParser

    private synchronized static String escapeKeywords(CommonTokenStream tokens) {

        if (keywordCache == null) {
            keywordCache = new HashSet<String>();
            Set<String> keywords = new EsperEPL2GrammarParser(tokens).getKeywords();
            for (String keyword : keywords) {
                if (keyword.charAt(0) == '\'' && keyword.charAt(keyword.length() - 1) == '\'') {
                    keywordCache.add(keyword.substring(1, keyword.length() - 1));
                }
            }
View Full Code Here

Examples of com.espertech.esper.epl.generated.EsperEPL2GrammarParser

            throw new EPException("IOException parsing expression '" + expression + '\'', ex);
        }

        EsperEPL2GrammarLexer lex = new EsperEPL2GrammarLexer(input);
        TokenRewriteStream tokens = new TokenRewriteStream(lex);
        EsperEPL2GrammarParser parser = new EsperEPL2GrammarParser(tokens);

        Tree tree;
        try {
            tree = parseRuleSelector.invokeParseRule(parser);
        } catch (RuntimeException e) {
View Full Code Here

Examples of com.espertech.esper.epl.generated.EsperEPL2GrammarParser

            throw new EPException("IOException parsing expression '" + expression + '\'', ex);
        }

        EsperEPL2GrammarLexer lex = new EsperEPL2GrammarLexer(input);
        CommonTokenStream tokens = new CommonTokenStream(lex);
        EsperEPL2GrammarParser parser = new EsperEPL2GrammarParser(tokens);

        Tree tree;
        try
        {
            tree = parseRuleSelector.invokeParseRule(parser);
View Full Code Here

Examples of com.espertech.esper.epl.generated.EsperEPL2GrammarParser

        }

        EsperEPL2GrammarLexer lex = newLexer(input);

        CommonTokenStream tokens = new CommonTokenStream(lex);
        EsperEPL2GrammarParser parser = ParseHelper.newParser(tokens);

        Tree tree;
        try {
            tree = parseRuleSelector.invokeParseRule(parser);
        }
View Full Code Here

Examples of com.espertech.esper.epl.generated.EsperEPL2GrammarParser

        lex.addErrorListener(Antlr4ErrorListener.INSTANCE);
        return lex;
    }

    public static EsperEPL2GrammarParser newParser(CommonTokenStream tokens) {
        EsperEPL2GrammarParser g = new EsperEPL2GrammarParser(tokens);
        g.removeErrorListeners();
        g.addErrorListener(Antlr4ErrorListener.INSTANCE);
        g.setErrorHandler(new Antlr4ErrorStrategy());
        return g;
    }
View Full Code Here

Examples of com.espertech.esper.epl.generated.EsperEPL2GrammarParser

        EsperEPL2GrammarLexer lex = ParseHelper.newLexer(input);
        CommonTokenStream tokens = new CommonTokenStream(lex);
        tokens.fill();

        EsperEPL2GrammarParser g = ParseHelper.newParser(tokens);
        EsperEPL2GrammarParser.StartEventPropertyRuleContext r;

        try {
             r = g.startEventPropertyRule();
        }
        catch (RecognitionException e) {
            return handleRecognitionEx(e, tokens, propertyName, g);
        }
        catch (RuntimeException e) {
View Full Code Here

Examples of com.espertech.esper.epl.generated.EsperEPL2GrammarParser

            throw new PropertyAccessException("IOException parsing property name '" + propertyName + '\'', ex);
        }

        EsperEPL2GrammarLexer lexEscaped = ParseHelper.newLexer(inputEscaped);
        CommonTokenStream tokensEscaped = new CommonTokenStream(lexEscaped);
        EsperEPL2GrammarParser gEscaped = ParseHelper.newParser(tokensEscaped);

        try {
            return gEscaped.startEventPropertyRule();
        }
        catch (Exception eEscaped)
        {
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.