checkpoint
[sbp.git] / src / edu / berkeley / sbp / misc / RegressionTests.java
index bf63c11..302e5a2 100644 (file)
@@ -37,8 +37,8 @@ public class RegressionTests {
             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;
@@ -62,7 +62,7 @@ public class RegressionTests {
             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();
@@ -90,25 +90,13 @@ public class RegressionTests {
         }
     }
 
-    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);
         }
-        public static class TestCaseMakerHelper extends MG {
+        public static class TestCaseMakerHelper extends MetaGrammarBindings {
             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); }