Search in sources :

Example 1 with XmlGrammar

use of org.whole.lang.grammars.codebase.XmlGrammar in project whole by wholeplatform.

the class GrammarsUtilsTest method testGrammarToModelMapping.

@Test
public void testGrammarToModelMapping() {
    Model m = new XmlModel().create();
    Grammar g = new XmlGrammar().create();
    Model m1 = GrammarsUtils.deriveModel(g, true);
    Assert.assertTrue(Matcher.match(m, m1));
}
Also used : Model(org.whole.lang.models.model.Model) Grammar(org.whole.lang.grammars.model.Grammar) XmlGrammar(org.whole.lang.grammars.codebase.XmlGrammar) XmlGrammar(org.whole.lang.grammars.codebase.XmlGrammar) Test(org.junit.Test)

Example 2 with XmlGrammar

use of org.whole.lang.grammars.codebase.XmlGrammar in project whole by wholeplatform.

the class GrammarsUtilsTest method setUp.

@Before
public void setUp() throws Exception {
    // TODO fix and remove workaround
    ReflectionFactory.deployWholePlatform();
    Grammar testGrammar1 = new TestGrammar1().create();
    testGrammarURI = testGrammar1.getUri().getValue();
    if (// TODO fix and remove workaround
    !GrammarsRegistry.instance().containsGrammar(testGrammarURI))
        InterpreterOperation.interpret(testGrammar1);
    Grammar xmlGrammar = new XmlGrammar().create();
    xmlGrammarURI = xmlGrammar.getUri().getValue();
    if (// TODO fix and remove workaround
    !GrammarsRegistry.instance().containsGrammar(xmlGrammarURI))
        InterpreterOperation.interpret(xmlGrammar);
}
Also used : Grammar(org.whole.lang.grammars.model.Grammar) XmlGrammar(org.whole.lang.grammars.codebase.XmlGrammar) XmlGrammar(org.whole.lang.grammars.codebase.XmlGrammar) Before(org.junit.Before)

Aggregations

XmlGrammar (org.whole.lang.grammars.codebase.XmlGrammar)2 Grammar (org.whole.lang.grammars.model.Grammar)2 Before (org.junit.Before)1 Test (org.junit.Test)1 Model (org.whole.lang.models.model.Model)1