Search in sources :

Example 11 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class DRL6Parser method lhsAccumulate.

/**
 * lhsAccumulate := (ACCUMULATE|ACC) LEFT_PAREN lhsAnd (COMMA|SEMICOLON)
 *                      accumulateFunctionBinding (COMMA accumulateFunctionBinding)*
 *                      (SEMICOLON constraints)?
 *                  RIGHT_PAREN SEMICOLON?
 *
 * @param ce
 * @return
 * @throws org.antlr.runtime.RecognitionException
 */
private BaseDescr lhsAccumulate(PatternContainerDescrBuilder<?, ?> ce) throws RecognitionException {
    PatternDescrBuilder<?> pattern = null;
    BaseDescr result = null;
    pattern = helper.start((DescrBuilder<?, ?>) ce, PatternDescrBuilder.class, null);
    if (pattern != null) {
        result = pattern.getDescr();
    }
    try {
        if (state.backtracking == 0) {
            pattern.type("Object");
            pattern.isQuery(false);
        // might have to add the implicit bindings as well
        }
        AccumulateDescrBuilder<?> accumulate = helper.start(pattern, AccumulateDescrBuilder.class, null);
        try {
            if (helper.validateIdentifierKey(DroolsSoftKeywords.ACCUMULATE)) {
                match(input, DRL6Lexer.ID, DroolsSoftKeywords.ACCUMULATE, null, DroolsEditorType.KEYWORD);
            } else {
                // might be using the short mnemonic
                match(input, DRL6Lexer.ID, DroolsSoftKeywords.ACC, null, DroolsEditorType.KEYWORD);
            }
            if (state.failed)
                return null;
            if (state.backtracking == 0 && input.LA(1) != DRL6Lexer.EOF) {
                helper.emit(Location.LOCATION_LHS_FROM_ACCUMULATE);
            }
            match(input, DRL6Lexer.LEFT_PAREN, null, null, DroolsEditorType.SYMBOL);
            if (state.failed)
                return null;
            CEDescrBuilder<?, AndDescr> source = accumulate.source();
            try {
                helper.start(source, CEDescrBuilder.class, null);
                lhsAnd(source, false);
                if (state.failed)
                    return null;
                if (source.getDescr() != null && source.getDescr() instanceof ConditionalElementDescr) {
                    ConditionalElementDescr root = (ConditionalElementDescr) source.getDescr();
                    BaseDescr[] descrs = root.getDescrs().toArray(new BaseDescr[root.getDescrs().size()]);
                    root.getDescrs().clear();
                    for (int i = 0; i < descrs.length; i++) {
                        root.addOrMerge(descrs[i]);
                    }
                }
            } finally {
                helper.end(CEDescrBuilder.class, source);
            }
            if (input.LA(1) == DRL6Lexer.COMMA) {
                match(input, DRL6Lexer.COMMA, null, null, DroolsEditorType.SYMBOL);
                if (state.failed)
                    return null;
            } else if (input.LA(-1) != DRL6Lexer.SEMICOLON) {
                // lhsUnary will consume an optional SEMICOLON, so we need to check if it was consumed already
                // or if we must fail consuming it now
                match(input, DRL6Lexer.SEMICOLON, null, null, DroolsEditorType.SYMBOL);
                if (state.failed)
                    return null;
            }
            // accumulate functions
            accumulateFunctionBinding(accumulate);
            if (state.failed)
                return null;
            while (input.LA(1) == DRL6Lexer.COMMA) {
                match(input, DRL6Lexer.COMMA, null, null, DroolsEditorType.SYMBOL);
                if (state.failed)
                    return null;
                accumulateFunctionBinding(accumulate);
                if (state.failed)
                    return null;
            }
            if (input.LA(1) == DRL6Lexer.SEMICOLON) {
                match(input, DRL6Lexer.SEMICOLON, null, null, DroolsEditorType.SYMBOL);
                if (state.failed)
                    return null;
                constraints(pattern);
            }
            match(input, DRL6Lexer.RIGHT_PAREN, null, null, DroolsEditorType.SYMBOL);
            if (state.failed)
                return null;
        } finally {
            helper.end(AccumulateDescrBuilder.class, accumulate);
            if (state.backtracking == 0 && input.LA(1) != DRL6Lexer.EOF) {
                helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION);
            }
        }
    } finally {
        helper.end(PatternDescrBuilder.class, pattern);
    }
    if (input.LA(1) == DRL6Lexer.SEMICOLON) {
        match(input, DRL6Lexer.SEMICOLON, null, null, DroolsEditorType.SYMBOL);
        if (state.failed)
            return null;
    }
    return result;
}
Also used : PatternDescrBuilder(org.drools.compiler.lang.api.PatternDescrBuilder) AndDescr(org.drools.compiler.lang.descr.AndDescr) BaseDescr(org.drools.compiler.lang.descr.BaseDescr) DescrBuilder(org.drools.compiler.lang.api.DescrBuilder) AccumulateImportDescrBuilder(org.drools.compiler.lang.api.AccumulateImportDescrBuilder) AccumulateDescrBuilder(org.drools.compiler.lang.api.AccumulateDescrBuilder) EnumDeclarationDescrBuilder(org.drools.compiler.lang.api.EnumDeclarationDescrBuilder) PatternContainerDescrBuilder(org.drools.compiler.lang.api.PatternContainerDescrBuilder) WindowDeclarationDescrBuilder(org.drools.compiler.lang.api.WindowDeclarationDescrBuilder) ForallDescrBuilder(org.drools.compiler.lang.api.ForallDescrBuilder) TypeDeclarationDescrBuilder(org.drools.compiler.lang.api.TypeDeclarationDescrBuilder) PackageDescrBuilder(org.drools.compiler.lang.api.PackageDescrBuilder) CEDescrBuilder(org.drools.compiler.lang.api.CEDescrBuilder) DeclareDescrBuilder(org.drools.compiler.lang.api.DeclareDescrBuilder) FunctionDescrBuilder(org.drools.compiler.lang.api.FunctionDescrBuilder) RuleDescrBuilder(org.drools.compiler.lang.api.RuleDescrBuilder) EntryPointDeclarationDescrBuilder(org.drools.compiler.lang.api.EntryPointDeclarationDescrBuilder) EnumLiteralDescrBuilder(org.drools.compiler.lang.api.EnumLiteralDescrBuilder) QueryDescrBuilder(org.drools.compiler.lang.api.QueryDescrBuilder) AnnotatedDescrBuilder(org.drools.compiler.lang.api.AnnotatedDescrBuilder) PatternDescrBuilder(org.drools.compiler.lang.api.PatternDescrBuilder) AnnotationDescrBuilder(org.drools.compiler.lang.api.AnnotationDescrBuilder) ImportDescrBuilder(org.drools.compiler.lang.api.ImportDescrBuilder) CollectDescrBuilder(org.drools.compiler.lang.api.CollectDescrBuilder) AttributeDescrBuilder(org.drools.compiler.lang.api.AttributeDescrBuilder) EvalDescrBuilder(org.drools.compiler.lang.api.EvalDescrBuilder) ConditionalBranchDescrBuilder(org.drools.compiler.lang.api.ConditionalBranchDescrBuilder) UnitDescrBuilder(org.drools.compiler.lang.api.UnitDescrBuilder) NamedConsequenceDescrBuilder(org.drools.compiler.lang.api.NamedConsequenceDescrBuilder) FieldDescrBuilder(org.drools.compiler.lang.api.FieldDescrBuilder) BehaviorDescrBuilder(org.drools.compiler.lang.api.BehaviorDescrBuilder) GlobalDescrBuilder(org.drools.compiler.lang.api.GlobalDescrBuilder) ConditionalElementDescr(org.drools.compiler.lang.descr.ConditionalElementDescr)

