Class ExpressionFactory

java.lang.Object
com.blackrook.expression.ExpressionFactory

public final class ExpressionFactory extends Object
Creates expression objects from input text.
Author:
Matthew Tropiano
  • Constructor Details

    • ExpressionFactory

      public ExpressionFactory()
  • Method Details

    • parseExpression

      public static Expression parseExpression(String inputString)
      Parses a single-line expression. The expression returned may be a reference to an expression parsed before, due to intern-ing it.
      Parameters:
      inputString - the input string to parse from.
      Returns:
      the expression parsed.
      Throws:
      ExpressionParseException - if a parse error occurs.
    • parseExpressionBlock

      public static Expression parseExpressionBlock(String inputString)
      Parses an expression block (multi-line/statement expression). The expression returned may be a reference to an expression parsed before, due to intern-ing it.
      Parameters:
      inputString - the input string to parse from.
      Returns:
      the expression parsed.
      Throws:
      ExpressionParseException - if a parse error occurs.
    • parseExpression

      public static Expression parseExpression(String inputString, ExpressionFunctionResolver resolver)
      Parses a single-line expression. The expression returned may be a reference to an expression parsed before, due to intern-ing it.
      Parameters:
      inputString - the input string to parse from.
      resolver - the resolver object for resolving functions in the script.
      Returns:
      the expression parsed.
      Throws:
      ExpressionParseException - if a parse error occurs.
    • parseExpressionBlock

      public static Expression parseExpressionBlock(String inputString, ExpressionFunctionResolver resolver)
      Parses an expression block (multi-line/statement expression). The expression returned may be a reference to an expression parsed before, due to intern-ing it.
      Parameters:
      inputString - the input string to parse from.
      resolver - the resolver object for resolving functions in the script.
      Returns:
      the expression parsed.
      Throws:
      ExpressionParseException - if a parse error occurs.
    • parseExpression

      public static Expression parseExpression(Reader reader, ExpressionFunctionResolver resolver)
      Parses a single-line expression. The expression returned may be a reference to an expression parsed before, due to intern-ing it.
      Parameters:
      reader - the reader to parse from.
      resolver - the resolver object for resolving functions in the script.
      Returns:
      the expression parsed.
      Throws:
      ExpressionParseException - if a parse error occurs.
    • parseExpressionBlock

      public static Expression parseExpressionBlock(Reader reader, ExpressionFunctionResolver resolver)
      Parses an expression block (multi-line/statement expression). The expression returned may be a reference to an expression parsed before, due to intern-ing it.
      Parameters:
      reader - the reader to parse from.
      resolver - the resolver object for resolving functions in the script.
      Returns:
      the expression parsed.
      Throws:
      ExpressionParseException - if a parse error occurs.