use of org.drools.compiler.compiler.DrlExprParser in project drools by kiegroup.
the class PatternBuilder method parseExpression.
protected ConstraintConnectiveDescr parseExpression(final RuleBuildContext context, final PatternDescr patternDescr, final BaseDescr original, final String expression) {
DrlExprParser parser = new DrlExprParser(context.getConfiguration().getLanguageLevel());
ConstraintConnectiveDescr result = parser.parse(expression);
result.setResource(patternDescr.getResource());
if (result == null) {
registerDescrBuildError(context, patternDescr, "Unable to parse pattern expression:\n" + expression);
return null;
}
result.copyLocation(original);
if (parser.hasErrors()) {
for (DroolsParserException error : parser.getErrors()) {
registerDescrBuildError(context, patternDescr, "Unable to parse pattern expression:\n" + error.getMessage());
}
return null;
}
return result;
}
use of org.drools.compiler.compiler.DrlExprParser in project drools by kiegroup.
the class MVELDumper method processConstraint.
private void processConstraint(StringBuilder sbuilder, ExprConstraintDescr base, boolean isInsideRelCons, MVELDumperContext context) {
DrlExprParser expr = new DrlExprParser(context.getRuleContext().getConfiguration().getLanguageLevel());
ConstraintConnectiveDescr result = expr.parse(base.getExpression());
if (result.getDescrs().size() == 1) {
dump(sbuilder, result.getDescrs().get(0), 0, isInsideRelCons, context);
} else {
dump(sbuilder, result, 0, isInsideRelCons, context);
}
}
use of org.drools.compiler.compiler.DrlExprParser in project drools by kiegroup.
the class DRLExprParserTest method setUp.
protected void setUp() throws Exception {
super.setUp();
new EvaluatorRegistry();
this.parser = new DrlExprParser(LanguageLevelOption.DRL6);
}
Aggregations