Search in sources :

Example 1 with GenericMatcherFactory

use of org.whole.lang.matchers.GenericMatcherFactory in project whole by wholeplatform.

the class RewriteTest method testRewrite.

@Test
public void testRewrite() {
    IEntity program = buildImpProgram();
    PrettyPrinterOperation.prettyPrint(program);
    GenericMatcherFactory mf = GenericMatcherFactory.instance;
    GenericTraversalFactory tf = GenericTraversalFactory.instance;
    IVisitor v = tf.innermost(tf.concurrentSome(mf.rewrite(IfElseEmptyPattern(), IfElseEmptyRewrite(), false), mf.rewrite(IfTruePattern(), IfTrueRewrite(), false), mf.rewrite(IfTrueElsePattern(), IfTrueRewrite(), false), mf.rewrite(IfNotPattern(), IfNotRewrite(), false)));
    v.visit(program);
    PrettyPrinterOperation.prettyPrint(program);
}
Also used : IEntity(org.whole.lang.model.IEntity) IVisitor(org.whole.lang.visitors.IVisitor) GenericMatcherFactory(org.whole.lang.matchers.GenericMatcherFactory) GenericTraversalFactory(org.whole.lang.visitors.GenericTraversalFactory) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 GenericMatcherFactory (org.whole.lang.matchers.GenericMatcherFactory)1 IEntity (org.whole.lang.model.IEntity)1 GenericTraversalFactory (org.whole.lang.visitors.GenericTraversalFactory)1 IVisitor (org.whole.lang.visitors.IVisitor)1