use of lucee.transformer.bytecode.statement.Condition.Pair in project Lucee by lucee.
the class AbstrCFMLScriptTransformer method elseStatement.
/**
* Liest ein else Statement ein.
* <br />
* EBNF:<br />
* <code>block;</code>
* @return else Statement
* @throws TemplateException
*/
private final boolean elseStatement(ExprData data, Condition cont) throws TemplateException {
if (!data.srcCode.forwardIfCurrent("else", '{') && !data.srcCode.forwardIfCurrent("else ") && !data.srcCode.forwardIfCurrent("else", '/'))
return false;
// start (
data.srcCode.previous();
// ex block
Body body = new BodyBase(data.factory);
Pair p = cont.setElse(body, data.srcCode.getPosition(), null);
statement(data, body, CTX_ELSE);
p.end = data.srcCode.getPosition();
return true;
}
use of lucee.transformer.bytecode.statement.Condition.Pair in project Lucee by lucee.
the class AbstrCFMLScriptTransformer method elseifStatement.
/**
* Liest ein else if Statement ein.
* <br />
* EBNF:<br />
* <code>spaces condition spaces ")" spaces block;</code>
* @return else if Statement
* @throws TemplateException
*/
private final boolean elseifStatement(ExprData data, Condition cont) throws TemplateException {
int pos = data.srcCode.getPos();
if (!data.srcCode.forwardIfCurrent("else"))
return false;
comments(data);
if (!data.srcCode.forwardIfCurrent("if", '(')) {
data.srcCode.setPos(pos);
return false;
}
Position line = data.srcCode.getPosition();
Body body = new BodyBase(data.factory);
Pair pair = cont.addElseIf(condition(data), body, line, null);
if (!data.srcCode.forwardIfCurrent(')'))
throw new TemplateException(data.srcCode, "else if statement must end with a [)]");
// ex block
statement(data, body, CTX_ELSE_IF);
pair.end = data.srcCode.getPosition();
return true;
}
Aggregations