private IExpressionNode assignmentOp(IExpressionNode variable) throws ParserException { if (lookahead.token == Token.EQUALS) { nextToken(); IExpressionNode newVariable = expression(); if (!(variable.getType() == IExpressionNode.VARIABLE_NODE)) throw new ParserException(String.format(ERR_VARIABLE, variable.toString())); try { variable.accept( new SetVariable(((VariableExpressionNode) variable).getName(), newVariable.getValue())); } catch (EvaluationException ex) { throw new ParserException( String.format("The variable [%s] did not return a valid value", newVariable)); } } return variable; }