Search in sources :

Example 1 with LoopAbstractNode

use of org.dbflute.twowaysql.node.LoopAbstractNode 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();
    }
}
Also used : LoopAbstractNode(org.dbflute.twowaysql.node.LoopAbstractNode) LoopVariableType(org.dbflute.twowaysql.node.ForNode.LoopVariableType)

Aggregations

LoopVariableType (org.dbflute.twowaysql.node.ForNode.LoopVariableType)1 LoopAbstractNode (org.dbflute.twowaysql.node.LoopAbstractNode)1