public class ExpressionParser extends Object
It is important to note that this parser does not attempt to evaluate the expression in any way; rather, it only provides the parsed tree according to the desired operators.
Constructor and Description |
---|
ExpressionParser()
Creates an expression parser with the default set of operators.
|
ExpressionParser(Collection<? extends Operator> operators)
Creates an expression parser with the given set of operators.
|
Modifier and Type | Method and Description |
---|---|
LinkedList<Object> |
parsePostfix(String expression)
Parses the given mathematical expression into a queue in Reverse Polish
notation (i.e., postfix notation).
|
SyntaxTree |
parseTree(String expression)
Parses the given mathematical expression into a syntax tree.
|
public ExpressionParser()
public ExpressionParser(Collection<? extends Operator> operators)
operators
- The collection of operators available to expressions.public SyntaxTree parseTree(String expression)
expression
- The mathematical expression to parse.IllegalArgumentException
- if the syntax of the expression is
incorrect.public LinkedList<Object> parsePostfix(String expression)
expression
- The mathematical expression to parse.IllegalArgumentException
- if the syntax of the expression is
incorrect.Copyright © 2015–2022 SciJava. All rights reserved.