From 107df9a4aee6ba593b64d3bbe8b2efac84596cad Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 15 Dec 2005 03:48:37 -0500 Subject: [PATCH] checkpoint darcs-hash:20051215084837-5007d-a04876953d0928d371998af263895cfa84b14783.gz --- TODO | 6 ++++++ src/edu/berkeley/sbp/misc/RegressionTests.java | 4 +++- tests/meta.g | 7 +++---- tests/regression.tc | 3 ++- tests/testcase.g | 1 + 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 5368def..9c1b408 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,12 @@ Immediately - Lay down the law on the different kinds of Sequence productions and how they work. + => mydrop + => mylift + + - whitespace-in-braces? + - Deal with the problem of zero-rep productions and whitespace insertion + - switch maximal to not-followed-by (~/~) - should Union.add() be there? diff --git a/src/edu/berkeley/sbp/misc/RegressionTests.java b/src/edu/berkeley/sbp/misc/RegressionTests.java index 8d165ff..5a86bf1 100644 --- a/src/edu/berkeley/sbp/misc/RegressionTests.java +++ b/src/edu/berkeley/sbp/misc/RegressionTests.java @@ -129,12 +129,14 @@ public class RegressionTests { return new TestCase(input, output, grammar, false); } public TestCase testcase(String input, Union grammar) throws IOException { return new TestCase(input, new String[0], grammar, false); } + public TestCase tibcase(String input, String[] output, Union grammar) throws IOException { + return new TestCase(input, output, grammar, true); } public TestCase tibcase(String input, Union grammar) throws IOException { return new TestCase(input, new String[0], grammar, true); } public MetaGrammar grammar(Object[] o) { return this; } public Object walk(String tag, Object[] args) { if ("grammar".equals(tag)) { - System.out.println("\n" + this + "\n"); + //System.out.println("\n" + this + "\n"); return done("s"); } else return super.walk(tag, args); diff --git a/tests/meta.g b/tests/meta.g index 0e3bce7..5723e6d 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -4,8 +4,7 @@ grammar ::= r +/ ws => "grammar" r ::= word ^"::=" alternatives /ws | word ^"!::=" alternatives /ws -alternatives ::= equiAlt +/ (ws ">" ws) -equiAlt ::= conjuncts +/ (ws "|" ws) +alternatives ::= (conjuncts +/ (ws "|" ws)) +/ (ws ">" ws) conjuncts ::= sequence | sequence ^"&" e*/ws /ws @@ -21,10 +20,10 @@ ec ::= [~\-\]\\\~] range ::= ec => "range" | ec ^"-" ec -e ::= word => "nonTerminal" +e ::= word => "nonTerminal" | quoted => "literal" | ^"()" - | ^"{" sequence "}" /ws + | ^"{" sequence "}" /ws | ^"[" (range*) "]" | ^"[~" (range*) "]" | ^"^" quoted /ws diff --git a/tests/regression.tc b/tests/regression.tc index 902d852..6196b48 100644 --- a/tests/regression.tc +++ b/tests/regression.tc @@ -27,8 +27,9 @@ tibcase { how { are } "; + output "yep"; - s ::= { Hello } + s ::= { Hello } => "yep" w ::= " " | "\n" ws !::= w** Hello ::= "hello" ws { ws "there" ws "how" ws { { "are" } ws } } diff --git a/tests/testcase.g b/tests/testcase.g index b42a410..33c00b7 100644 --- a/tests/testcase.g +++ b/tests/testcase.g @@ -3,6 +3,7 @@ tests ::= test */ ws ws !::= w* test ::= ^"testcase" "{" input output +/ ws grammar "}" /ws | ^"testcase" "{" input grammar "}" /ws + | ^"tibcase" "{" input output +/ ws grammar "}" /ws | ^"tibcase" "{" input grammar "}" /ws output ::= "output" quoted ";" /ws input ::= "input" quoted ";" /ws -- 1.7.10.4