From: adam Date: Thu, 5 Jan 2006 09:14:56 +0000 (-0500) Subject: checkpoint X-Git-Tag: tag_for_25-Mar~426 X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=b409afa0cf6d72a23703d9172812ab4fcd6a969b checkpoint darcs-hash:20060105091456-5007d-1e4143c8a7344945f087a8b447831b5d2045b055.gz --- diff --git a/src/edu/berkeley/sbp/Atom.java b/src/edu/berkeley/sbp/Atom.java index f5b0158..2589dde 100644 --- a/src/edu/berkeley/sbp/Atom.java +++ b/src/edu/berkeley/sbp/Atom.java @@ -45,5 +45,14 @@ public abstract class Atom extends Element implements Topology< public String toString() { return "~"+a; } } + public static class Hack extends Atom { + private final Atom a; + static final Topology leftright = + edu.berkeley.sbp.misc.CharToken.rightBrace.union(edu.berkeley.sbp.misc.CharToken.leftBrace); + public Hack(Atom a) { this.a = a; } + public Topology top() { return ((Topology)a.top()).minus(leftright); } + public String toString() { return "~"+a; } + } + } diff --git a/src/edu/berkeley/sbp/misc/MetaGrammar.java b/src/edu/berkeley/sbp/misc/MetaGrammar.java index ac0e55e..9dd3e62 100644 --- a/src/edu/berkeley/sbp/misc/MetaGrammar.java +++ b/src/edu/berkeley/sbp/misc/MetaGrammar.java @@ -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)) { diff --git a/tests/input.tibdoc b/tests/input.tibdoc index 194f855..f026034 100644 --- a/tests/input.tibdoc +++ b/tests/input.tibdoc @@ -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 + diff --git a/tests/tibdoc.g b/tests/tibdoc.g index 8b18175..2d026e8 100644 --- a/tests/tibdoc.g +++ b/tests/tibdoc.g @@ -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++