Methods Summary |
---|
public java.lang.String | getArgs()
return args;
|
public boolean | getBang()
return bang;
|
public java.lang.String | getName()
return name;
|
public java.lang.String | getReturnValue()
return returnValue;
|
public java.lang.String | getVisibility()
return visibility;
|
public boolean | narrowerVisibility(persistence.antlr.preprocessor.Rule rule)If 'rule' narrows the visible of 'this', return true;
For example, 'this' is public and 'rule' is private,
true is returned. You cannot narrow the vis. of
a rule.
if (visibility.equals("public")) {
if (!rule.equals("public")) {
return true; // everything narrower than public
}
return false;
}
else if (visibility.equals("protected")) {
if (rule.equals("private")) {
return true; // private narrower than protected
}
return false;
}
else if (visibility.equals("private")) {
return false; // nothing is narrower than private
}
return false;
|
public boolean | sameSignature(persistence.antlr.preprocessor.Rule rule)Two rules have the same signature if they have:
same name
same return value
same args
I do a simple string compare now, but later
the type could be pulled out so it is insensitive
to names of args etc...
boolean nSame = true;
boolean aSame = true;
boolean rSame = true;
nSame = name.equals(rule.getName());
if (args != null) {
aSame = args.equals(rule.getArgs());
}
if (returnValue != null) {
rSame = returnValue.equals(rule.getReturnValue());
}
return nSame && aSame && rSame;
|
public void | setArgs(java.lang.String a)
args = a;
|
public void | setBang()
bang = true;
|
public void | setEnclosingGrammar(persistence.antlr.preprocessor.Grammar g)
enclosingGrammar = g;
|
public void | setInitAction(java.lang.String a)
initAction = a;
|
public void | setOptions(persistence.antlr.collections.impl.IndexedVector options)
this.options = options;
|
public void | setReturnValue(java.lang.String ret)
returnValue = ret;
|
public void | setThrowsSpec(java.lang.String t)
throwsSpec = t;
|
public void | setVisibility(java.lang.String v)
visibility = v;
|
public java.lang.String | toString()
String s = "";
String retString = returnValue == null ? "" : "returns " + returnValue;
String argString = args == null ? "" : args;
String bang = getBang() ? "!" : "";
s += visibility == null ? "" : visibility + " ";
s += name + bang + argString + " " + retString + throwsSpec;
if (options != null) {
s += System.getProperty("line.separator") +
"options {" +
System.getProperty("line.separator");
for (Enumeration e = options.elements(); e.hasMoreElements();) {
s += (Option)e.nextElement() + System.getProperty("line.separator");
}
s += "}" + System.getProperty("line.separator");
}
if (initAction != null) {
s += initAction + System.getProperty("line.separator");
}
s += block;
return s;
|