From: adam Date: Thu, 12 Jan 2006 10:24:58 +0000 (-0500) Subject: checkpoint X-Git-Tag: tag_for_25-Mar~383 X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=f7f669e438822dd46922e3d3b1c880fdec998a9b checkpoint darcs-hash:20060112102458-5007d-57688d3c8cdb8f0a4b303022d832ac4433f7570e.gz --- diff --git a/src/edu/berkeley/sbp/Ambiguous.java b/src/edu/berkeley/sbp/Ambiguous.java index 56e1af7..cb55ffa 100644 --- a/src/edu/berkeley/sbp/Ambiguous.java +++ b/src/edu/berkeley/sbp/Ambiguous.java @@ -7,13 +7,13 @@ import java.util.*; /** if ambiguity checking is enabled, this exception is thrown to signal that the parse was ambiguous */ public class Ambiguous extends RuntimeException { - public final Forest ambiguity; - public Ambiguous(Forest ambiguity) { this.ambiguity = ambiguity; } + public final Forest ambiguity; + public Ambiguous(Forest ambiguity) { this.ambiguity = ambiguity; } public String toString() { StringBuffer sb = new StringBuffer(); sb.append("unresolved ambiguity "/*"at " + ambiguity.getLocation() + ":"*/); - for(Object result : ambiguity.expand(false)) - sb.append("\n " + result); + for(Tree result : ambiguity.expand(false)) + sb.append("\n\n" + result.toPrettyString()); return sb.toString(); } } diff --git a/src/edu/berkeley/sbp/tib/TibDoc.java b/src/edu/berkeley/sbp/tib/TibDoc.java index 538d808..9e50549 100644 --- a/src/edu/berkeley/sbp/tib/TibDoc.java +++ b/src/edu/berkeley/sbp/tib/TibDoc.java @@ -63,6 +63,7 @@ public class TibDoc { public static class HTMLWalker extends ReflectiveWalker { //public void header() { throw new Error(); } public String li(Object o) { return "
  • "+o+"
  • "; } + public String li(Object a, Object o) { return "
  • "+o+"
  • "; } public String ul(String[] li) { return ""; } public String ol(String[] li) { return "
      "+join(li,"")+"
    "; } public String hr() { return "\n
    \n"; } diff --git a/tests/input.tibdoc b/tests/input.tibdoc index dcd7fac..d2c04b1 100644 --- a/tests/input.tibdoc +++ b/tests/input.tibdoc @@ -21,5 +21,16 @@ header Furthermore, we can try things like * this + * this + * this + * that + * that + * these + * that + 1. them + # thar + 45) dorks + * this + * this - * this \ No newline at end of file + this stuff \ No newline at end of file diff --git a/tests/tibdoc.g b/tests/tibdoc.g index 1df3fb8..a2f5cac 100644 --- a/tests/tibdoc.g +++ b/tests/tibdoc.g @@ -37,27 +37,30 @@ kv ::= word "=" text /ws => kv1 wp !::= w++ num !::= [0-9]++ Paragraph ::= { "\"\"" ws text } => "blockquote" - > uli+/ws => "ul" - > { "# " text } => "ol" - > { num " " ws text } => "ol" > { "---" "-"* } => "hr" > { text } => "p" -uli ::= { "* " text } => "li" + +onums !::= nums (". "|") ") +any !::= ~[]* + +uli ::= "* " (ws text &~ any (oli|uli)) => "li" +oli ::= ("# "|onums) (ws text &~ any (oli|uli)) => "li" text ::= Item => text Itemx ::= ws Item | () Item ::= blockquote - > pre Itemx => [] - > structured Itemx => [] - > structuredx Itemx => [] - > styled Itemx => [] - > qtext Itemx => [] - > (alphanum++ => stringify) Itemx => [] - > symbol Itemx => [] - > (sym++ => stringify) Itemx => [] - > Paragraph => "" - > Paragraph Itemx => [] + > { uli+/ws => "ul" } Itemx => [] + | { oli+/ws => "ol" } Itemx => [] + > pre Itemx => [] + > structured Itemx => [] + > structuredx Itemx => [] + > styled Itemx => [] + > qtext Itemx => [] + > (alphanum++ => stringify) Itemx => [] + > symbol Itemx => [] + > (sym++ => stringify) Itemx => [] + > Paragraph Itemx => [] blockquote ::= "\"\"" text "\"\"" => "blockquote" | "\"\"" block => "blockquote"