checkpoint
authoradam <adam@megacz.com>
Thu, 5 Jan 2006 09:14:56 +0000 (04:14 -0500)
committeradam <adam@megacz.com>
Thu, 5 Jan 2006 09:14:56 +0000 (04:14 -0500)
darcs-hash:20060105091456-5007d-1e4143c8a7344945f087a8b447831b5d2045b055.gz

src/edu/berkeley/sbp/Atom.java
src/edu/berkeley/sbp/misc/MetaGrammar.java
tests/input.tibdoc
tests/tibdoc.g

index f5b0158..2589dde 100644 (file)
@@ -45,5 +45,14 @@ public abstract class Atom<T extends Token> extends Element implements Topology<
         public String toString() { return "~"+a; }
     }
     
+    public static class Hack<T extends Token> extends Atom<T> {
+        private final Atom<T> a;
+        static final Topology leftright =
+            edu.berkeley.sbp.misc.CharToken.rightBrace.union(edu.berkeley.sbp.misc.CharToken.leftBrace);
+        public Hack(Atom<T> a) { this.a = a; }
+        public Topology<T> top() { return ((Topology<T>)a.top()).minus(leftright); }
+        public String toString() { return "~"+a; }
+    }
+    
 }
 
index ac0e55e..9dd3e62 100644 (file)
@@ -123,7 +123,7 @@ public class MetaGrammar extends StringWalker {
         else if ("psylr".equals(head)) throw new Error("not supported");
         else if ("/".equals(head)) return ((PreSequence)walk(tree, 0)).sparse((Element)walk(tree, 1));
         else if ("~".equals(head))
-            return new Atom.Invert(new Atom.Infer((Element)walk(tree, 0)));
+            return new Atom.Hack(new Atom.Invert(new Atom.Infer((Element)walk(tree, 0))));
         else if ("ps".equals(head)) return new PreSequence((Element[])walk(tree, 0));
         else if ("ps".equals(head)) return new PreSequence((Element[])walk(tree, 0));
         else if ("qprod".equals(head)) {
index 194f855..f026034 100644 (file)
@@ -5,21 +5,22 @@ header
   date     = published \today, yep!
 
 == Introduction ==
+
   this is the body adam@megacz.com text
   You can visit {my website}->adam@megacz.com with a !hyperlink to it!
+
   The following demonstrates verbatim stuff [Knu68], as
   well as a footnote ((like )) because are
   coool in an O(n^^3) way.
 
-  "" this is a test of
-     the blockquote mechanism
+  "" this is a test of \sc{paragraph of fun}
+     the blockquote mechanism they,,{yer mom} 
 
   Furthermore, we can try things like
 
     * this
     * this
 
-    1 and
 
-    2 this
+
 
index 8b18175..2d026e8 100644 (file)
@@ -40,18 +40,18 @@ Paragraph  ::= { "\"\"" ws text }        => "blockquote"
              > { "---" "-"* }            => "hr"
              > { text }                  => "p"
 
-text       ::= item => "t"
-itemx      ::= ws item => "w" | ()
-item       ::= blockquote => "b"
-             > pre         itemx => "a"
-             > structured  itemx => "1"
-             > structuredx itemx => "2"
-             > styled      itemx => "3"
-             > qtext       itemx => "4"
-             > alphanum++  itemx => "5"
-             > symbol      itemx => "6"
+text       ::= item
+itemx      ::= ws item | ()
+item       ::= blockquote
+             > pre         itemx => []
+             > structured  itemx => []
+             > structuredx itemx => []
+             > styled      itemx => []
+             > qtext       itemx => []
+             > alphanum++  itemx => []
+             > symbol      itemx => []
 //             > sym++       itemx => []
-             > Paragraph   itemx => "7"
+             > Paragraph   itemx => []
 
 symbol     ::= sym++