use of org.whole.lang.grammars.model.Grammar in project whole by wholeplatform.
the class PathExpressionsQueriesTest method testSingleVariableTestInPathExpPredicateOfPathInternalStep.
@Test
public void testSingleVariableTestInPathExpPredicateOfPathInternalStep() {
ITemplateManager tm = PathExpressionsQueriesTemplateManager.instance();
Grammar g = new TestXmlGrammar().create();
PathExpression pe1 = (PathExpression) tm.create("findAllNonTerminalsUsed");
IBindingManager bm = BindingManagerFactory.instance.createArguments();
// FIXME bm.wDefValue("pname", "Element");
bm.wDef("pname", GrammarsEntityFactory.instance.createNonTerminal("IName"));
int count = 0;
for (NonTerminal nt : BehaviorUtils.<NonTerminal>compileAndLazyEvaluate(pe1, g, bm)) count++;
Assert.assertEquals(4, count);
}
use of org.whole.lang.grammars.model.Grammar in project whole by wholeplatform.
the class RewriteQueriesTest method testDelete3.
@Test
public void testDelete3() {
Grammar model = new TestXmlGrammar().create();
ITemplateManager tm = RewriteQueriesTemplateManager.instance();
PathExpression query = (PathExpression) tm.create("delete3");
for (IEntity entity : BehaviorUtils.compileAndLazyEvaluate(query, model)) assertTrue(Matcher.match(GrammarsEntityDescriptorEnum.Name, entity) || EntityUtils.isResolver(entity));
for (IEntity entity : BehaviorUtils.compileAndLazyEvaluate(query, model)) assertTrue(EntityUtils.isResolver(entity));
}
use of org.whole.lang.grammars.model.Grammar in project whole by wholeplatform.
the class SelectQueriesTest method testSelectTemplateWithTwoNestedSimpleQueries.
@Test
public void testSelectTemplateWithTwoNestedSimpleQueries() {
ITemplateManager tm = SelectQueriesTemplateManager.instance();
Grammar g = new TestXmlGrammar().create();
PathExpression pe1 = (PathExpression) tm.create("selectTemplateWithTwoNestedSimpleQueries");
for (Feature f : BehaviorUtils.<Feature>compileAndLazyEvaluate(pe1, g)) {
assertEquals(ModelsEntityDescriptorEnum.Feature, f.wGetEntityDescriptor());
}
}
use of org.whole.lang.grammars.model.Grammar in project whole by wholeplatform.
the class SelectQueriesTest method testSelectPathExpression2.
@Test
public void testSelectPathExpression2() {
ITemplateManager tm = SelectQueriesTemplateManager.instance();
Grammar model = new TestXmlGrammar().create();
PathExpression query = (PathExpression) tm.create("selectPath2");
StringBuilder names = new StringBuilder();
for (NonTerminal nt : BehaviorUtils.<NonTerminal>compileAndLazyEvaluate(query, model)) names.append(nt.getValue());
assertEquals("DocumentElementINameIContent", names.toString());
}
use of org.whole.lang.grammars.model.Grammar in project whole by wholeplatform.
the class SelectQueriesTest method testSelectPathExpression1.
@Test
public void testSelectPathExpression1() {
ITemplateManager tm = SelectQueriesTemplateManager.instance();
Grammar g = new TestXmlGrammar().create();
PathExpression pe1 = (PathExpression) tm.create("selectPath1");
StringBuilder names = new StringBuilder();
for (NonTerminal nt : BehaviorUtils.<NonTerminal>compileAndLazyEvaluate(pe1, g)) names.append(nt.getValue());
assertEquals("DocumentElementINameIContent", names.toString());
}
Aggregations