getFieldName() implementations for other classes
authoradam <adam@megacz.com>
Tue, 4 Mar 2008 05:28:59 +0000 (00:28 -0500)
committeradam <adam@megacz.com>
Tue, 4 Mar 2008 05:28:59 +0000 (00:28 -0500)
darcs-hash:20080304052859-5007d-d34e81f8e639deb0beabb7649e3405c05a60437c.gz

src/edu/berkeley/sbp/meta/GrammarAST.java

index 1c1ef3d..66e8323 100644 (file)
@@ -465,6 +465,7 @@ public class GrammarAST {
             if (ret == null) throw new RuntimeException("unknown nonterminal \""+nonTerminal+"\"");
             return ret;
         }
+        public String getFieldName() { return StringUtil.uncapitalize(nonTerminal); }
     }
 
     /** a literal string */
@@ -537,6 +538,7 @@ public class GrammarAST {
         public boolean isDropped(Context cx) { return _e.isDropped(cx); }
         public Atom toAtom(Context cx) { return _e.toAtom(cx); }
         public Element build(Context cx, NonTerminalNode cnt, boolean dropall) { return _e.build(cx, cnt, dropall); }
+        public String getFieldName() { return _e.getFieldName(); }
     }
 
     /** a backtick node indicating that, when building the AST, the node's children should be inserted here */
@@ -561,6 +563,7 @@ public class GrammarAST {
     private class LabelNode extends ElementNodeWrapper {
         public final String label;
         public LabelNode(String label, ElementNode e) { super(e); this.label = label; }
+        public String getFieldName() { return label; }
     }
 
     //////////////////////////////////////////////////////////////////////////////