java.lang.Object
org.matheclipse.parser.client.Scanner
org.matheclipse.parser.client.Parser
public class Parser extends Scanner
Create an expression of the
ASTNode
class-hierarchy from a math
formulas string representation See
Operator
-precedence parser for the idea, how to parse the operators depending on
their precedence.-
Field Summary
Fields inherited from class org.matheclipse.parser.client.Scanner
fCurrentChar, fCurrentColumnStartPosition, fCurrentPosition, fFactory, fInputString, fOperatorString, fOperList, fToken, numFormat, rowCount, TT_ARGUMENTS_CLOSE, TT_ARGUMENTS_OPEN, TT_BLANK, TT_COMMA, TT_DIGIT, TT_EOF, TT_FLOATING_POINT, TT_IDENTIFIER, TT_LIST_CLOSE, TT_LIST_OPEN, TT_OPERATOR, TT_PARTCLOSE, TT_PARTOPEN, TT_PERCENT, TT_PRECEDENCE_CLOSE, TT_PRECEDENCE_OPEN, TT_SLOT, TT_SLOTSEQUENCE, TT_STRING
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description org.matheclipse.parser.client.ast.IParserFactory
getFactory()
Gets the factory.org.matheclipse.parser.client.ast.ASTNode
parse(String expression)
Parse the givenexpression
String into an ASTNode.void
setFactory(org.matheclipse.parser.client.ast.IParserFactory factory)
Sets the factory.Methods inherited from class org.matheclipse.parser.client.Scanner
getIdentifier, getNextToken, getNumberString, getOperator, getStringBuffer, initialize, throwSyntaxError, throwSyntaxError
-
Constructor Details
-
Parser
public Parser()Instantiates a new parser. -
Parser
Instantiates a new parser.- Parameters:
relaxedSyntax
- iftrue
, use '('...')' as brackets for arguments- Throws:
SyntaxError
- the syntax error
-
Parser
public Parser(org.matheclipse.parser.client.ast.IParserFactory factory, boolean relaxedSyntax) throws SyntaxErrorInstantiates a new parser.- Parameters:
factory
- the factoryrelaxedSyntax
- iftrue
, use '('...')' as brackets for arguments- Throws:
SyntaxError
- the syntax error
-
-
Method Details
-
setFactory
public void setFactory(org.matheclipse.parser.client.ast.IParserFactory factory)Sets the factory.- Parameters:
factory
- the new factory
-
getFactory
public org.matheclipse.parser.client.ast.IParserFactory getFactory()Gets the factory.- Returns:
- the factory
-
parse
Parse the givenexpression
String into an ASTNode.- Parameters:
expression
- a formula string which should be parsed.- Returns:
- the parsed ASTNode representation of the given formula string
- Throws:
SyntaxError
- the syntax error
-