use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_INSIDE_CONDITION_END3.
@Test(timeout = 10 * 1000)
@Ignore
public void testCheckLHSLocationDetermination_INSIDE_CONDITION_END3() {
// FIXME for now it will be a limitation of the parser... memberOf is a
// soft-keyword and this sentence cannot be parsed correctly if
// misspelling
String input = "rule MyRule \n" + " when \n" + " Class ( property memberOf collection ";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_END, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_BEGIN_OF_CONDITION_AND_OR27.
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_BEGIN_OF_CONDITION_AND_OR27() {
String input = "rule MyRule \n" + " when \n" + " Class ( ) or name : Cl";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.
the class DRLContextTest method testCheckLHSLocationDetermination_INSIDE_CONDITION_START45a.
@Test(timeout = 10 * 1000)
public void testCheckLHSLocationDetermination_INSIDE_CONDITION_START45a() {
String input = "rule MyRule \n" + " when \n" + " Class ( name :";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_LHS_INSIDE_CONDITION_START, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.
the class DRLContextTest method testCheckQueryLocationDetermination_RULE_HEADER1.
// TODO: add tests for dialect defined at package header level
@Test(timeout = 10 * 1000)
public void testCheckQueryLocationDetermination_RULE_HEADER1() {
String input = "query MyQuery ";
DRLParser parser = getParser(input);
parser.enableEditorInterface();
try {
parser.compilationUnit();
} catch (Exception ex) {
}
assertEquals(Location.LOCATION_RULE_HEADER, getLastIntegerValue(parser.getEditorInterface().get(0).getContent()));
}
use of org.drools.drl.parser.lang.DRLParser in project drools by kiegroup.
the class DrlParser method parse.
public PackageDescr parse(final boolean isEditor, final String text) throws DroolsParserException {
lexer = DRLFactory.buildLexer(text, languageLevel);
DRLParser parser = DRLFactory.buildParser(lexer, languageLevel);
return compile(isEditor, parser);
}
Aggregations