use of lucee.runtime.interpreter.ref.var.Variable in project Lucee by lucee.
the class Elvis method getValue.
@Override
public Object getValue(PageContext pc) throws PageException {
if (limited)
throw new InterpreterException("invalid syntax, this operation is not supported in a json string.");
if (left instanceof Variable) {
Variable var = (Variable) left;
String[] arr = LFunctionValue.toStringArray(pc, var);
return lucee.runtime.op.Elvis.operate(pc, arr) ? left.getValue(pc) : right.getValue(pc);
}
Object val = left.getValue(pc);
if (val != null)
return val;
return right.getValue(pc);
}
use of lucee.runtime.interpreter.ref.var.Variable in project Lucee by lucee.
the class CFMLExpressionInterpreter method subDynamic.
private Ref subDynamic(Ref ref) throws PageException {
String name = null;
// Loop over nested Variables
while (cfml.isValidIndex()) {
// .
if (cfml.forwardIfCurrent('.')) {
// Extract next Var String
cfml.removeSpace();
name = identifier(true);
if (name == null)
throw new InterpreterException("Invalid identifier");
cfml.removeSpace();
ref = new Variable(ref, name, limited);
} else // []
if (cfml.forwardIfCurrent('[')) {
cfml.removeSpace();
ref = new Variable(ref, assignOp(), limited);
cfml.removeSpace();
if (!cfml.forwardIfCurrent(']'))
throw new InterpreterException("Invalid Syntax Closing []] not found");
} else // finish
{
break;
}
cfml.removeSpace();
if (cfml.isCurrent('(')) {
if (!(ref instanceof Set))
throw new InterpreterException("invalid syntax " + ref.getTypeName() + " can't called as function");
Set set = (Set) ref;
ref = new UDFCall(set.getParent(pc), set.getKey(pc), functionArg(name, false, null, ')'));
}
}
if (ref instanceof lucee.runtime.interpreter.ref.var.Scope) {
lucee.runtime.interpreter.ref.var.Scope s = (lucee.runtime.interpreter.ref.var.Scope) ref;
if (s.getScope() == Scope.SCOPE_ARGUMENTS || s.getScope() == Scope.SCOPE_LOCAL || s.getScope() == ScopeSupport.SCOPE_VAR) {
ref = new Bind(s);
}
}
return ref;
}
Aggregations