Package org.drools.rule.builder.dialect.java.parser

Examples of org.drools.rule.builder.dialect.java.parser.JavaParser


    }

    @SuppressWarnings("unchecked")
    public JavaAnalysisResult analyzeBlock(final String expr,
                                       final BoundIdentifiers availableIdentifiers) throws RecognitionException {
        final JavaParser parser = parse( "{" + expr + "}" );
        parser.block();

        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setAnalyzedExpr(expr);
        result.setIdentifiers( new HashSet<String>( parser.getIdentifiers() ) );
        result.setLocalVariables( new HashMap<String,JavaLocalDeclarationDescr>() );
        if( parser.getRootBlockDescr().getInScopeLocalVars() != null ) {
            for( JavaLocalDeclarationDescr descr : parser.getRootBlockDescr().getInScopeLocalVars() ) {
                for( Iterator<?> identIt = descr.getIdentifiers().iterator(); identIt.hasNext(); ) {
                    JavaLocalDeclarationDescr.IdentifierDescr ident = (JavaLocalDeclarationDescr.IdentifierDescr) identIt.next();
                    result.addLocalVariable( ident.getIdentifier(), descr );
                }
            }
        }
        result.setBlockDescrs( parser.getRootBlockDescr() );

        return analyze( result,
                        availableIdentifiers );
    }
View Full Code Here


    private JavaParser parse(final String expr) {
        final CharStream charStream = new ANTLRStringStream(expr);
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        return new JavaParser( tokenStream );
    }
View Full Code Here

    public JavaAnalysisResult analyzeExpression(final String expr,
                                                final Map<String,Class<?>>[] availableIdentifiers) throws RecognitionException {
        final CharStream charStream = new ANTLRStringStream( expr );
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final JavaParser parser = new JavaParser( tokenStream );

        parser.conditionalOrExpression();
       
        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setIdentifiers( parser.getIdentifiers() );
        return analyze( result,
                        availableIdentifiers );
    }
View Full Code Here

    public JavaAnalysisResult analyzeBlock(final String expr,
                                       final Map<String,Class<?>>[] availableIdentifiers) throws RecognitionException {
        final CharStream charStream = new ANTLRStringStream( "{" + expr + "}" );
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final JavaParser parser = new JavaParser( tokenStream );

        parser.block();

        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setIdentifiers( parser.getIdentifiers() );
        result.setLocalVariables( new HashMap<String,JavaLocalDeclarationDescr>() );
        for( Iterator it = parser.getLocalDeclarations().iterator(); it.hasNext(); ) {
            JavaLocalDeclarationDescr descr = (JavaLocalDeclarationDescr) it.next();
            for( Iterator identIt = descr.getIdentifiers().iterator(); identIt.hasNext(); ) {
                JavaLocalDeclarationDescr.IdentifierDescr ident = (JavaLocalDeclarationDescr.IdentifierDescr) identIt.next();
                result.addLocalVariable( ident.getIdentifier(), descr );
            }
        }
        result.setBlockDescrs( parser.getBlockDescr() );

        return analyze( result,
                        availableIdentifiers );
    }
View Full Code Here

    public JavaAnalysisResult analyzeExpression(final String expr,
                                                final Map<String,Class<?>>[] availableIdentifiers) throws RecognitionException {
        final CharStream charStream = new ANTLRStringStream( expr );
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final JavaParser parser = new JavaParser( tokenStream );

        parser.conditionalOrExpression();
       
        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setIdentifiers( parser.getIdentifiers() );
        return analyze( result,
                        availableIdentifiers );
    }
