net.christopherschultz.evaluator.parser
Class ExpressionParser

java.lang.Object
  extended by net.christopherschultz.evaluator.parser.ExpressionParser

public class ExpressionParser
extends Object

A parser to convert string expressions into Expression objects for subsequent evaluation.

Version:
$Revision: 1.4 $ $Date: 2009-04-09 16:02:58 $
Author:
Chris Schultz
See Also:
Expression

Constructor Summary
ExpressionParser()
          Creates a new ExpressionParser.
 
Method Summary
 Expression parse(String expression)
          Parses the given string expression into a tree of evaluatable Expression objects.
static Expression parseExpression(String expression)
          A convenience method to create a new ExpressionParser and return an Expression object for that expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionParser

public ExpressionParser()
Creates a new ExpressionParser.

Method Detail

parse

public Expression parse(String expression)
                 throws ParseException
Parses the given string expression into a tree of evaluatable Expression objects.

Parameters:
expression - The string expression to parse.
Returns:
An Expression object which is the root of an expression evaluation tree.
Throws:
ParseException - If the expression was not parsable.

parseExpression

public static Expression parseExpression(String expression)
                                  throws ParseException
A convenience method to create a new ExpressionParser and return an Expression object for that expression.

Parameters:
expression - The string expression to parse.
Returns:
An Expression object which is the root of an expression evaluation tree.
Throws:
ParseException - If the expression was not parsable.