Search in sources :

Example 26 with Ref

use of lucee.runtime.interpreter.ref.Ref in project Lucee by lucee.

the class CFMLExpressionInterpreter method eqvOp.

/**
 * Transfomiert eine  Equivalence (eqv) Operation.
 * <br />
 * EBNF:<br />
 * <code>xorOp {"eqv" spaces xorOp};</code>
 * @return CFXD Element
 * @throws PageException
 */
private Ref eqvOp() throws PageException {
    Ref ref = xorOp();
    while (cfml.forwardIfCurrent("eqv")) {
        cfml.removeSpace();
        ref = new EQV(ref, xorOp(), limited);
    }
    return ref;
}
Also used : Ref(lucee.runtime.interpreter.ref.Ref) EQV(lucee.runtime.interpreter.ref.op.EQV)

Example 27 with Ref

use of lucee.runtime.interpreter.ref.Ref in project Lucee by lucee.

the class CFMLExpressionInterpreter method negateMinusOp.

/**
 * Liest die Vordlobe einer Zahl ein
 * @return CFXD Element
 * @throws PageException
 */
private Ref negateMinusOp() throws PageException {
    // And Operation
    if (cfml.forwardIfCurrent('-')) {
        if (cfml.forwardIfCurrent('-')) {
            cfml.removeSpace();
            Ref expr = clip();
            Ref res = preciseMath ? new BigMinus(expr, new LNumber(new Double(1)), limited) : new Minus(expr, new LNumber(new Double(1)), limited);
            return new Assign(expr, res, limited);
        }
        cfml.removeSpace();
        return new Negate(clip(), limited);
    }
    if (cfml.forwardIfCurrent('+')) {
        if (cfml.forwardIfCurrent('+')) {
            cfml.removeSpace();
            Ref expr = clip();
            Ref res = preciseMath ? new BigPlus(expr, new LNumber(new Double(1)), limited) : new Plus(expr, new LNumber(new Double(1)), limited);
            return new Assign(expr, res, limited);
        }
        cfml.removeSpace();
        return new Casting("numeric", CFTypes.TYPE_NUMERIC, clip());
    }
    return clip();
}
Also used : Casting(lucee.runtime.interpreter.ref.cast.Casting) Ref(lucee.runtime.interpreter.ref.Ref) LNumber(lucee.runtime.interpreter.ref.literal.LNumber) BigPlus(lucee.runtime.interpreter.ref.op.BigPlus) Assign(lucee.runtime.interpreter.ref.var.Assign) DynAssign(lucee.runtime.interpreter.ref.var.DynAssign) Negate(lucee.runtime.interpreter.ref.op.Negate) Plus(lucee.runtime.interpreter.ref.op.Plus) BigPlus(lucee.runtime.interpreter.ref.op.BigPlus) BigMinus(lucee.runtime.interpreter.ref.op.BigMinus) BigMinus(lucee.runtime.interpreter.ref.op.BigMinus) Minus(lucee.runtime.interpreter.ref.op.Minus)

Example 28 with Ref

use of lucee.runtime.interpreter.ref.Ref in project Lucee by lucee.

the class CFMLExpressionInterpreter method andOp.

/**
 * Transfomiert eine  And (and) Operation. Im Gegensatz zu CFMX ,
 * werden "&&" Zeichen auch als And Operatoren anerkannt.
 * <br />
 * EBNF:<br />
 * <code>notOp {("and" | "&&") spaces notOp}; (* "&&" Existiert in CFMX nicht *)</code>
 * @return CFXD Element
 * @throws PageException
 */
private Ref andOp() throws PageException {
    Ref ref = notOp();
    while (cfml.isValidIndex() && (cfml.forwardIfCurrent("&&") || cfml.forwardIfCurrent("and"))) {
        cfml.removeSpace();
        ref = new And(ref, notOp(), limited);
    }
    return ref;
}
Also used : Ref(lucee.runtime.interpreter.ref.Ref) And(lucee.runtime.interpreter.ref.op.And)

Example 29 with Ref

use of lucee.runtime.interpreter.ref.Ref in project Lucee by lucee.

the class CFMLExpressionInterpreter method divMultiOp.

/**
 * Transfomiert die mathematischen Operatoren Mal und Durch (*,/).
 * <br />
 * EBNF:<br />
 * <code>expoOp {("*"|"/") spaces expoOp};</code>
 * @return CFXD Element
 * @throws PageException
 */