Example 12 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class DRL6Parser method lhsOr.

/**
 * lhsOr := LEFT_PAREN OR lhsAnd+ RIGHT_PAREN
 *        | lhsAnd (OR lhsAnd)*
 *
 * @param ce
 * @param allowOr
 * @throws org.antlr.runtime.RecognitionException
 */
private BaseDescr lhsOr(final CEDescrBuilder<?, ?> ce, boolean allowOr) throws RecognitionException {
    BaseDescr result = null;
    if (allowOr && input.LA(1) == DRL6Lexer.LEFT_PAREN && helper.validateLT(2, DroolsSoftKeywords.OR)) {
        // prefixed OR
        CEDescrBuilder<?, OrDescr> or = null;
        if (state.backtracking == 0) {
            or = ce.or();
            result = or.getDescr();
            helper.start(or, CEDescrBuilder.class, null);
        }
        try {
            match(input, DRL6Lexer.LEFT_PAREN, null, null, DroolsEditorType.SYMBOL);
            if (state.failed)
                return null;
            match(input, DRL6Lexer.ID, DroolsSoftKeywords.OR, null, DroolsEditorType.KEYWORD);
            if (state.failed)
                return null;
            while (input.LA(1) == DRL6Lexer.AT) {
                // annotation*
                annotation(or);
                if (state.failed)
                    return null;
            }
            if (state.backtracking == 0) {
                helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR);
            }
            while (input.LA(1) != DRL6Lexer.RIGHT_PAREN) {
                lhsAnd(or, allowOr);
                if (state.failed)
                    return null;
            }
            match(input, DRL6Lexer.RIGHT_PAREN, null, null, DroolsEditorType.SYMBOL);
            if (state.failed)
                return null;
        } finally {
            if (state.backtracking == 0) {
                helper.end(CEDescrBuilder.class, or);
            }
        }
    } else {
        // infix OR
        // create an OR anyway, as if it is not an OR we remove it later
        CEDescrBuilder<?, OrDescr> or = null;
        if (state.backtracking == 0) {
            or = ce.or();
            result = or.getDescr();
            helper.start(or, CEDescrBuilder.class, null);
        }
        try {
            lhsAnd(or, allowOr);
            if (state.failed)
                return null;
            if (allowOr && (helper.validateIdentifierKey(DroolsSoftKeywords.OR) || input.LA(1) == DRL6Lexer.DOUBLE_PIPE)) {
                while (helper.validateIdentifierKey(DroolsSoftKeywords.OR) || input.LA(1) == DRL6Lexer.DOUBLE_PIPE) {
                    if (input.LA(1) == DRL6Lexer.DOUBLE_PIPE) {
                        match(input, DRL6Lexer.DOUBLE_PIPE, null, null, DroolsEditorType.SYMBOL);
                    } else {
                        match(input, DRL6Lexer.ID, DroolsSoftKeywords.OR, null, DroolsEditorType.KEYWORD);
                    }
                    if (state.failed)
                        return null;
                    while (input.LA(1) == DRL6Lexer.AT) {
                        // annotation*
                        annotation(or);
                        if (state.failed)
                            return null;
                    }
                    if (state.backtracking == 0) {
                        helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR);
                    }
                    lhsAnd(or, allowOr);
                    if (state.failed)
                        return null;
                }
            } else if (allowOr) {
                if (state.backtracking == 0) {
                    // if no OR present, then remove it and add children to parent
                    ((ConditionalElementDescr) ce.getDescr()).getDescrs().remove(or.getDescr());
                    for (BaseDescr base : or.getDescr().getDescrs()) {
                        ((ConditionalElementDescr) ce.getDescr()).addDescr(base);
                    }
                    result = ce.getDescr();
                }
            }
        } finally {
            if (state.backtracking == 0) {
                helper.end(CEDescrBuilder.class, or);
            }
        }
    }
    return result;
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) OrDescr(org.drools.compiler.lang.descr.OrDescr) ConditionalElementDescr(org.drools.compiler.lang.descr.ConditionalElementDescr)

