DataType datatype = getDatatypeParser().parse(tokens);
if (datatype != null) {
getDatatypeParser().setPropertiesOnNode(functionNode, datatype);
} else {
String msg = DdlSequencerI18n.missingReturnTypeForFunction.text(functionName);
DdlParserProblem problem = new DdlParserProblem(Problems.WARNING, getCurrentMarkedPosition(), msg);
addProblem(problem, functionNode);
}
}
while (!isTerminator(tokens)) {
if (tokens.matches("LANGUAGE")) {
AstNode optionNode = nodeFactory().node("language", functionNode, TYPE_STATEMENT_OPTION);
if (tokens.canConsume("LANGUAGE", "JAVA")) {
optionNode.setProperty(VALUE, "LANGUAGE JAVA");
} else {
tokens.consume("LANGUAGE");
optionNode.setProperty(VALUE, "LANGUAGE");
}
} else if (tokens.canConsume("DETERMINISTIC")) {
AstNode optionNode = nodeFactory().node("deterministic", functionNode, TYPE_STATEMENT_OPTION);
optionNode.setProperty(VALUE, "DETERMINISTIC");
} else if (tokens.canConsume("NOT", "DETERMINISTIC")) {
AstNode optionNode = nodeFactory().node("deterministic", functionNode, TYPE_STATEMENT_OPTION);
optionNode.setProperty(VALUE, "NOT DETERMINISTIC");
} else if (tokens.canConsume("EXTERNAL", "NAME")) {
String extName = parseName(tokens);
AstNode optionNode = nodeFactory().node("externalName", functionNode, TYPE_STATEMENT_OPTION);
optionNode.setProperty(VALUE, "EXTERNAL NAME" + SPACE + extName);
} else if (tokens.canConsume("PARAMETER", "STYLE")) {
if (tokens.canConsume("JAVA")) {
functionNode.setProperty(PARAMETER_STYLE, "PARAMETER STYLE" + SPACE + "JAVA");
} else {
tokens.consume("DERBY_JDBC_RESULT_SET");
functionNode.setProperty(PARAMETER_STYLE, "PARAMETER STYLE" + SPACE + "DERBY_JDBC_RESULT_SET");
}
} else if (tokens.canConsume("NO", "SQL")) {
AstNode optionNode = nodeFactory().node("sqlStatus", functionNode, TYPE_STATEMENT_OPTION);
optionNode.setProperty(VALUE, "NO SQL");
} else if (tokens.canConsume("CONTAINS", "SQL")) {
AstNode optionNode = nodeFactory().node("sqlStatus", functionNode, TYPE_STATEMENT_OPTION);
optionNode.setProperty(VALUE, "CONTAINS SQL");
} else if (tokens.canConsume("READS", "SQL", "DATA")) {
AstNode optionNode = nodeFactory().node("sqlStatus", functionNode, TYPE_STATEMENT_OPTION);
optionNode.setProperty(VALUE, "READS SQL DATA");
} else if (tokens.canConsume("RETURNS", "NULL", "ON", "NULL", "INPUT")) {
AstNode optionNode = nodeFactory().node("nullInput", functionNode, TYPE_STATEMENT_OPTION);
optionNode.setProperty(VALUE, "RETURNS NULL ON NULL INPUT");
} else if (tokens.canConsume("CALLED", "ON", "NULL", "INPUT")) {
AstNode optionNode = nodeFactory().node("nullInput", functionNode, TYPE_STATEMENT_OPTION);
optionNode.setProperty(VALUE, "CALLED ON NULL INPUT");
} else {
String msg = DdlSequencerI18n.errorParsingDdlContent.text(functionName);
DdlParserProblem problem = new DdlParserProblem(Problems.ERROR, getCurrentMarkedPosition(), msg);
addProblem(problem, functionNode);
break;
}
}