return new ListExpression(first.getUnderlyingStructure(), expressions, operator);
}
private Expression createBinaryExpression(HiddenTokenAwareTree parent, LinkedList<HiddenTokenAwareTree> members) {
// this must represent a term. Otherwise we are doomed anyway.
Expression head = (Expression) switchOn(members.removeFirst());
while (!members.isEmpty()) {
BinaryExpressionOperator operator = createBinaryOperator(members.removeFirst());
if (members.isEmpty())
return new BinaryExpression(parent, head, operator, null);
Expression next = (Expression) switchOn(members.removeFirst());
head = new BinaryExpression(parent, head, operator, next);
}
return head;
}