checkpoint
authoradam <adam@megacz.com>
Sun, 16 Jul 2006 07:55:17 +0000 (03:55 -0400)
committeradam <adam@megacz.com>
Sun, 16 Jul 2006 07:55:17 +0000 (03:55 -0400)
darcs-hash:20060716075517-5007d-6d6f91032210d931aa65f56ab55da691d3ce5a39.gz

src/edu/berkeley/sbp/Union.java
src/edu/berkeley/sbp/chr/CharRange.java
src/edu/berkeley/sbp/meta/MetaGrammarBindings.java

index 99ef42b..484616d 100644 (file)
@@ -45,10 +45,6 @@ public class Union extends Element implements Iterable<Sequence> {
     // Epsilon Form //////////////////////////////////////////////////////////////////////////////
 
     // FIXME
-    public static Union epsilon = new Union("()");
-    static { epsilon.add(Sequence.empty); }
-
-    // FIXME
     private Forest.Many epsilonForm = null;
     Forest epsilonForm() {
         if (epsilonForm != null) return epsilonForm;
index 6728012..78f2057 100644 (file)
@@ -30,7 +30,7 @@ public class CharRange extends Atom<Character> {
     /** returns an element which exactly matches the string given */
     public static Element string(String s) { return string(s, true); }
     public static Element string(String s, boolean share) {
-        if (share && s.length() == 0) return Union.epsilon;
+        if (share && s.length() == 0) return epsilon;
         final String escapified = "\""+StringUtil.escapify(s, "\"\r\n\\")+"\"";
         Element ret;
         if (share && s.length() == 1) {
@@ -48,4 +48,6 @@ public class CharRange extends Atom<Character> {
         return ret;
     }
 
+    private static Union epsilon = new Union("()");
+    static { epsilon.add(Sequence.empty); }
 }
index 8f322a5..0d9052c 100644 (file)
@@ -265,7 +265,10 @@ public class MetaGrammarBindings extends AnnotationGrammarBindings {
     public static @bind.as        Seq  psx(Seq s)                        { return s; }
     public static @bind.as(":")   ElementNode   colon(String s, ElementNode e)             { return new Label(s, e); }
     public static @bind.as(")")   void close(String foo)                 { throw new Error("not supported"); }
-    public static @bind.as("()")  ElementNode   epsilon()                         { return new Constant(Union.epsilon); }
+    public static @bind.as("()")  ElementNode   epsilon()                         { return new Constant(epsilon); }
+
+    private static Union epsilon = new Union("()");
+    static { epsilon.add(Sequence.empty); }
 
     public static class NonTerminalReferenceNode extends ElementNode {
         public String nonTerminal;