use of org.dbflute.twowaysql.node.ForNode.LoopVariableType in project dbflute-core by dbflute.
the class LoopAbstractNode method accept.
// ===================================================================================
// Accept
// ======
public void accept(CommandContext ctx) {
final LoopVariableType type = getLoopVariableType();
final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
br.addNotice("The " + type.name() + " comment was out of FOR comment!");
br.addItem("Advice");
br.addElement("A " + type.name() + " comment should be in FOR comment scope.");
br.addElement("For example:");
br.addElement(" (x):");
br.addElement(" /*" + type.name() + "*/.../*END*/");
br.addElement(" /*FOR*/.../*END*/");
br.addElement(" (o):");
br.addElement(" /*FOR*/");
br.addElement(" /*" + type.name() + "*/.../*END*/");
br.addElement(" /*END*/");
br.addItem(type.name() + " Comment Expression");
br.addElement(_expression);
br.addItem("Specified SQL");
br.addElement(_specifiedSql);
final String msg = br.buildExceptionMessage();
throw new LoopVariableCommentOutOfForCommentException(msg);
}
use of org.dbflute.twowaysql.node.ForNode.LoopVariableType in project dbflute-core by dbflute.
the class SqlAnalyzer method parseLoopVariable.
protected void parseLoopVariable() {
// should be in FOR comment scope
final String comment = _tokenizer.getToken();
final String code = Srl.substringFirstFront(comment, " ");
if (Srl.is_Null_or_TrimmedEmpty(code)) {
// no way
String msg = "Unknown loop variable comment: " + comment;
throw new IllegalStateException(msg);
}
final LoopVariableType type = LoopVariableType.codeOf(code);
if (type == null) {
// no way
String msg = "Unknown loop variable comment: " + comment;
throw new IllegalStateException(msg);
}
final String condition = comment.substring(type.name().length()).trim();
final LoopAbstractNode loopFirstNode = createLoopFirstNode(condition, type);
peek().addChild(loopFirstNode);
if (Srl.count(condition, "'") < 2) {
push(loopFirstNode);
parseEnd();
}
}
Aggregations