checkpoint
authoradam <adam@megacz.com>
Thu, 22 Dec 2005 03:19:29 +0000 (22:19 -0500)
committeradam <adam@megacz.com>
Thu, 22 Dec 2005 03:19:29 +0000 (22:19 -0500)
darcs-hash:20051222031929-5007d-ac419b3914cc5cff18bc27fc9ff5a1ac22c2716d.gz

TODO
src/edu/berkeley/sbp/tib/Tib.java
tests/regression.tc

diff --git a/TODO b/TODO
index 27e9694..0ec9353 100644 (file)
--- a/TODO
+++ b/TODO
@@ -9,7 +9,6 @@ Immediately
      => mydrop
      => mylift
 
-  - whitespace-in-braces?
   - Deal with the problem of zero-rep productions and whitespace insertion
 
   - switch maximal to not-followed-by (~/~)
index eabc9ee..9b4b974 100644 (file)
@@ -296,13 +296,17 @@ public class Tib implements Token.Stream<CharToken> {
         public Object walk(Tree<String> tree) {
             String head = tree.head();
             if (tree.numChildren()==0) return super.walk(tree);
-            if ("{".equals(head))
-                return nonTerminal("braced"+(anon++),
+            if ("{".equals(head)) {
+                String s = "braced"+(anon++);
+                Union u = nonTerminal(s);
+                Union u2 = ((PreSequence)walk(tree, 0)).sparse(ws).buildUnion();
+                u2.add(Sequence.singleton(new Element[] { u }, 0, null, null));
+                return nonTerminal(s,
                                    new PreSequence[][] {
                                        new PreSequence[] {
                                            new PreSequence(new Element[] { CharToken.leftBrace,
                                                                            ws,
-                                                                           ((PreSequence)walk(tree, 0)).sparse(ws).buildUnion(),
+                                                                           u2,
                                                                            ws,
                                                                            CharToken.rightBrace
                                            })
@@ -310,6 +314,7 @@ public class Tib implements Token.Stream<CharToken> {
                                    },
                                    false,
                                    false);
+            }
             return super.walk(tree);
         }
     }
index ce43a84..0d4b8d4 100644 (file)
@@ -25,14 +25,14 @@ tibcase {
   hello 
     there
     how
-     { are }
+      { are }
 ";
     output "yep";
 
     s        ::= { Hello } => "yep"
     w        ::= " " | "\n"
     ws      !::= w**
-    Hello    ::= "hello" ws { "there" "how" { { "are" } } }
+    Hello    ::= "hello" ws { "there" "how" { "are" } }
 }
 
 testcase {