use of cn.bran.japid.compiler.Tag.TagIf in project japid42 by branaway.
the class JapidAbstractCompiler method handleOpenElseIf.
private void handleOpenElseIf(int i, String expr, boolean negative) {
// expr = expr.substring(1).trim();
// end previous if shadow and star a new one
verifyExpr(expr);
Tag tagShadow = tagsStackShadow.peek();
if (tagShadow instanceof TagIf) {
tagsStackShadow.pop();
// to close an open if
// start a new if
Tag.TagIf iftag = new Tag.TagIf(expr, parser.getLineNumber());
pushToStack(iftag);
expr = "} else if(" + (negative ? "!" : "") + "asBoolean(" + expr + ")) {";
print(expr);
markLine(parser.getLineNumber() + i);
println();
} else {
throw new JapidCompilationException(template, parser.getLineNumber(), "the open \"else if\" statement is not properly matched to a previous if");
}
}
Aggregations