ExpressionParser Class Reference

A parser for arithmetic expressions. More...

#include <ExpressionParser.hpp>

Inherits ExpressionParserTokenTypes.

List of all members.

Public Member Functions

std::list< std::string > & getIdentifiers ()
 Returns the list of identifiers in this expression.
int expr ()
 Parses an expression.
void aExpr ()
 Recognizes the synxtax for arithmetic addition and subtraction.
void prodExpr ()
 Recognizes the syntax for arithmetic multiplication, division, and modular arithmetic (not supported).
void powExpr ()
 Recognizes the syntax for arithmetic exponentiation.
void tExpr ()
 Recognizes the syntax for arithmetic plus/minus functions or atomic elements.
void tFunc ()
 Recognizes the syntax for arithmetic functions.
void atom ()
 Recognizes an atomic element, such as a double-precision or floating-point number.
void mathFunction ()
 Recognizes various mathematical functions.
void amlPath ()
 Recognizes an AML path.
void amlPathElement ()
 Implements AML path 0.49 syntax.
void amlPathAttrib ()
 Recognizes the syntax for the component part of an AML path.
void amlPathNode ()
 Recognizes the syntax for the name part of an AML path.
void amlPathTagList ()
 Recognizes the syntax for the list of tags part of an AML path.
void amlPathAttrExpr ()
 Recognizes the AML path syntax for matching attribute-value pairs.


Detailed Description

A parser for arithmetic expressions.

(You can use this standalone, but you should really only use this class with the Universal Accelerator Parser library). Reads a TokenStream and invokes the appropriate methods in this class.

When you instantiate the parser you must specify the lexer.

ExpressionParser parser(lexer);

To parse an expression use parser.expr().

The end of line character is ';'.

See also:
antlr::TokenStream

Definition at line 54 of file ExpressionParser.hpp.


Member Function Documentation

void ExpressionParser::aExpr (  ) 

Recognizes the synxtax for arithmetic addition and subtraction.

Definition at line 82 of file ExpressionParser.cpp.

void ExpressionParser::amlPath (  ) 

Recognizes an AML path.

AML path is a language for addressing parts of an AML document. See "Attribute Names in Arithmetic Expressions" in the AML documention for more information.

Definition at line 719 of file ExpressionParser.cpp.

void ExpressionParser::amlPathAttrExpr (  ) 

Recognizes the AML path syntax for matching attribute-value pairs.

Definition at line 1124 of file ExpressionParser.cpp.

void ExpressionParser::amlPathAttrib (  ) 

Recognizes the syntax for the component part of an AML path.

An "@" sign must prefix the component.

Definition at line 950 of file ExpressionParser.cpp.

void ExpressionParser::amlPathElement (  ) 

Implements AML path 0.49 syntax.

Recognizes expressions of the form:

  • name:attrib_name
  • name[attrib_name]

The former syntax can address any node in an AML document whereas the latter is shorthand for addressing only element, controller, and beam nodes.

Upon evaluation, if component was not specified then the component "design" will be chosen. Should neither the specified component nor component "design" be defined, then 0 is returned.

If name is not specified then the node being addressed must be specified with method ExpressionTreeWalker.setContext before evaluating this expression. Recognizes an element in an AML path.

Definition at line 773 of file ExpressionParser.cpp.

void ExpressionParser::amlPathNode (  ) 

Recognizes the syntax for the name part of an AML path.

See also:
amlPathElement

Definition at line 985 of file ExpressionParser.cpp.

void ExpressionParser::amlPathTagList (  ) 

Recognizes the syntax for the list of tags part of an AML path.

Definition at line 1073 of file ExpressionParser.cpp.

void ExpressionParser::atom (  ) 

Recognizes an atomic element, such as a double-precision or floating-point number.

Definition at line 428 of file ExpressionParser.cpp.

int ExpressionParser::expr (  ) 

Parses an expression.

Definition at line 48 of file ExpressionParser.cpp.

std::list<std::string>& ExpressionParser::getIdentifiers (  )  [inline]

Returns the list of identifiers in this expression.

Returns:
the list of identifiers in this expression.

Definition at line 65 of file ExpressionParser.hpp.

void ExpressionParser::mathFunction (  ) 

Recognizes various mathematical functions.

Definition at line 511 of file ExpressionParser.cpp.

void ExpressionParser::powExpr (  ) 

Recognizes the syntax for arithmetic exponentiation.

Definition at line 190 of file ExpressionParser.cpp.

void ExpressionParser::prodExpr (  ) 

Recognizes the syntax for arithmetic multiplication, division, and modular arithmetic (not supported).

Definition at line 132 of file ExpressionParser.cpp.

void ExpressionParser::tExpr (  ) 

Recognizes the syntax for arithmetic plus/minus functions or atomic elements.

See also:
atom

Definition at line 234 of file ExpressionParser.cpp.

void ExpressionParser::tFunc (  ) 

Recognizes the syntax for arithmetic functions.

Definition at line 342 of file ExpressionParser.cpp.


Generated on Fri Feb 12 15:47:57 2010 for Universal Accelerator Parser by  doxygen 1.5.7