use of lucee.transformer.bytecode.statement.Condition in project Lucee by lucee.
the class AbstrCFMLScriptTransformer method ifStatement.
/**
* Liest ein if Statement ein.
* <br />
* EBNF:<br />
* <code>spaces condition spaces ")" spaces block {"else if" spaces "(" elseifStatement spaces }
* [("else" spaces "(" | "else ") elseStatement spaces];</code>
* @return if Statement
* @throws TemplateException
*/
private final Statement ifStatement(ExprData data) throws TemplateException {
if (!data.srcCode.forwardIfCurrent("if", '('))
return null;
Position line = data.srcCode.getPosition();
Body body = new BodyBase(data.factory);
Condition cont = new Condition(data.factory, condition(data), body, line, null);
if (!data.srcCode.forwardIfCurrent(')'))
throw new TemplateException(data.srcCode, "if statement must end with a [)]");
// ex block
statement(data, body, CTX_IF);
// else if
comments(data);
while (elseifStatement(data, cont)) {
comments(data);
}
// else
if (elseStatement(data, cont)) {
comments(data);
}
cont.setEnd(data.srcCode.getPosition());
return cont;
}
Aggregations