Example 13 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class DRL6Parser method lhsPatternBind.

/**
 * lhsPatternBind := label?
 *                ( LEFT_PAREN lhsPattern (OR lhsPattern)* RIGHT_PAREN
 *                | lhsPattern )
 *
 * @param ce
 * @return
 * @throws org.antlr.runtime.RecognitionException
 */
@SuppressWarnings("unchecked")
private BaseDescr lhsPatternBind(PatternContainerDescrBuilder<?, ?> ce, final boolean allowOr) throws RecognitionException {
    PatternDescrBuilder<?> pattern = null;
    CEDescrBuilder<?, OrDescr> or = null;
    BaseDescr result = null;
    Token first = input.LT(1);
    pattern = helper.start((DescrBuilder<?, ?>) ce, PatternDescrBuilder.class, null);
    if (pattern != null) {
        result = pattern.getDescr();
    }
    String label = null;
    boolean isUnification = false;
    if (input.LA(1) == DRL6Lexer.ID && input.LA(2) == DRL6Lexer.COLON && !helper.validateCEKeyword(1)) {
        label = label(DroolsEditorType.IDENTIFIER_PATTERN);
        if (state.failed)
            return null;
    } else if (input.LA(1) == DRL6Lexer.ID && input.LA(2) == DRL6Lexer.UNIFY && !helper.validateCEKeyword(1)) {
        label = unif(DroolsEditorType.IDENTIFIER_PATTERN);
        if (state.failed)
            return null;
        isUnification = true;
    }
    if (input.LA(1) == DRL6Lexer.LEFT_PAREN) {
        try {
            match(input, DRL6Lexer.LEFT_PAREN, null, null, DroolsEditorType.SYMBOL);
            if (state.failed)
                return null;
            if (helper.validateCEKeyword(1)) {
                failMismatchedTokenException();
                // in case it is backtracking
                return null;
            }
            lhsPattern(pattern, label, isUnification);
            if (state.failed)
                return null;
            if (allowOr && helper.validateIdentifierKey(DroolsSoftKeywords.OR) && ce instanceof CEDescrBuilder) {
                if (state.backtracking == 0) {
                    // this is necessary because of the crappy bind with multi-pattern OR syntax
                    or = ((CEDescrBuilder<DescrBuilder<?, ?>, OrDescr>) ce).or();
                    result = or.getDescr();
                    helper.end(PatternDescrBuilder.class, pattern);
                    helper.start(or, CEDescrBuilder.class, null);
                    // adjust real or starting token:
                    helper.setStart(or, first);
                    // remove original pattern from the parent CE child list:
                    ((ConditionalElementDescr) ce.getDescr()).getDescrs().remove(pattern.getDescr());
                    // add pattern to the OR instead
                    or.getDescr().addDescr(pattern.getDescr());
                }
                while (helper.validateIdentifierKey(DroolsSoftKeywords.OR)) {
                    match(input, DRL6Lexer.ID, DroolsSoftKeywords.OR, null, DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;
                    pattern = helper.start(or, PatternDescrBuilder.class, null);
                    // new pattern, same binding
                    lhsPattern(pattern, label, isUnification);
                    if (state.failed)
                        return null;
                    helper.end(PatternDescrBuilder.class, pattern);
                }
            }
            match(input, DRL6Lexer.RIGHT_PAREN, null, null, DroolsEditorType.SYMBOL);
            if (state.failed)
                return null;
        } finally {
            if (or != null) {
                helper.end(CEDescrBuilder.class, or);
            } else {
                helper.end(PatternDescrBuilder.class, pattern);
            }
        }
    } else {
        try {
            lhsPattern(pattern, label, isUnification);
            if (state.failed)
                return null;
        } finally {
            helper.end(PatternDescrBuilder.class, pattern);
        }
    }
    return result;
}
Also used : CEDescrBuilder(org.drools.compiler.lang.api.CEDescrBuilder) PatternDescrBuilder(org.drools.compiler.lang.api.PatternDescrBuilder) BaseDescr(org.drools.compiler.lang.descr.BaseDescr) Token(org.antlr.runtime.Token) CommonToken(org.antlr.runtime.CommonToken) DescrBuilder(org.drools.compiler.lang.api.DescrBuilder) AccumulateImportDescrBuilder(org.drools.compiler.lang.api.AccumulateImportDescrBuilder) AccumulateDescrBuilder(org.drools.compiler.lang.api.AccumulateDescrBuilder) EnumDeclarationDescrBuilder(org.drools.compiler.lang.api.EnumDeclarationDescrBuilder) PatternContainerDescrBuilder(org.drools.compiler.lang.api.PatternContainerDescrBuilder) WindowDeclarationDescrBuilder(org.drools.compiler.lang.api.WindowDeclarationDescrBuilder) ForallDescrBuilder(org.drools.compiler.lang.api.ForallDescrBuilder) TypeDeclarationDescrBuilder(org.drools.compiler.lang.api.TypeDeclarationDescrBuilder) PackageDescrBuilder(org.drools.compiler.lang.api.PackageDescrBuilder) CEDescrBuilder(org.drools.compiler.lang.api.CEDescrBuilder) DeclareDescrBuilder(org.drools.compiler.lang.api.DeclareDescrBuilder) FunctionDescrBuilder(org.drools.compiler.lang.api.FunctionDescrBuilder) RuleDescrBuilder(org.drools.compiler.lang.api.RuleDescrBuilder) EntryPointDeclarationDescrBuilder(org.drools.compiler.lang.api.EntryPointDeclarationDescrBuilder) EnumLiteralDescrBuilder(org.drools.compiler.lang.api.EnumLiteralDescrBuilder) QueryDescrBuilder(org.drools.compiler.lang.api.QueryDescrBuilder) AnnotatedDescrBuilder(org.drools.compiler.lang.api.AnnotatedDescrBuilder) PatternDescrBuilder(org.drools.compiler.lang.api.PatternDescrBuilder) AnnotationDescrBuilder(org.drools.compiler.lang.api.AnnotationDescrBuilder) ImportDescrBuilder(org.drools.compiler.lang.api.ImportDescrBuilder) CollectDescrBuilder(org.drools.compiler.lang.api.CollectDescrBuilder) AttributeDescrBuilder(org.drools.compiler.lang.api.AttributeDescrBuilder) EvalDescrBuilder(org.drools.compiler.lang.api.EvalDescrBuilder) ConditionalBranchDescrBuilder(org.drools.compiler.lang.api.ConditionalBranchDescrBuilder) UnitDescrBuilder(org.drools.compiler.lang.api.UnitDescrBuilder) NamedConsequenceDescrBuilder(org.drools.compiler.lang.api.NamedConsequenceDescrBuilder) FieldDescrBuilder(org.drools.compiler.lang.api.FieldDescrBuilder) BehaviorDescrBuilder(org.drools.compiler.lang.api.BehaviorDescrBuilder) GlobalDescrBuilder(org.drools.compiler.lang.api.GlobalDescrBuilder) OrDescr(org.drools.compiler.lang.descr.OrDescr)

Example 14 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class DRL6Parser method lhsExpression.

/**
 * lhsExpression := lhsOr*
 *
 * @param lhs
 * @throws org.antlr.runtime.RecognitionException
 */
private void lhsExpression(CEDescrBuilder<?, AndDescr> lhs) throws RecognitionException {
    helper.start(lhs, CEDescrBuilder.class, null);
    if (state.backtracking == 0) {
        helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION);
    }
    try {
        while (input.LA(1) != DRL6Lexer.EOF && !helper.validateIdentifierKey(DroolsSoftKeywords.THEN) && !helper.validateIdentifierKey(DroolsSoftKeywords.END)) {
            if (state.backtracking == 0) {
                helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION);
            }
            lhsOr(lhs, true);
            if (lhs.getDescr() != null && lhs.getDescr() instanceof ConditionalElementDescr) {
                ConditionalElementDescr root = (ConditionalElementDescr) lhs.getDescr();
                BaseDescr[] descrs = root.getDescrs().toArray(new BaseDescr[root.getDescrs().size()]);
                root.getDescrs().clear();
                for (int i = 0; i < descrs.length; i++) {
                    root.addOrMerge(descrs[i]);
                }
            }
            if (state.failed)
                return;
        }
    } finally {
        helper.end(CEDescrBuilder.class, lhs);
    }
}
Also used : BaseDescr(org.drools.compiler.lang.descr.BaseDescr) ConditionalElementDescr(org.drools.compiler.lang.descr.ConditionalElementDescr)

