Package org.drools.compiler.lang.api

Examples of org.drools.compiler.lang.api.AccumulateImportDescrBuilder


    public ImportDescr importStatement(PackageDescrBuilder pkg) throws RecognitionException {
        try {
            String kwd;
            if (helper.validateLT(2, kwd = DroolsSoftKeywords.ACC) ||
                    helper.validateLT(2, kwd = DroolsSoftKeywords.ACCUMULATE)) {
                AccumulateImportDescrBuilder imp = helper.start(pkg,
                        AccumulateImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // import accumulate
                    match(input,
                            DRL6Lexer.ID,
                            kwd,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;
                   
                    // function name
                    Token id = match(input,
                            DRL6Lexer.ID,
                            null,
                            null,
                            DroolsEditorType.IDENTIFIER);
                    if (state.failed)
                        return null;
                    if (state.backtracking == 0) {
                        imp.target(target).functionName(id.getText());
                    }

                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(AccumulateImportDescrBuilder.class,
                            imp);
                }
            } else {
                ImportDescrBuilder imp = helper.start(pkg,
                        ImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    if (helper.validateIdentifierKey(kwd = DroolsSoftKeywords.FUNCTION) ||
                            helper.validateIdentifierKey(kwd = DroolsSoftKeywords.STATIC)) {
                        // function
                        match(input,
                                DRL6Lexer.ID,
                                kwd,
                                null,
                                DroolsEditorType.KEYWORD);
                        if (state.failed)
                            return null;
                    }

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;

                    if (input.LA(1) == DRL6Lexer.DOT && input.LA(2) == DRL6Lexer.STAR) {
                        // .*
                        match(input,
                                DRL6Lexer.DOT,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        match(input,
                                DRL6Lexer.STAR,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        target += ".*";
                    }
                    if (state.backtracking == 0)
                        imp.target(target);
                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(ImportDescrBuilder.class,
                            imp);
                }
            }
View Full Code Here


    public ImportDescr importStatement(PackageDescrBuilder pkg) throws RecognitionException {
        try {
            String kwd;
            if (helper.validateLT(2, kwd = DroolsSoftKeywords.ACC) ||
                    helper.validateLT(2, kwd = DroolsSoftKeywords.ACCUMULATE)) {
                AccumulateImportDescrBuilder imp = helper.start(pkg,
                        AccumulateImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // import accumulate
                    match(input,
                            DRL6Lexer.ID,
                            kwd,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;
                   
                    // function name
                    Token id = match(input,
                            DRL6Lexer.ID,
                            null,
                            null,
                            DroolsEditorType.IDENTIFIER);
                    if (state.failed)
                        return null;
                    if (state.backtracking == 0) {
                        imp.target(target).functionName(id.getText());
                    }

                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(AccumulateImportDescrBuilder.class,
                            imp);
                }
            } else {
                ImportDescrBuilder imp = helper.start(pkg,
                        ImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    if (helper.validateIdentifierKey(kwd = DroolsSoftKeywords.FUNCTION) ||
                            helper.validateIdentifierKey(kwd = DroolsSoftKeywords.STATIC)) {
                        // function
                        match(input,
                                DRL6Lexer.ID,
                                kwd,
                                null,
                                DroolsEditorType.KEYWORD);
                        if (state.failed)
                            return null;
                    }

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;

                    if (input.LA(1) == DRL6Lexer.DOT && input.LA(2) == DRL6Lexer.STAR) {
                        // .*
                        match(input,
                                DRL6Lexer.DOT,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        match(input,
                                DRL6Lexer.STAR,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        target += ".*";
                    }
                    if (state.backtracking == 0)
                        imp.target(target);
                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(ImportDescrBuilder.class,
                            imp);
                }
            }
View Full Code Here

    public ImportDescr importStatement(PackageDescrBuilder pkg) throws RecognitionException {
        try {
            String kwd;
            if (helper.validateLT(2, kwd = DroolsSoftKeywords.ACC) ||
                    helper.validateLT(2, kwd = DroolsSoftKeywords.ACCUMULATE)) {
                AccumulateImportDescrBuilder imp = helper.start(pkg,
                        AccumulateImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // import accumulate
                    match(input,
                            DRL6Lexer.ID,
                            kwd,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;
                   
                    // function name
                    Token id = match(input,
                            DRL6Lexer.ID,
                            null,
                            null,
                            DroolsEditorType.IDENTIFIER);
                    if (state.failed)
                        return null;
                    if (state.backtracking == 0) {
                        imp.target(target).functionName(id.getText());
                    }

                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(AccumulateImportDescrBuilder.class,
                            imp);
                }
            } else {
                ImportDescrBuilder imp = helper.start(pkg,
                        ImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    if (helper.validateIdentifierKey(kwd = DroolsSoftKeywords.FUNCTION) ||
                            helper.validateIdentifierKey(kwd = DroolsSoftKeywords.STATIC)) {
                        // function
                        match(input,
                                DRL6Lexer.ID,
                                kwd,
                                null,
                                DroolsEditorType.KEYWORD);
                        if (state.failed)
                            return null;
                    }

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;

                    if (input.LA(1) == DRL6Lexer.DOT && input.LA(2) == DRL6Lexer.STAR) {
                        // .*
                        match(input,
                                DRL6Lexer.DOT,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        match(input,
                                DRL6Lexer.STAR,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        target += ".*";
                    }
                    if (state.backtracking == 0)
                        imp.target(target);
                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(ImportDescrBuilder.class,
                            imp);
                }
            }
View Full Code Here

        descr.addFunctionImport( (FunctionImportDescr) initDescr(impl) );
        return impl;
    }

    public AccumulateImportDescrBuilder newAccumulateImport() {
        AccumulateImportDescrBuilder impl = new AccumulateImportDescrBuilderImpl( this );
        descr.addAccumulateImport( (AccumulateImportDescr) initDescr(impl) );
        return impl;
    }
View Full Code Here

                pushParaphrases( DroolsParaphraseTypes.IMPORT );
                beginSentence( DroolsSentenceType.IMPORT_STATEMENT );
                setStart( imp );
                return (T) imp;
            } else if ( AccumulateImportDescrBuilder.class.isAssignableFrom( clazz ) ) {
                AccumulateImportDescrBuilder imp = ctxBuilder == null ?
                          DescrFactory.newPackage().newAccumulateImport() :
                          ((PackageDescrBuilder) ctxBuilder).newAccumulateImport();
                pushParaphrases( DroolsParaphraseTypes.ACCUMULATE_IMPORT );
                beginSentence( DroolsSentenceType.ACCUMULATE_IMPORT_STATEMENT );
                setStart( imp );
View Full Code Here

        descr.addFunctionImport( (FunctionImportDescr) initDescr(impl) );
        return impl;
    }

    public AccumulateImportDescrBuilder newAccumulateImport() {
        AccumulateImportDescrBuilder impl = new AccumulateImportDescrBuilderImpl( this );
        descr.addAccumulateImport( (AccumulateImportDescr) initDescr(impl) );
        return impl;
    }
View Full Code Here

    public ImportDescr importStatement(PackageDescrBuilder pkg) throws RecognitionException {
        try {
            String kwd;
            if (helper.validateLT(2, kwd = DroolsSoftKeywords.ACC) ||
                    helper.validateLT(2, kwd = DroolsSoftKeywords.ACCUMULATE)) {
                AccumulateImportDescrBuilder imp = helper.start(pkg,
                        AccumulateImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // import accumulate
                    match(input,
                            DRL6Lexer.ID,
                            kwd,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;
                   
                    // function name
                    Token id = match(input,
                            DRL6Lexer.ID,
                            null,
                            null,
                            DroolsEditorType.IDENTIFIER);
                    if (state.failed)
                        return null;
                    if (state.backtracking == 0) {
                        imp.target(target).functionName(id.getText());
                    }

                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(AccumulateImportDescrBuilder.class,
                            imp);
                }
            } else {
                ImportDescrBuilder imp = helper.start(pkg,
                        ImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    if (helper.validateIdentifierKey(kwd = DroolsSoftKeywords.FUNCTION) ||
                            helper.validateIdentifierKey(kwd = DroolsSoftKeywords.STATIC)) {
                        // function
                        match(input,
                                DRL6Lexer.ID,
                                kwd,
                                null,
                                DroolsEditorType.KEYWORD);
                        if (state.failed)
                            return null;
                    }

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;

                    if (input.LA(1) == DRL6Lexer.DOT && input.LA(2) == DRL6Lexer.STAR) {
                        // .*
                        match(input,
                                DRL6Lexer.DOT,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        match(input,
                                DRL6Lexer.STAR,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        target += ".*";
                    }
                    if (state.backtracking == 0)
                        imp.target(target);
                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(ImportDescrBuilder.class,
                            imp);
                }
            }
View Full Code Here

    public ImportDescr importStatement(PackageDescrBuilder pkg) throws RecognitionException {
        try {
            String kwd;
            if (helper.validateLT(2, kwd = DroolsSoftKeywords.ACC) ||
                    helper.validateLT(2, kwd = DroolsSoftKeywords.ACCUMULATE)) {
                AccumulateImportDescrBuilder imp = helper.start(pkg,
                        AccumulateImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // import accumulate
                    match(input,
                            DRL6Lexer.ID,
                            kwd,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;
                   
                    // function name
                    Token id = match(input,
                            DRL6Lexer.ID,
                            null,
                            null,
                            DroolsEditorType.IDENTIFIER);
                    if (state.failed)
                        return null;
                    if (state.backtracking == 0) {
                        imp.target(target).functionName(id.getText());
                    }

                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(AccumulateImportDescrBuilder.class,
                            imp);
                }
            } else {
                ImportDescrBuilder imp = helper.start(pkg,
                        ImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    if (helper.validateIdentifierKey(kwd = DroolsSoftKeywords.FUNCTION) ||
                            helper.validateIdentifierKey(kwd = DroolsSoftKeywords.STATIC)) {
                        // function
                        match(input,
                                DRL6Lexer.ID,
                                kwd,
                                null,
                                DroolsEditorType.KEYWORD);
                        if (state.failed)
                            return null;
                    }

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;

                    if (input.LA(1) == DRL6Lexer.DOT && input.LA(2) == DRL6Lexer.STAR) {
                        // .*
                        match(input,
                                DRL6Lexer.DOT,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        match(input,
                                DRL6Lexer.STAR,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        target += ".*";
                    }
                    if (state.backtracking == 0)
                        imp.target(target);
                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(ImportDescrBuilder.class,
                            imp);
                }
            }
View Full Code Here

                pushParaphrases( DroolsParaphraseTypes.IMPORT );
                beginSentence( DroolsSentenceType.IMPORT_STATEMENT );
                setStart( imp );
                return (T) imp;
            } else if ( AccumulateImportDescrBuilder.class.isAssignableFrom( clazz ) ) {
                AccumulateImportDescrBuilder imp = ctxBuilder == null ?
                          DescrFactory.newPackage().newAccumulateImport() :
                          ((PackageDescrBuilder) ctxBuilder).newAccumulateImport();
                pushParaphrases( DroolsParaphraseTypes.ACCUMULATE_IMPORT );
                beginSentence( DroolsSentenceType.ACCUMULATE_IMPORT_STATEMENT );
                setStart( imp );
View Full Code Here

                pushParaphrases( DroolsParaphraseTypes.IMPORT );
                beginSentence( DroolsSentenceType.IMPORT_STATEMENT );
                setStart( imp );
                return (T) imp;
            } else if ( AccumulateImportDescrBuilder.class.isAssignableFrom( clazz ) ) {
                AccumulateImportDescrBuilder imp = ctxBuilder == null ?
                          DescrFactory.newPackage().newAccumulateImport() :
                          ((PackageDescrBuilder) ctxBuilder).newAccumulateImport();
                pushParaphrases( DroolsParaphraseTypes.ACCUMULATE_IMPORT );
                beginSentence( DroolsSentenceType.ACCUMULATE_IMPORT_STATEMENT );
                setStart( imp );
View Full Code Here

TOP

Related Classes of org.drools.compiler.lang.api.AccumulateImportDescrBuilder

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.