use of lucee.transformer.bytecode.BodyBase in project Lucee by lucee.
the class AbstrCFMLScriptTransformer method whileStatement.
/**
* Liest ein while Statement ein.
* <br />
* EBNF:<br />
* <code>spaces condition spaces ")" spaces block;</code>
* @return while Statement
* @throws TemplateException
*/
private final While whileStatement(ExprData data) throws TemplateException {
int pos = data.srcCode.getPos();
// id
String id = variableDec(data, false);
if (id == null) {
data.srcCode.setPos(pos);
return null;
}
if (id.equalsIgnoreCase("while")) {
id = null;
data.srcCode.removeSpace();
if (!data.srcCode.forwardIfCurrent('(')) {
data.srcCode.setPos(pos);
return null;
}
} else {
data.srcCode.removeSpace();
if (!data.srcCode.forwardIfCurrent(':')) {
data.srcCode.setPos(pos);
return null;
}
data.srcCode.removeSpace();
if (!data.srcCode.forwardIfCurrent("while", '(')) {
data.srcCode.setPos(pos);
return null;
}
}
Position line = data.srcCode.getPosition();
Body body = new BodyBase(data.factory);
While whil = new While(condition(data), body, line, null, id);
if (!data.srcCode.forwardIfCurrent(')'))
throw new TemplateException(data.srcCode, "while statement must end with a [)]");
statement(data, body, CTX_WHILE);
whil.setEnd(data.srcCode.getPosition());
return whil;
}
use of lucee.transformer.bytecode.BodyBase in project Lucee by lucee.
the class AbstrCFMLScriptTransformer method defaultStatement.
/**
* Liest ein default Statement ein
* @return default Statement
* @throws TemplateException
*/
private final boolean defaultStatement(ExprData data, Switch swit) throws TemplateException {
if (!data.srcCode.forwardIfCurrent("default", ':'))
return false;
// int line=data.srcCode.getLine();
Body body = new BodyBase(data.factory);
swit.setDefaultCase(body);
switchBlock(data, body);
return true;
}
use of lucee.transformer.bytecode.BodyBase in project Lucee by lucee.
the class AbstrCFMLScriptTransformer method finallyStatement.
private final boolean finallyStatement(ExprData data, TryCatchFinally tcf) throws TemplateException {
if (!data.srcCode.forwardIfCurrent("finally", '{') && !data.srcCode.forwardIfCurrent("finally ") && !data.srcCode.forwardIfCurrent("finally", '/'))
return false;
// start (
data.srcCode.previous();
// ex block
Body body = new BodyBase(data.factory);
tcf.setFinally(body, data.srcCode.getPosition());
statement(data, body, CTX_FINALLY);
return true;
}
use of lucee.transformer.bytecode.BodyBase in project Lucee by lucee.
the class AbstrCFMLScriptTransformer method createStaticTag.
public static TagOther createStaticTag(ExprData data, Position start) throws TemplateException {
TagLibTag tlt = CFMLTransformer.getTLT(data.srcCode, "static", data.config.getIdentification());
BodyBase body = new BodyBase(data.factory);
TagOther tag = new TagOther(data.factory, start, data.srcCode.getPosition());
tag.setTagLibTag(tlt);
tag.setBody(body);
data.ep.add(tlt, tag, data.flibs, data.srcCode);
return tag;
}
use of lucee.transformer.bytecode.BodyBase 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