*
* @throws SyntaxException if the given text doesn't form a valid
* expression.
*/
public static LinkedListTree parseExpr(String expr) {
AS3Parser parser = ASTUtils.parse(expr + ")");
try {
LinkedListTree result = tree(parser.expression());
ensureRemainingInputIs(parser.getTokenStream(), AS3Parser.RPAREN, expr);
// zap the trailing ')'
result.getStopToken().setNext(null);
return result;
} catch (RecognitionException e) {
throw new SyntaxException("invalid expression "+ActionScriptFactory.str(expr), e);