protected void prepareUnaryExpressions() {
Stack<SimpleNode> stack = new Stack<SimpleNode>();
for (SimpleNode node : nodes) {
if (node instanceof UnaryExpression) {
UnaryExpression token = (UnaryExpression) node;
// remember the logical operator
String operator = token.getOperator().toString();
SimpleNode previous = stack.isEmpty() ? null : stack.pop();
if (previous == null) {
throw new SimpleParserException("Unary operator " + operator + " has no left hand side token", token.getToken().getIndex());
} else {
token.acceptLeft(previous);
}
}
stack.push(node);
}