From: adam Date: Tue, 13 Dec 2005 07:49:28 +0000 (-0500) Subject: checkpoint X-Git-Tag: tag_for_25-Mar~589 X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=2fae767715346f7d7e708b63f00a2f40ec26d3de checkpoint darcs-hash:20051213074928-5007d-2f965a332dc03602ff011745ad2fe5f34ff15cda.gz --- diff --git a/src/edu/berkeley/sbp/misc/MetaGrammar.java b/src/edu/berkeley/sbp/misc/MetaGrammar.java index 644b40a..42db7c2 100644 --- a/src/edu/berkeley/sbp/misc/MetaGrammar.java +++ b/src/edu/berkeley/sbp/misc/MetaGrammar.java @@ -92,6 +92,10 @@ public class MetaGrammar extends ReflectiveWalker { if (s instanceof String) s = CharToken.string((String)s); return new Rep(r, (Element)s, false, true); } + public Object _percent__percent_(final Element r, Object s) { + if (s instanceof String) s = CharToken.string((String)s); + return new Rep(r, (Element)s, false, true); + } //public Element _star__slash_(final Element r, Element s) { return Repeat.many0(r, s); } public Object _star__star_(final Element r) { return new Rep(r, null, true, true); } public Object _plus__plus_(final Element r) { return new Rep(r, null, true, false); } diff --git a/tests/meta.g b/tests/meta.g index 5b4cf6a..9755cfc 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -12,7 +12,8 @@ equiAlt ::= conjuncts +/ (ws "|" ws) => "alternatives" sequence ::= Es > Es ^"/" e /ws Es ::= e+ -es ::= e+/ws +//es ::= e+/ws + conjuncts ::= rewrite | rewrite ^"&" sequence /ws @@ -31,6 +32,7 @@ e ::= word => "nonTerminalY" | ^"{" alternatives "}" /ws | "[" [\~]? range* "]" => "range" | e ^"*/" e /ws + | e ^"%%" e /ws | e ^"+/" e /ws | e ^"?" /ws | e ^"~/~" /ws diff --git a/tests/testcase.g b/tests/testcase.g index 50b5859..920717e 100644 --- a/tests/testcase.g +++ b/tests/testcase.g @@ -1,4 +1,5 @@ -ts ::= ws test*/ws ws => ts +ts ::= ws tests ws => ts +tests ::= test %% ws ws !::= w* test ::= ^"testcase" "{" input output+/ws grammar "}" /ws | ^"testcase" "{" input grammar "}" /ws