From: adam Date: Tue, 4 Mar 2008 05:28:59 +0000 (-0500) Subject: getFieldName() implementations for other classes X-Git-Url: http://git.megacz.com/?p=sbp.git;a=commitdiff_plain;h=6e1e10e87fe8cab7c604c38c230900806bc4bb90 getFieldName() implementations for other classes darcs-hash:20080304052859-5007d-d34e81f8e639deb0beabb7649e3405c05a60437c.gz --- diff --git a/src/edu/berkeley/sbp/meta/GrammarAST.java b/src/edu/berkeley/sbp/meta/GrammarAST.java index 1c1ef3d..66e8323 100644 --- a/src/edu/berkeley/sbp/meta/GrammarAST.java +++ b/src/edu/berkeley/sbp/meta/GrammarAST.java @@ -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; } } //////////////////////////////////////////////////////////////////////////////