{
found = p.parseString("select");
}
if (!found)
{
throw new QueryCompilerSyntaxException("Expected keyword SELECT", p.getIndex(), p.getInput(), new String[]{"SELECT"});
}
Node select = new Node(Node.OPERATOR, "select");
boolean unique = p.parseString("UNIQUE");
if (!unique)
{
unique = p.parseString("unique");
}
if (unique)
{
select.appendChildNode(new Node(Node.OPERATOR, "unique"));
}
Node[] result = compileTupple(p);
if (result.length > 0)
{
select.appendChildNode(result);
}
boolean into = p.parseString("INTO");
if (!into)
{
into = p.parseString("into");
}
if (into)
{
Node node = new Node(Node.OPERATOR, "into");
select.appendChildNode(node);
Node intoExpr = compileExpression();
node.appendChildNode(intoExpr);
}
boolean from = p.parseString("FROM");
if (!from)
{
from = p.parseString("from");
}
if (from)
{
Node fromExpr = compileExpression();
Node node = new Node(Node.OPERATOR, "from");
select.appendChildNode(node);
node.appendChildNode(fromExpr);
}
boolean where = p.parseString("WHERE");
if (!where)
{
where = p.parseString("where");
}
if (where)
{
Node whereExpr = compileExpression();
Node node = new Node(Node.OPERATOR, "where");
select.appendChildNode(node);
node.appendChildNode(whereExpr);
}
boolean variables = p.parseString("VARIABLES");
if (!variables)
{
variables = p.parseString("variables");
}
if (variables)
{
Node[][] variablesExpr = compileVariables(p);
Node node = new Node(Node.OPERATOR, "variables");
select.appendChildNode(node);
node.appendChildNode(variablesExpr);
}
boolean parameters = p.parseString("PARAMETERS");
if (!parameters)
{
parameters = p.parseString("parameters");
}
if (parameters)
{
Node[][] parametersExpr = compileParameters(p);
Node node = new Node(Node.OPERATOR, "parameters");
select.appendChildNode(node);
node.appendChildNode(parametersExpr);
}
List imports = new ArrayList();
while (p.parseString("import"))
{
compilePrimary();
if (stack.isEmpty())
{
throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
}
imports.add(stack.pop());
if (!p.parseString(";"))
{
break;