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;
}
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);
}
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);
}
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);
}
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);
}
Aggregations