string = ((TemplateScalarModel) model).getAsString();
}
catch(ClassCastException ex) {
throw TemplateNode.invalidTypeException(model, caller.getTarget(), env, "string or number");
}
ArithmeticEngine e = env == null ? caller.getTemplate().getArithmeticEngine() : env.getArithmeticEngine();
try {
return new SimpleNumber(e.toNumber(string));
} catch(NumberFormatException nfe) {
String mess = "Error: " + caller.getStartLocation()
+ "\nExpecting a number in string here, found: " + string;
throw new NonNumericalException(mess, env);
}