private Ref divMultiOp() throws PageException {
    Ref ref = expoOp();
    while (!cfml.isLast()) {
        // Multiply Operation
        if (cfml.forwardIfCurrent('*')) {
            ref = _multi(ref);
        } else // Divide Operation
        if (cfml.isCurrent('/') && (!cfml.isCurrent("/>"))) {
            cfml.next();
            ref = _div(ref);
        } else // Divide Operation
        if (cfml.isCurrent('\\')) {
            cfml.next();
            ref = _intdiv(ref);
        } else {
            break;
        }
    }
    return ref;
}
Also used : Ref(lucee.runtime.interpreter.ref.Ref)

Example 30 with Ref

use of lucee.runtime.interpreter.ref.Ref in project Lucee by lucee.

the class CFMLExpressionInterpreter method string.

/**
 * Transfomiert einen lierale Zeichenkette.
 * <br />
 * EBNF:<br />
 * <code>("'" {"##"|"''"|"#" impOp "#"| ?-"#"-"'" } "'") |
 *                     (""" {"##"|""""|"#" impOp "#"| ?-"#"-""" } """);</code>
 * @return CFXD Element
 * @throws PageException
 */
protected Ref string() throws PageException {
    // Init Parameter
    char quoter = cfml.getCurrentLower();
    LStringBuffer str = new LStringBuffer();
    Ref value = null;
    while (cfml.hasNext()) {
        cfml.next();
        // check sharp
        if (!limited && cfml.isCurrent('#')) {
            if (cfml.isNext('#')) {
                cfml.next();
                str.append('#');
            } else {
                cfml.next();
                cfml.removeSpace();
                if (!str.isEmpty() || value != null)
                    str.append(assignOp());
                else
                    value = assignOp();
                cfml.removeSpace();
                if (!cfml.isCurrent('#'))
                    throw new InterpreterException("Invalid Syntax Closing [#] not found");
            }
        } else if (cfml.isCurrent(quoter)) {
            if (cfml.isNext(quoter)) {
                cfml.next();
                str.append(quoter);
            } else {
                break;
            }
        } else // all other character
        {
            str.append(cfml.getCurrent());
        }
    }
    if (!cfml.forwardIfCurrent(quoter))
        throw new InterpreterException("Invalid String Literal Syntax Closing [" + quoter + "] not found");
    cfml.removeSpace();
    mode = STATIC;
    if (value != null) {
        if (str.isEmpty())
            return value;
        return new Concat(value, str, limited);
    }
    return str;
}
Also used : Concat(lucee.runtime.interpreter.ref.op.Concat) Ref(lucee.runtime.interpreter.ref.Ref) LStringBuffer(lucee.runtime.interpreter.ref.literal.LStringBuffer)

Aggregations

Ref (lucee.runtime.interpreter.ref.Ref)34 Assign (lucee.runtime.interpreter.ref.var.Assign)9 DynAssign (lucee.runtime.interpreter.ref.var.DynAssign)9 ArrayList (java.util.ArrayList)6 Casting (lucee.runtime.interpreter.ref.cast.Casting)6 BIFCall (lucee.runtime.interpreter.ref.func.BIFCall)6 LString (lucee.runtime.interpreter.ref.literal.LString)6 FunctionLibFunctionArg (lucee.transformer.library.function.FunctionLibFunctionArg)5 ParserString (lucee.commons.lang.ParserString)4 FunctionLibFunction (lucee.transformer.library.function.FunctionLibFunction)4 ExpressionException (lucee.runtime.exp.ExpressionException)3 LFunctionValue (lucee.runtime.interpreter.ref.literal.LFunctionValue)3 BigPlus (lucee.runtime.interpreter.ref.op.BigPlus)3 Plus (lucee.runtime.interpreter.ref.op.Plus)3 BigIntDiv (lucee.runtime.interpreter.ref.op.BigIntDiv)2 BigMinus (lucee.runtime.interpreter.ref.op.BigMinus)2 Concat (lucee.runtime.interpreter.ref.op.Concat)2 IntDiv (lucee.runtime.interpreter.ref.op.IntDiv)2 Minus (lucee.runtime.interpreter.ref.op.Minus)2 Key (lucee.runtime.type.Collection.Key)2