use of com.laytonsmith.core.functions.CompiledFunction in project CommandHelper by EngineHub.
the class MethodScriptStaticCompiler method go.
private static void go(ParseTree node, StringBuilder b, api.Platforms platform) throws ConfigCompileException {
if (node.hasChildren()) {
FunctionBase f = FunctionList.getFunction(node.getData(), platform);
if (!(f instanceof CompiledFunction)) {
throw new ConfigCompileException("The function " + f.getName() + " is unknown in this platform.", node.getData().getTarget());
}
CompiledFunction cf = (CompiledFunction) f;
List<String> children = new ArrayList<String>();
for (ParseTree baby : node.getChildren()) {
StringBuilder bb = new StringBuilder();
go(baby, bb, platform);
children.add(bb.toString());
}
b.append(cf.compile(node.getData().getTarget(), children.toArray(new String[children.size()])));
} else {
if (platform.getResolver() == null) {
b.append(node.getData().val());
} else {
b.append(platform.getResolver().outputConstant(node.getData()));
}
}
}
Aggregations