Packages

p

net.totietje

evaluator

package evaluator

The evaluator package is designed to simplify the process of parsing a string.

The work of parsing a string is reduced to just tokenizing an expression, that is, breaking it down into its principal parts. The AbstractEvaluator class will handle the rest.

The AbstractTokenizer makes this even easier, though it is only applicable in some situations.

Source
package.scala
See also

AbstractTokenizer

Tokenizer

AbstractEvaluator

Evaluator

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. evaluator
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract class AbstractEvaluator [R] extends Evaluator[R]

    A skeletal implementation of the Evaluator class to avoid duplication of common logic.

    A skeletal implementation of the Evaluator class to avoid duplication of common logic.

    This class is applicable if, and only if, for each character it is unambiguous whether it is part of a word or special character. That is, every character can be either a special character, or part of a word, but not both. Furthermore, neither special characters not words can contain whitespace.

    A 'special character' here is a standalone character that has a special meaning. Special characters cannot be part of values or words. For example, + would be a special character.

    A 'word' here is a meaningful string of characters that do not contain any whitespace or special characters. For example, the constant pi is a word, as are functions such as sin. Words cannot contain special characters or they could be mistaken for two words - the word a+b would be split into a, +, and b.

    R

    The type that the string input should be evaluated to

  2. abstract class AbstractTokenizer [R] extends Tokenizer[R]
  3. sealed trait Associativity extends AnyRef

    This represents the associativity of an operator.

    This represents the associativity of an operator.

    Operators can be either left associative or right associative. This indicated the order in which operators of the same precedence are evaluated in the absence of parentheses - from left to right or from right to left.

    For example, the / operator is left associative, so

    2 / 2 / 2 = (2 / 2) / 2

    However, the ^ operator is right associative, so

    2 ^ 2 ^ 2 = 2 ^ (2 ^ 2)
  4. case class EvaluationException (message: String = "Syntax error", cause: Throwable = null) extends Exception with Product with Serializable

    This is thrown by an Evaluator when it is parsing an expression with a syntax error.

    This is thrown by an Evaluator when it is parsing an expression with a syntax error.

    message

    The detailed message

    cause

    The cause

  5. abstract class Evaluator [+R] extends AnyRef

    An Evaluator is a string parser and evaluator.

    An Evaluator is a string parser and evaluator.

    This class is flexible, allowing a user to define their own syntax. An example use might be to parse maths expressions, such as (1 + 2) ^ 3.

    R

    The type that the string input should be evaluated to

    See also

    ComplexEvaluator

  6. sealed trait Token [R] extends AnyRef

    Represents one of the base parts of an string expression

    Represents one of the base parts of an string expression

    R

    The type that the string represents

  7. trait Tokenizer [R] extends AnyRef

    This tokenizes a string, breaking it down into its principle parts.

    This tokenizes a string, breaking it down into its principle parts. This may be useful when parsing a string when overriding the Evaluator trait, particularly its AbstractEvaluator.

    R

    The type of token that the string should be evaluated to

Value Members

  1. object Associativity

    Contains the instances of the associativity trait.

  2. object Token

    Contains all the different types of tokens.

Inherited from AnyRef

Inherited from Any

Ungrouped