/** * Parses a complete expression jex.term. Simply a wrapper for * a <code>parseAssign</code> method in order to signal that the assignment * operator '=' has the highest operator precedence. * * @param required true, if the expression is required. * @return The generated term. * @throws ParseException if a parse error occurs */ private Term parseTerm(final boolean required) throws ParseException { return parseAssign(required); }
/** * Parses an assignment expression <i>x '=' y</i>. * * @param required true, if the expression is required. * @return The generated term. * @throws ParseException if a parse error occurs */ private Term parseAssign(final boolean required) throws ParseException { Term t1 = parseConditional(required); while (t1 != null) { int tt = tokenizer.next(); if (tt == '=') { Term t2 = parseAssign(true); if (t1 instanceof Term.Ref && ((Term.Ref) t1).getVariable() != null) { t1 = new Term.Assign(t1, t2); } else { reportError("Variable expected on the left side of assignment '='."); } } else { tokenizer.pushBack(); break; } } return t1; }