if (lookAhead(sql, ndx) == '*') {
ndx = consumeMultilineComment(sql, ndx, parents.peek());
continue;
}
else {
parents.peek().add(new GrammarPiece("/", ndx));
break;
}
case '-':
if (lookAhead(sql, ndx) == '-') {
ndx = consumeSinglelineComment(sql, ndx, parents.peek());
continue;
}
else if (Character.isDigit(lookAhead(sql, ndx))) {
ndx = consumeNumeric(sql, ndx, parents.peek());
continue;
}
else {
GrammarPiece grammarPiece = new GrammarPiece("-", ndx);
parents.peek().add(grammarPiece);
break;
}
case ';':
if (parents.size() == 2) {
paramId = 1;
CompositeNode comp = parents.pop();
comp.setEndPos(ndx);
parents.peek().add(comp);
parents.push(new StatementNode(ndx));
}
else {
parents.peek().add(new GrammarPiece(";", ndx));
}
break;
default:
if (Character.isWhitespace(c)) {
WhitespacePiece whitespacePiece = new WhitespacePiece(sql.substring(ndx, ndx + 1), ndx);
if (parents.peek().getLastNode() instanceof WhitespacePiece) {
((WhitespacePiece) parents.peek().getLastNode()).coalesce(whitespacePiece);
}
else {
parents.peek().add(whitespacePiece);
}
}
else if (Character.isDigit(c) || (c == '+' && Character.isDigit(lookAhead(sql, ndx)))) {
ndx = consumeNumeric(sql, ndx, parents.peek());
continue;
}
else if (Character.isJavaIdentifierStart(c)) {
ndx = consumeUnquotedIdentifier(sql, ndx, parents.peek());
continue;
}
else {
GrammarPiece grammarPiece = new GrammarPiece(sql.substring(ndx, ndx + 1), ndx);
if (parents.peek().getLastNode() instanceof GrammarPiece) {
((GrammarPiece) parents.peek().getLastNode()).coalesce(grammarPiece);
}
else {
parents.peek().add(grammarPiece);