Example 15 with BaseDescr

use of org.drools.compiler.lang.descr.BaseDescr in project drools by kiegroup.

the class DRL6StrictParser method lhsAccumulate.

/**
 * lhsAccumulate := (ACCUMULATE|ACC) LEFT_PAREN lhsAnd (COMMA|SEMICOLON)
 *                      accumulateFunctionBinding (COMMA accumulateFunctionBinding)*
 *                      (SEMICOLON constraints)?
 *                  RIGHT_PAREN SEMICOLON?
 *
 * @param ce
 * @return
 * @throws org.antlr.runtime.RecognitionException
 */
private BaseDescr lhsAccumulate(PatternContainerDescrBuilder<?, ?> ce) throws RecognitionException {
    PatternDescrBuilder<?> pattern = null;
    BaseDescr result = null;
    pattern = helper.start((DescrBuilder<?, ?>) ce, PatternDescrBuilder.class, null);
    if (pattern != null) {
        result = pattern.getDescr();
    }
    try {
        if (state.backtracking == 0) {
            pattern.type("Object[]");
            pattern.isQuery(false);
        // might have to add the implicit bindings as well
        }
        AccumulateDescrBuilder<?> accumulate = helper.start(pattern, AccumulateDescrBuilder.class, null);
        try {
            if (helper.validateIdentifierKey(DroolsSoftKeywords.ACCUMULATE)) {
                match(input, DRL6Lexer.ID, DroolsSoftKeywords.ACCUMULATE, null, DroolsEditorType.KEYWORD);
            } else {
                // might be using the short mnemonic
                match(input, DRL6Lexer.ID, DroolsSoftKeywords.ACC, null, DroolsEditorType.KEYWORD);
            }
            if (state.failed)
                return null;
            if (state.backtracking == 0 && input.LA(1) != DRL6Lexer.EOF) {
                helper.emit(Location.LOCATION_LHS_FROM_ACCUMULATE);
            }
            match(input, DRL6Lexer.LEFT_PAREN, null, null, DroolsEditorType.SYMBOL);
            if (state.failed)
                return null;
            CEDescrBuilder<?, AndDescr> source = accumulate.source();
            try {
                helper.start(source, CEDescrBuilder.class, null);
                lhsAnd(source, false);
                if (state.failed)
                    return null;
                if (source.getDescr() != null && source.getDescr() instanceof ConditionalElementDescr) {
                    ConditionalElementDescr root = (ConditionalElementDescr) source.getDescr();
                    BaseDescr[] descrs = root.getDescrs().toArray(new BaseDescr[root.getDescrs().size()]);
                    root.getDescrs().clear();
                    for (int i = 0; i < descrs.length; i++) {
                        root.addOrMerge(descrs[i]);
                    }
                }
            } finally {
                helper.end(CEDescrBuilder.class, source);
            }
            if (input.LA(1) == DRL6Lexer.COMMA) {
                match(input, DRL6Lexer.COMMA, null, null, DroolsEditorType.SYMBOL);
                if (state.failed)
                    return null;
            } else if (input.LA(-1) != DRL6Lexer.SEMICOLON) {
                // lhsUnary will consume an optional SEMICOLON, so we need to check if it was consumed already
                // or if we must fail consuming it now
                match(input, DRL6Lexer.SEMICOLON, null, null, DroolsEditorType.SYMBOL);
                if (state.failed)
                    return null;
            }
            // accumulate functions
            accumulateFunctionBinding(accumulate);
            if (state.failed)
                return null;
            while (input.LA(1) == DRL6Lexer.COMMA) {
                match(input, DRL6Lexer.COMMA, null, null, DroolsEditorType.SYMBOL);
                if (state.failed)
                    return null;
                accumulateFunctionBinding(accumulate);
                if (state.failed)
                    return null;
            }
            if (input.LA(1) == DRL6Lexer.SEMICOLON) {
                match(input, DRL6Lexer.SEMICOLON, null, null, DroolsEditorType.SYMBOL);
                if (state.failed)
                    return null;
                constraints(pattern);
            }
            match(input, DRL6Lexer.RIGHT_PAREN, null, null, DroolsEditorType.SYMBOL);
            if (state.failed)
                return null;
        } finally {
            helper.end(AccumulateDescrBuilder.class, accumulate);
            if (state.backtracking == 0 && input.LA(1) != DRL6Lexer.EOF) {
                helper.emit(Location.LOCATION_LHS_BEGIN_OF_CONDITION);
            }
        }
    } finally {
        helper.end(PatternDescrBuilder.class, pattern);
    }
    if (input.LA(1) == DRL6Lexer.SEMICOLON) {
        match(input, DRL6Lexer.SEMICOLON, null, null, DroolsEditorType.SYMBOL);
        if (state.failed)
            return null;
    }
    return result;
}
Also used : PatternDescrBuilder(org.drools.compiler.lang.api.PatternDescrBuilder) AndDescr(org.drools.compiler.lang.descr.AndDescr) BaseDescr(org.drools.compiler.lang.descr.BaseDescr) AnnotatedBaseDescr(org.drools.compiler.lang.descr.AnnotatedBaseDescr) DescrBuilder(org.drools.compiler.lang.api.DescrBuilder) AccumulateImportDescrBuilder(org.drools.compiler.lang.api.AccumulateImportDescrBuilder) AccumulateDescrBuilder(org.drools.compiler.lang.api.AccumulateDescrBuilder) EnumDeclarationDescrBuilder(org.drools.compiler.lang.api.EnumDeclarationDescrBuilder) PatternContainerDescrBuilder(org.drools.compiler.lang.api.PatternContainerDescrBuilder) WindowDeclarationDescrBuilder(org.drools.compiler.lang.api.WindowDeclarationDescrBuilder) ForallDescrBuilder(org.drools.compiler.lang.api.ForallDescrBuilder) TypeDeclarationDescrBuilder(org.drools.compiler.lang.api.TypeDeclarationDescrBuilder) PackageDescrBuilder(org.drools.compiler.lang.api.PackageDescrBuilder) CEDescrBuilder(org.drools.compiler.lang.api.CEDescrBuilder) DeclareDescrBuilder(org.drools.compiler.lang.api.DeclareDescrBuilder) FunctionDescrBuilder(org.drools.compiler.lang.api.FunctionDescrBuilder) RuleDescrBuilder(org.drools.compiler.lang.api.RuleDescrBuilder) EntryPointDeclarationDescrBuilder(org.drools.compiler.lang.api.EntryPointDeclarationDescrBuilder) EnumLiteralDescrBuilder(org.drools.compiler.lang.api.EnumLiteralDescrBuilder) QueryDescrBuilder(org.drools.compiler.lang.api.QueryDescrBuilder) AnnotatedDescrBuilder(org.drools.compiler.lang.api.AnnotatedDescrBuilder) PatternDescrBuilder(org.drools.compiler.lang.api.PatternDescrBuilder) AnnotationDescrBuilder(org.drools.compiler.lang.api.AnnotationDescrBuilder) ImportDescrBuilder(org.drools.compiler.lang.api.ImportDescrBuilder) CollectDescrBuilder(org.drools.compiler.lang.api.CollectDescrBuilder) AttributeDescrBuilder(org.drools.compiler.lang.api.AttributeDescrBuilder) EvalDescrBuilder(org.drools.compiler.lang.api.EvalDescrBuilder) ConditionalBranchDescrBuilder(org.drools.compiler.lang.api.ConditionalBranchDescrBuilder) UnitDescrBuilder(org.drools.compiler.lang.api.UnitDescrBuilder) NamedConsequenceDescrBuilder(org.drools.compiler.lang.api.NamedConsequenceDescrBuilder) FieldDescrBuilder(org.drools.compiler.lang.api.FieldDescrBuilder) BehaviorDescrBuilder(org.drools.compiler.lang.api.BehaviorDescrBuilder) GlobalDescrBuilder(org.drools.compiler.lang.api.GlobalDescrBuilder) ConditionalElementDescr(org.drools.compiler.lang.descr.ConditionalElementDescr)

