Search in sources :

Example 1 with Expression

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

the class Component method evaluate.

@Override
public TagLibTag evaluate(TagLibTag tagLibTag, Tag tag) throws AttributeEvaluatorException {
    tagLibTag.setParseBody(false);
    Attribute attr = tag.getAttribute("output");
    if (attr != null) {
        Expression expr = attr.getValue();
        if (!(expr instanceof LitBoolean))
            throw new AttributeEvaluatorException("Attribute output of the Tag Component, must be a static boolean value (true or false)");
        if (((LitBoolean) expr).getBooleanValue())
            tagLibTag.setParseBody(true);
    }
    return tagLibTag;
}
Also used : AttributeEvaluatorException(lucee.transformer.cfml.attributes.AttributeEvaluatorException) Attribute(lucee.transformer.bytecode.statement.tag.Attribute) Expression(lucee.transformer.expression.Expression) LitBoolean(lucee.transformer.expression.literal.LitBoolean)

Example 2 with Expression

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

the class Function method evaluate.

@Override
public TagLibTag evaluate(TagLibTag tagLibTag, Tag tag) throws AttributeEvaluatorException {
    tagLibTag.setParseBody(false);
    Attribute attrOutput = tag.getAttribute("output");
    if (attrOutput == null)
        return tagLibTag;
    Expression expr = CastBoolean.toExprBoolean(attrOutput.getValue());
    if (!(expr instanceof LitBoolean))
        throw new AttributeEvaluatorException("Attribute output of the Tag Function, must be a literal boolean value (true or false)");
    boolean output = ((LitBoolean) expr).getBooleanValue();
    if (output)
        tagLibTag.setParseBody(true);
    return tagLibTag;
}
Also used : AttributeEvaluatorException(lucee.transformer.cfml.attributes.AttributeEvaluatorException) Attribute(lucee.transformer.bytecode.statement.tag.Attribute) Expression(lucee.transformer.expression.Expression) LitBoolean(lucee.transformer.expression.literal.LitBoolean)

Example 3 with Expression

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

the class ArrayToList method execute.

@Override
public void execute(BIF bif, FunctionLibFunction flf) throws TemplateException {
    Argument[] args = bif.getArguments();
    Argument arg = args[0];
    Expression value = arg.getValue();
    if (value instanceof Cast) {
        value = ((Cast) value).getExpr();
    }
    if (value instanceof Variable) {
        ((Variable) value).setAsCollection(Boolean.TRUE);
    }
}
Also used : Cast(lucee.transformer.bytecode.cast.Cast) Variable(lucee.transformer.expression.var.Variable) Argument(lucee.transformer.bytecode.expression.var.Argument) Expression(lucee.transformer.expression.Expression)

Example 4 with Expression

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

the class IsNull method execute.

@Override
public void execute(BIF bif, FunctionLibFunction flf) throws TemplateException {
    Argument arg = bif.getArguments()[0];
    Expression value = arg.getValue();
    // set all member to safe navigated
    if (value instanceof Variable) {
        Variable var = ((Variable) value);
        /* LDEV-1201 List<Member> members = var.getMembers();
			for(Member m:members) {
				m.setSafeNavigated(true);
			}*/
        var.setDefaultValue(value.getFactory().createNull());
    }
}
Also used : Variable(lucee.transformer.expression.var.Variable) Argument(lucee.transformer.bytecode.expression.var.Argument) Expression(lucee.transformer.expression.Expression)

Example 5 with Expression

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

the class PrecisionEvaluate method toOpBigDecimal.

private OpBigDecimal toOpBigDecimal(OpDouble op) {
    Expression left = op.getLeft();
    Expression right = op.getRight();
    if (left instanceof OpDouble)
        left = toOpBigDecimal((OpDouble) left);
    if (right instanceof OpDouble)
        right = toOpBigDecimal((OpDouble) right);
    return new OpBigDecimal(left, right, op.getOperation());
}
Also used : OpDouble(lucee.transformer.bytecode.op.OpDouble) Expression(lucee.transformer.expression.Expression) OpBigDecimal(lucee.transformer.bytecode.op.OpBigDecimal)

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