import java.lang.reflect.*;
import edu.berkeley.sbp.*;
import edu.berkeley.sbp.misc.*;
+import edu.berkeley.sbp.meta.*;
import edu.berkeley.sbp.bind.*;
import edu.berkeley.sbp.tib.*;
import edu.berkeley.sbp.chr.*;
import edu.berkeley.sbp.util.*;
-import static edu.berkeley.sbp.misc.MetaGrammar.*;
+import static edu.berkeley.sbp.meta.MetaGrammar.*;
public class RegressionTests {
System.err.println("parsing " + s[0]);
Tree<String> res = new CharParser(MetaGrammar.make()).parse(new FileInputStream(s[0])).expand1();
Union meta = MetaGrammar.make(res, "s");
+
System.err.println("parsing " + s[1]);
- SequenceInputStream sis = new SequenceInputStream(new FileInputStream(s[0]), new FileInputStream(s[1]));
- res = new CharParser(meta).parse(sis).expand1();
+ //SequenceInputStream sis = new SequenceInputStream(new FileInputStream(s[0]), new FileInputStream(s[1]));
+ res = new CharParser(meta).parse(new FileInputStream(s[1])).expand1();
Union testcasegrammar = MetaGrammar.make(res, "ts", new TestCaseMaker());
if (testcasegrammar==null) return;
System.err.println("expanding...");
Tree t = r2.expand1();
- TestCase[] expanded = (TestCase[])((Functor)t.head()).invoke(t.children());
+ TestCase[] expanded = (TestCase[])((Functor)t.head()).invoke(t);
System.err.println("executing...");
for(TestCase tc : expanded) {
tc.execute();
}
}
- public static class TestCaseMaker extends ReflectiveMeta {
+ public static class TestCaseMaker extends AnnotationGrammarBindingResolver {
public TestCaseMaker() {
- super(TestCaseMakerHelper.class, new Class[] {
- MG.Grammar.class,
- MG.NonTerminal.class,
- MG.AnonUn.class,
- MG.Range.class,
- MG.El.class,
- MG.Seq.class,
- MG.NonTerminalReference.class,
- MG.StringLiteral.class,
- MG.XTree.class,
- MG.CharClass.class
- });
+ super(TestCaseMakerHelper.class);
+ add(MetaGrammarBindings.class, "grammar");
+ //add(MetaGrammarBindings.class, "");
}
- public static class TestCaseMakerHelper extends MG {
+ public static class TestCaseMakerHelper {
public static @bind.as("grammaro") @bind.raw Object grammaro(Iterable<Tree> t) {
- System.out.println("working on " + t);
- return MetaGrammar.make(t.iterator().next(), "s", new ReflectiveMetaPlain());
+ return MetaGrammar.make(t.iterator().next(), "s", new TaggingGrammarBindingResolver());
}
//public static @bind.as("tca") Object tca(Object[] o) throws IOException {
//return new TestCase((String)o[0], (String[])o[1], (Union)o[2], false, false); }