Logo Search packages:      
Sourcecode: wims version File versions  Download package

edu::hws::jcm::data::Parser Class Reference

List of all members.

Detailed Description

A Parser can take a string and compile it into an ExpressionProgram. MathObjects, such as variables and functions, can be registered with the Parser. This means that the Parser will recognize them in the strings that it parses. There are a few options that can be set to control certain aspects of the parsing. If a string does not have the correct syntax for an expression, then the Parser will throw a ParseError when it tries to parse that string. A Parser can have a parent. It inherits any MathObjects registered with its parent, but a MathObject registered with a Parser will hide any MathObject of the same name that is registered with its parent. Every parser recognizes the constants pi and e and the operators +, -, *, /, ^, and **. The ** operator is a synonym for ^, the exponentiation operator. Both unary and binary + and - are recognized. The exponentiation operator is right associative. The others are left associative.

Definition at line 44 of file Parser.java.

Public Member Functions

void add (MathObject sym)
void addOptions (int newOptions)
MathObject get (String name)
ExpressionProgram parse (String str)
boolean parseExpression (ParserContext context)
boolean parseFactor (ParserContext context)
ExpressionProgram parseLogical (String str)
boolean parseLogicalExpression (ParserContext context)
boolean parseLogicalFactor (ParserContext context)
boolean parseLogicalTerm (ParserContext context)
boolean parsePrimary (ParserContext context)
 Parser (Parser parent, int options)
 Parser (int options)
 Parser (Parser parent)
 Parser ()
boolean parseRelation (ParserContext context)
boolean parseTerm (ParserContext context)
void remove (String name)

Static Public Attributes

static final int BOOLEANS = 32
static final int BRACES = 16
static final int BRACKETS = 8
static final int CASE_SENSITIVE = 1
static final int FACTORIAL = 64
static final int NO_DIGITS_IN_IDENTIFIERS = 256
static final int NO_UNDERSCORE_IN_IDENTIFIERS = 128
static final int OPTIONAL_PARENS = 512
static final int OPTIONAL_SPACES = 4
static final int OPTIONAL_STARS = 2
static final int STANDARD_FUNCTIONS = 1024

Protected Attributes

int options
SymbolTable symbols

Private Member Functions

boolean parseGroup (char open, char close, ParserContext context)
void parseWord (ParserContext context)

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index