
cfml.parsing.cfscript.CFFunctionExpression Maven / Gradle / Ivy
package cfml.parsing.cfscript;
import java.util.Vector;
import org.antlr.v4.runtime.Token;
import cfml.parsing.reporting.ParseException;
public class CFFunctionExpression extends CFMember {
private static final long serialVersionUID = 1L;
private CFIdentifier nameId;
private Vector args; // Vector of CFExpression's
private boolean isUDF = true;
// private boolean isParamExists;
public CFFunctionExpression(CFIdentifier _name, Vector _args) throws ParseException {
this(_name.getToken(), _name, _args);
}
public CFFunctionExpression(Token t, CFIdentifier _name, Vector _args) throws ParseException {
super(t, null);
nameId = _name;
args = _args;
isUDF = false;
}
@Override
public byte getType() {
return CFExpression.FUNCTION;
}
public String getFunctionName() {
if (nameId instanceof CFFullVarExpression) {
return ((CFFullVarExpression) nameId).getLastIdentifier().Decompile(0).toLowerCase();
}
return nameId == null ? "" : nameId.Decompile(0).toLowerCase();
}
public boolean isUDF() {
return isUDF;
}
@Override
public String Decompile(int indent) {
String s = nameId == null ? "" : nameId.Decompile(indent);
s += "(";
for (int i = 0; i < args.size(); i++) {
s += args.elementAt(i).Decompile(indent);
if (i < args.size() - 1) {
s += ", ";
}
}
s += ")";
return s;
}
public Vector getArgs() {
return args;
}
public String getName() {
return nameId == null ? "" : nameId.Decompile(0);
}
public CFIdentifier getIdentifier() {
return nameId;
}
public CFIdentifier getNameId() {
return nameId;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy