Search in sources :

Example 1 with UDFCall

use of lucee.runtime.interpreter.ref.func.UDFCall in project Lucee by lucee.

the class CFMLExpressionInterpreter method startElement.

/**
 * Extrahiert den Start Element einer Variale,
 * dies ist entweder eine Funktion, eine Scope Definition oder eine undefinierte Variable.
 * <br />
 * EBNF:<br />
 * <code>identifier "(" functionArg ")" | scope | identifier;</code>
 * @param name Einstiegsname
 * @return CFXD Element
 * @throws PageException
 */
private Ref startElement(String name) throws PageException {
    // check function
    if (!limited && cfml.isCurrent('(')) {
        FunctionLibFunction function = fld.getFunction(name);
        Ref[] arguments = functionArg(name, true, function, ')');
        if (function != null)
            return new BIFCall(function, arguments);
        Ref ref = new lucee.runtime.interpreter.ref.var.Scope(Scope.SCOPE_UNDEFINED);
        return new UDFCall(ref, name, arguments);
    }
    // check scope
    return scope(name);
}
Also used : UDFCall(lucee.runtime.interpreter.ref.func.UDFCall) Ref(lucee.runtime.interpreter.ref.Ref) Scope(lucee.runtime.type.scope.Scope) FunctionLibFunction(lucee.transformer.library.function.FunctionLibFunction) BIFCall(lucee.runtime.interpreter.ref.func.BIFCall)

Example 2 with UDFCall

use of lucee.runtime.interpreter.ref.func.UDFCall 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;
}
Also used : UDFCall(lucee.runtime.interpreter.ref.func.UDFCall) Bind(lucee.runtime.interpreter.ref.var.Bind) Variable(lucee.runtime.interpreter.ref.var.Variable) Set(lucee.runtime.interpreter.ref.Set) LString(lucee.runtime.interpreter.ref.literal.LString) ParserString(lucee.commons.lang.ParserString) Scope(lucee.runtime.type.scope.Scope)

Aggregations

UDFCall (lucee.runtime.interpreter.ref.func.UDFCall)2 Scope (lucee.runtime.type.scope.Scope)2 ParserString (lucee.commons.lang.ParserString)1 Ref (lucee.runtime.interpreter.ref.Ref)1 Set (lucee.runtime.interpreter.ref.Set)1 BIFCall (lucee.runtime.interpreter.ref.func.BIFCall)1 LString (lucee.runtime.interpreter.ref.literal.LString)1 Bind (lucee.runtime.interpreter.ref.var.Bind)1 Variable (lucee.runtime.interpreter.ref.var.Variable)1 FunctionLibFunction (lucee.transformer.library.function.FunctionLibFunction)1