Search in sources :

Example 66 with Expression

use of lucee.transformer.expression.Expression in project Lucee by lucee.

the class AbstrCFMLExprTransformer method eqvOp.

/**
 * Transfomiert eine  Equivalence (eqv) Operation.
 * <br />
 * EBNF:<br />
 * <code>xorOp {"eqv" spaces xorOp};</code>
 * @return CFXD Element
 * @throws TemplateException
 */
private Expression eqvOp(ExprData data) throws TemplateException {
    Expression expr = xorOp(data);
    while (data.srcCode.forwardIfCurrentAndNoWordAfter("eqv")) {
        comments(data);
        expr = data.factory.opBool(expr, xorOp(data), Factory.OP_BOOL_EQV);
    }
    return expr;
}
Also used : FunctionAsExpression(lucee.transformer.bytecode.expression.FunctionAsExpression) Expression(lucee.transformer.expression.Expression)

Example 67 with Expression

use of lucee.transformer.expression.Expression in project Lucee by lucee.

the class AbstrCFMLExprTransformer method transformAsString.

protected Expression transformAsString(ExprData data, String[] breakConditions) throws TemplateException {
    Expression el = null;
    // parse the houle Page String
    comments(data);
    // String
    if ((el = string(data)) != null) {
        data.mode = STATIC;
        return el;
    }
    // Sharp
    if ((el = sharp(data)) != null) {
        data.mode = DYNAMIC;
        return el;
    }
    // Simple
    return simple(data, breakConditions);
}
Also used : FunctionAsExpression(lucee.transformer.bytecode.expression.FunctionAsExpression) Expression(lucee.transformer.expression.Expression)

Example 68 with Expression

use of lucee.transformer.expression.Expression in project Lucee by lucee.

the class AbstrCFMLExprTransformer method _divMultiOp.

private Expression _divMultiOp(ExprData data, Expression expr, int iOp) throws TemplateException {
    if (data.srcCode.isCurrent('=') && expr instanceof Variable) {
        data.srcCode.next();
        comments(data);
        Expression value = assignOp(data);
        return new OPUnary((Variable) expr, value, OPUnary.PRE, iOp, expr.getStart(), data.srcCode.getPosition());
    // ExprDouble res = OpDouble.toExprDouble(expr, right,iOp);
    // return new OpVariable((Variable)expr,res,data.cfml.getPosition());
    }
    comments(data);
    return OpDouble.toExprDouble(expr, expoOp(data), iOp);
}
Also used : OpVariable(lucee.transformer.bytecode.op.OpVariable) Variable(lucee.transformer.expression.var.Variable) FunctionAsExpression(lucee.transformer.bytecode.expression.FunctionAsExpression) Expression(lucee.transformer.expression.Expression) OPUnary(lucee.transformer.bytecode.op.OPUnary)

Example 69 with Expression

use of lucee.transformer.expression.Expression in project Lucee by lucee.

the class AbstrCFMLExprTransformer method negatePlusMinusOp.

/**
 * Negate Numbers
 * @return CFXD Element
 * @throws TemplateException
 */
private Expression negatePlusMinusOp(ExprData data) throws TemplateException {
    // And Operation
    Position line = data.srcCode.getPosition();
    if (data.srcCode.forwardIfCurrent('-')) {
        // pre increment
        if (data.srcCode.forwardIfCurrent('-')) {
            comments(data);
            Expression expr = clip(data);
            return new OPUnary((Variable) expr, data.factory.DOUBLE_ONE(), OPUnary.PRE, OpDouble.MINUS, line, data.srcCode.getPosition());
        // ExprDouble res = OpDouble.toExprDouble(expr, LitDouble.toExprDouble(1D),OpDouble.MINUS);
        // return new OpVariable((Variable)expr,res,data.cfml.getPosition());
        }
        comments(data);
        return OpNegateNumber.toExprDouble(clip(data), OpNegateNumber.MINUS, line, data.srcCode.getPosition());
    } else if (data.srcCode.forwardIfCurrent('+')) {
        if (data.srcCode.forwardIfCurrent('+')) {
            comments(data);
            Expression expr = clip(data);
            return new OPUnary((Variable) expr, data.factory.DOUBLE_ONE(), OPUnary.PRE, OpDouble.PLUS, line, data.srcCode.getPosition());
        }
        comments(data);
        // OpNegateNumber.toExprDouble(clip(),OpNegateNumber.PLUS,line);
        return data.factory.toExprDouble(clip(data));
    }
    return clip(data);
}
Also used : OpVariable(lucee.transformer.bytecode.op.OpVariable) Variable(lucee.transformer.expression.var.Variable) Position(lucee.transformer.Position) FunctionAsExpression(lucee.transformer.bytecode.expression.FunctionAsExpression) Expression(lucee.transformer.expression.Expression) OPUnary(lucee.transformer.bytecode.op.OPUnary)

Example 70 with Expression

use of lucee.transformer.expression.Expression in project Lucee by lucee.

the class AbstrCFMLExprTransformer method _modOp.

private Expression _modOp(ExprData data, Expression expr) throws TemplateException {
    if (data.srcCode.isCurrent('=') && expr instanceof Variable) {
        data.srcCode.next();
        comments(data);
        Expression right = assignOp(data);
        ExprDouble res = OpDouble.toExprDouble(expr, right, OpDouble.MODULUS);
        return new OpVariable((Variable) expr, res, data.srcCode.getPosition());
    }
    comments(data);
    return OpDouble.toExprDouble(expr, expoOp(data), OpDouble.MODULUS);
}
Also used : OpVariable(lucee.transformer.bytecode.op.OpVariable) Variable(lucee.transformer.expression.var.Variable) ExprDouble(lucee.transformer.expression.ExprDouble) OpVariable(lucee.transformer.bytecode.op.OpVariable) FunctionAsExpression(lucee.transformer.bytecode.expression.FunctionAsExpression) Expression(lucee.transformer.expression.Expression)

Aggregations

Expression (lucee.transformer.expression.Expression)74 FunctionAsExpression (lucee.transformer.bytecode.expression.FunctionAsExpression)34 LitString (lucee.transformer.expression.literal.LitString)25 TemplateException (lucee.runtime.exp.TemplateException)19 Attribute (lucee.transformer.bytecode.statement.tag.Attribute)16 Variable (lucee.transformer.expression.var.Variable)16 Body (lucee.transformer.bytecode.Body)11 ExprString (lucee.transformer.expression.ExprString)11 GeneratorAdapter (org.objectweb.asm.commons.GeneratorAdapter)11 Position (lucee.transformer.Position)10 OpVariable (lucee.transformer.bytecode.op.OpVariable)10 LitBoolean (lucee.transformer.expression.literal.LitBoolean)8 Literal (lucee.transformer.expression.literal.Literal)8 ArrayList (java.util.ArrayList)7 TransformerException (lucee.transformer.TransformerException)7 BodyBase (lucee.transformer.bytecode.BodyBase)7 Statement (lucee.transformer.bytecode.Statement)7 Argument (lucee.transformer.bytecode.expression.var.Argument)7 PrintOut (lucee.transformer.bytecode.statement.PrintOut)6 FunctionBody (lucee.transformer.bytecode.FunctionBody)5