Aggregations

BaseDescr (org.drools.compiler.lang.descr.BaseDescr)109 AnnotatedBaseDescr (org.drools.compiler.lang.descr.AnnotatedBaseDescr)60 ConstraintConnectiveDescr (org.drools.compiler.lang.descr.ConstraintConnectiveDescr)23 AtomicExprDescr (org.drools.compiler.lang.descr.AtomicExprDescr)17 ConditionalElementDescr (org.drools.compiler.lang.descr.ConditionalElementDescr)16 BindingDescr (org.drools.compiler.lang.descr.BindingDescr)12 AndDescr (org.drools.compiler.lang.descr.AndDescr)11 RelationalExprDescr (org.drools.compiler.lang.descr.RelationalExprDescr)11 DeclareDescrBuilder (org.drools.compiler.lang.api.DeclareDescrBuilder)9 PatternDescr (org.drools.compiler.lang.descr.PatternDescr)8 OrDescr (org.drools.compiler.lang.descr.OrDescr)7 ArrayList (java.util.ArrayList)6 AccumulateDescrBuilder (org.drools.compiler.lang.api.AccumulateDescrBuilder)6 AnnotatedDescrBuilder (org.drools.compiler.lang.api.AnnotatedDescrBuilder)6 AnnotationDescrBuilder (org.drools.compiler.lang.api.AnnotationDescrBuilder)6 AttributeDescrBuilder (org.drools.compiler.lang.api.AttributeDescrBuilder)6 BehaviorDescrBuilder (org.drools.compiler.lang.api.BehaviorDescrBuilder)6 CEDescrBuilder (org.drools.compiler.lang.api.CEDescrBuilder)6 CollectDescrBuilder (org.drools.compiler.lang.api.CollectDescrBuilder)6 ConditionalBranchDescrBuilder (org.drools.compiler.lang.api.ConditionalBranchDescrBuilder)6