From 50ee1870e1323d1b0b790fd4fc46d6845930bced Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 15 Jan 2006 16:52:58 -0500 Subject: [PATCH] temp darcs-hash:20060115215258-5007d-503cc518550a6af223f22f3458d2ee7993d54aeb.gz --- src/edu/berkeley/sbp/misc/MetaGrammar.java | 8 ++++---- tests/meta.g | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/edu/berkeley/sbp/misc/MetaGrammar.java b/src/edu/berkeley/sbp/misc/MetaGrammar.java index e4592a8..aedc920 100644 --- a/src/edu/berkeley/sbp/misc/MetaGrammar.java +++ b/src/edu/berkeley/sbp/misc/MetaGrammar.java @@ -115,9 +115,9 @@ public class MetaGrammar extends StringWalker { else if ("++".equals(head)) return Repeat.maximal1((Element)walk(tree.child(0))); else if ("?".equals(head)) return Repeat.maybe((Element)walk(tree.child(0))); else if ("&".equals(head)) - return ((PreSequence)walk(tree,0)).and(new PreSequence((Element[])Reflection.lub((Object[])walk(tree, 1)), null).buildSequence(null, true, false)); + return ((Sequence)walk(tree,0)).and(new PreSequence((Element[])Reflection.lub((Object[])walk(tree, 1)), null).buildSequence(null, true, false)); else if ("&~".equals(head)) - return ((PreSequence)walk(tree,0)).not(new PreSequence((Element[])Reflection.lub((Object[])walk(tree, 1)), null).buildSequence(null, true, false)); + return ((Sequence)walk(tree,0)).not(new PreSequence((Element[])Reflection.lub((Object[])walk(tree, 1)), null).buildSequence(null, true, false)); else if ("epsilon".equals(head)) return Union.epsilon; else if ("()".equals(head)) return Union.epsilon; else if (")".equals(head)) return SELF; @@ -129,7 +129,7 @@ public class MetaGrammar extends StringWalker { else if ("-".equals(head)) return new Range(walk(tree, 0).toString().charAt(0), walk(tree,1).toString().charAt(0)); else if ("range".equals(head)) return new Range(walk(tree, 0).toString().charAt(0), walk(tree,0).toString().charAt(0)); else if ("gram".equals(head)) return walk(tree, 0); - else if ("=>".equals(head)) { PreSequence p = (PreSequence)walk(tree, 0); p.tag = string(tree.child(1)); return p; } + else if ("=>".equals(head)) { PreSequence p = (PreSequence)walk(tree, 0); p.tag = string(tree.child(1)); return p.buildSequence(); } else if ("[]".equals(head)) { PreSequence p = (PreSequence)walk(tree, 0); p.unwrap = true; return p; } else if ("psy".equals(head)) return (PreSequence)walk(tree, 0); else if ("psyl".equals(head)) throw new Error("not supported"); @@ -142,7 +142,7 @@ public class MetaGrammar extends StringWalker { else if ("ps".equals(head)) return new PreSequence((Element[])walk(tree, 0)); else if ("qprod".equals(head)) { String s = string(tree.child(0)); - return new PreSequence(new Element[] { string(s) }, s, new boolean[] { true }); + return new PreSequence(new Element[] { string(s) }, s, new boolean[] { true }).buildSequence(); } else if ("ps2".equals(head)) { Object[] o1 = (Object[])walk(tree, 0); String s = string(tree.child(1)); diff --git a/tests/meta.g b/tests/meta.g index 0f69022..5815214 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -17,9 +17,9 @@ ps ::= e*/ws => "ps" psy ::= ps | ps wp ^"/" ws e psx ::= psy => "psy" - | e "<-" psy /ws => "psyl" +// | e "<-" psy /ws => "psyl" | psy "->" e /ws => "psyr" - | e "<-" psy "->" e /ws => "psylr" +// | e "<-" psy "->" e /ws => "psylr" Sequence ::= Quoted => "qprod" > psx | psx "=>" ^"[]" /ws -- 1.7.10.4