View Full Code Here

    public JavaAnalysisResult analyzeBlock(final String expr,
                                       final Map<String,Class<?>>[] availableIdentifiers) throws RecognitionException {
        final CharStream charStream = new ANTLRStringStream( "{" + expr + "}" );
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final JavaParser parser = new JavaParser( tokenStream );

        parser.block();

        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setIdentifiers( parser.getIdentifiers() );
        result.setLocalVariables( new HashMap<String,JavaLocalDeclarationDescr>() );
        for( Iterator it = parser.getLocalDeclarations().iterator(); it.hasNext(); ) {
            JavaLocalDeclarationDescr descr = (JavaLocalDeclarationDescr) it.next();
            for( Iterator identIt = descr.getIdentifiers().iterator(); identIt.hasNext(); ) {
                JavaLocalDeclarationDescr.IdentifierDescr ident = (JavaLocalDeclarationDescr.IdentifierDescr) identIt.next();
                result.addLocalVariable( ident.getIdentifier(), descr );
            }
        }
        result.setBlockDescrs( parser.getBlockDescr() );

        return analyze( result,
                        availableIdentifiers );
    }
View Full Code Here

    public JavaAnalysisResult analyzeExpression(final String expr,
                                                final BoundIdentifiers availableIdentifiers) throws RecognitionException {
        final CharStream charStream = new ANTLRStringStream( expr );
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final JavaParser parser = new JavaParser( tokenStream );

        parser.conditionalOrExpression();
       
        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setIdentifiers(new HashSet<String>( parser.getIdentifiers() ) );
        return analyze( result,
                        availableIdentifiers );
    }
View Full Code Here

    public JavaAnalysisResult analyzeBlock(final String expr,
                                       final BoundIdentifiers availableIdentifiers) throws RecognitionException {
        final CharStream charStream = new ANTLRStringStream( "{" + expr + "}" );
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final JavaParser parser = new JavaParser( tokenStream );

        parser.block();

        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setIdentifiers( new HashSet<String>( parser.getIdentifiers() ) );
        result.setLocalVariables( new HashMap<String,JavaLocalDeclarationDescr>() );
        if( parser.getRootBlockDescr().getInScopeLocalVars() != null ) {
            for( JavaLocalDeclarationDescr descr : parser.getRootBlockDescr().getInScopeLocalVars() ) {
                for( Iterator<?> identIt = descr.getIdentifiers().iterator(); identIt.hasNext(); ) {
                    JavaLocalDeclarationDescr.IdentifierDescr ident = (JavaLocalDeclarationDescr.IdentifierDescr) identIt.next();
                    result.addLocalVariable( ident.getIdentifier(), descr );
                }
            }
        }
        result.setBlockDescrs( parser.getRootBlockDescr() );

        return analyze( result,
                        availableIdentifiers );
    }
View Full Code Here

    public JavaAnalysisResult analyzeExpression(final String expr,
                                            final Set[] availableIdentifiers) throws RecognitionException {
        final CharStream charStream = new ANTLRStringStream( expr );
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final JavaParser parser = new JavaParser( tokenStream );

        parser.conditionalOrExpression();
       
        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setIdentifiers( parser.getIdentifiers() );
        return analyze( result,
                        availableIdentifiers );
    }
View Full Code Here

    public JavaAnalysisResult analyzeBlock(final String expr,
                                       final Set[] availableIdentifiers) throws RecognitionException {
        final CharStream charStream = new ANTLRStringStream( "{" + expr + "}" );
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final JavaParser parser = new JavaParser( tokenStream );

        parser.block();

        JavaAnalysisResult result = new JavaAnalysisResult();
        result.setIdentifiers( parser.getIdentifiers() );
        result.setLocalVariables( new HashMap() );
        for( Iterator it = parser.getLocalDeclarations().iterator(); it.hasNext(); ) {
            JavaLocalDeclarationDescr descr = (JavaLocalDeclarationDescr) it.next();
            for( Iterator identIt = descr.getIdentifiers().iterator(); identIt.hasNext(); ) {
                JavaLocalDeclarationDescr.IdentifierDescr ident = (JavaLocalDeclarationDescr.IdentifierDescr) identIt.next();
                result.addLocalVariable( ident.getIdentifier(), descr );
            }
View Full Code Here

TOP

Related Classes of org.drools.rule.builder.dialect.java.parser.JavaParser

Copyright © 2018 www.massapicom. 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.