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