public class Parser extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
BOOLEANS
An option that can be set for this parser.
|
static int |
BRACES
An option that can be set for this parser.
|
static int |
BRACKETS
An option that can be set for this parser.
|
static int |
CASE_SENSITIVE
An option that can be set for this parser.
|
static int |
DEFAULT_OPTIONS
The default options set that is used for
a newly created Parser, if none is specified
in the Constructor.
|
static int |
FACTORIAL
An option that can be set for this parser.
|
static int |
NO_DIGITS_IN_IDENTIFIERS
An option that can be set for this parser.
|
static int |
NO_UNDERSCORE_IN_IDENTIFIERS
An option that can be set for this parser.
|
static int |
OPTIONAL_PARENS
An option that can be set for this parser.
|
static int |
OPTIONAL_SPACES
An option that can be set for this parser.
|
static int |
OPTIONAL_STARS
An that can be set for this parser.
|
protected int |
options
The set of options that have been enabled for this parser.
|
static int |
STANDARD_FUNCTIONS
An option that can be set for this parser.
|
protected SymbolTable |
symbols
The symbol table that contains the MathObjects
that have been registered with this parser.
|
Constructor and Description |
---|
Parser()
Construct a Parser with no parent and with the default options,
BOOLEANS and STANDARD_FUNCTIONS.
|
Parser(int options)
Create a Parser with the spedified option set and with no parent.
|
Parser(Parser parent)
Create a Parser with the specified parent.
|
Parser(Parser parent,
int options)
Create a Parser with the specified parent.
|
Modifier and Type | Method and Description |
---|---|
void |
add(MathObject sym)
Register the MathObject with the Parser, associating it with its
name.
|
void |
addOptions(int newOptions)
Add the options in the option set newOptions to this Parser's option set.
|
MathObject |
get(String name)
Get the MathObject that has been registered with the parser
under the given name.
|
ExpressionProgram |
parse(String str)
Parse the string str and create the corresponding expression.
|
boolean |
parseExpression(ParserContext context)
Called as part of the parsing process.
|
boolean |
parseFactor(ParserContext context)
Called as part of the parsing process.
|
ExpressionProgram |
parseLogical(String str)
Parse the String, str, and create a corresponding logical-valued expression.
|
boolean |
parseLogicalExpression(ParserContext context)
Called as part of the parsing process.
|
boolean |
parseLogicalFactor(ParserContext context)
Called as part of the parsing process.
|
boolean |
parseLogicalTerm(ParserContext context)
Called as part of the parsing process.
|
boolean |
parsePrimary(ParserContext context)
Called as part of the parsing process.
|
boolean |
parseRelation(ParserContext context)
Called as part of the parsing process.
|
boolean |
parseTerm(ParserContext context)
Called as part of the parsing process.
|
void |
remove(String name)
Deregister the MathObject with the given name, if there is one
registered with the Parser.
|
public static final int CASE_SENSITIVE
public static final int OPTIONAL_STARS
public static final int OPTIONAL_SPACES
public static final int BRACKETS
public static final int BRACES
public static final int BOOLEANS
public static final int FACTORIAL
public static final int NO_UNDERSCORE_IN_IDENTIFIERS
public static final int NO_DIGITS_IN_IDENTIFIERS
public static final int OPTIONAL_PARENS
public static final int STANDARD_FUNCTIONS
public static final int DEFAULT_OPTIONS
protected int options
protected SymbolTable symbols
public Parser()
public Parser(Parser parent)
public Parser(int options)
public Parser(Parser parent, int options)
parent
- parent of this Parser, possibly null.options
- additional options, in addition to ones inherited from parent.public void addOptions(int newOptions)
public ExpressionProgram parse(String str)
str
- String to parse.public ExpressionProgram parseLogical(String str)
str
- String to parse.public MathObject get(String name)
public void add(MathObject sym)
public void remove(String name)
name
- MathObject to deregister.public boolean parseLogicalExpression(ParserContext context)
public boolean parseLogicalTerm(ParserContext context)
public boolean parseLogicalFactor(ParserContext context)
public boolean parseRelation(ParserContext context)
public boolean parseExpression(ParserContext context)
public boolean parseTerm(ParserContext context)
public boolean parsePrimary(ParserContext context)
public boolean parseFactor(ParserContext context)