use of lucee.transformer.bytecode.op.OpVariable in project Lucee by lucee.
the class AbstrCFMLExprTransformer method concatOp.
/**
* Transfomiert eine Konkatinations-Operator (&) Operation. Im Gegensatz zu CFMX ,
* wird das "!" Zeichen auch als Not Operator anerkannt.
* <br />
* EBNF:<br />
* <code>plusMinusOp {"&" spaces concatOp};</code>
* @return CFXD Element
* @throws TemplateException
*/
private Expression concatOp(ExprData data) throws TemplateException {
Expression expr = plusMinusOp(data);
while (data.srcCode.isCurrent('&') && !data.srcCode.isCurrent("&&")) {
data.srcCode.next();
// &=
if (data.srcCode.isCurrent('=') && expr instanceof Variable) {
data.srcCode.next();
comments(data);
Expression value = assignOp(data);
expr = new OPUnary((Variable) expr, value, OPUnary.PRE, OPUnary.CONCAT, expr.getStart(), data.srcCode.getPosition());
// ExprString res = OpString.toExprString(expr, right);
// expr=new OpVariable((Variable)expr,res,data.cfml.getPosition());
} else {
comments(data);
expr = data.factory.opString(expr, plusMinusOp(data));
}
}
return expr;
}
use of lucee.transformer.bytecode.op.OpVariable in project Lucee by lucee.
the class AbstrCFMLExprTransformer method _plusMinusOp.
private Expression _plusMinusOp(ExprData data, Expression expr, int opr) throws TemplateException {
// plus|Minus Assignment
if (data.srcCode.isCurrent('=') && expr instanceof Variable) {
data.srcCode.next();
comments(data);
Expression value = assignOp(data);
// if(opr==OpDouble.MINUS) value=OpNegateNumber.toExprDouble(value, null, null);
expr = new OPUnary((Variable) expr, value, OPUnary.PRE, opr, expr.getStart(), data.srcCode.getPosition());
// ExprDouble res = OpDouble.toExprDouble(expr, right,opr);
// expr=new OpVariable((Variable)expr,res,data.cfml.getPosition());
} else {
comments(data);
expr = OpDouble.toExprDouble(expr, modOp(data), opr);
}
return expr;
}
use of lucee.transformer.bytecode.op.OpVariable 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.bytecode.op.OpVariable 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.bytecode.op.OpVariable 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