Rosetta Utilities  2014.35
Public Member Functions | Private Attributes | List of all members
numeric::expression_parser::ExpressionCreator Class Reference

Class to traverse the abstract syntax tree produced by the parsing of a properly-formed string in the Arithmetic expression language. Produces an Expression tree capable of performing arithmetic. Connects the "variable" nodes in this tree to the owning WrapperOptEMultifunc so that their values can be retrieved during expression evaluation inside the WrapperOptEMultifunc functor. More...

#include <Arithmetic.hh>

Public Member Functions

 ExpressionCreator ()
 
 ~ExpressionCreator ()
 
virtual void visit (ArithmeticASTExpression const &)
 
virtual void visit (ArithmeticASTFunction const &)
 
virtual void visit (ArithmeticASTTerm const &)
 
virtual void visit (ArithmeticASTFactor const &)
 
virtual void visit (ArithmeticASTValue const &)
 
virtual void visit (ArithmeticASTRestTerm const &)
 
virtual void visit (ArithmeticASTRestExpression const &)
 
virtual void visit (ArithmeticASTNode const &)
 
ExpressionCOP create_expression_tree (ArithmeticASTExpression const &)
 
virtual ExpressionCOP handle_variable_expression (ArithmeticASTValue const &)
 Factory method to be implemented by derived classes which may wish to handle variable expressions in a specific manner. More...
 
virtual ExpressionCOP handle_function_expression (FunctionTokenCOP function, utility::vector1< ExpressionCOP > const &args)
 Factory method to be implemented by derived classes which may wish to handle function expressions in a specific manner. More...
 
- Public Member Functions inherited from numeric::expression_parser::ASTVisitor
virtual ~ASTVisitor ()
 Automatically generated virtual destructor for class deriving directly from ReferenceCount. More...
 
- Public Member Functions inherited from utility::pointer::ReferenceCount
void ctor ()
 
virtual ~ReferenceCount ()
 Destructor. More...
 
Size ref_count () const
 Reference count. More...
 

Private Attributes

ExpressionCOP last_constructed_expression_
 
ExpressionCOP semi_constructed_expression_
 

Additional Inherited Members

- Public Types inherited from utility::pointer::ReferenceCount
typedef platform::Size Size
 
typedef platform::Size size_type
 
- Protected Member Functions inherited from utility::pointer::ReferenceCount
 ReferenceCount ()
 Default constructor. More...
 
 ReferenceCount (ReferenceCount const &)
 Copy constructor. More...
 
ReferenceCountoperator= (ReferenceCount const &)
 Copy assignment. More...
 

Detailed Description

Class to traverse the abstract syntax tree produced by the parsing of a properly-formed string in the Arithmetic expression language. Produces an Expression tree capable of performing arithmetic. Connects the "variable" nodes in this tree to the owning WrapperOptEMultifunc so that their values can be retrieved during expression evaluation inside the WrapperOptEMultifunc functor.

Constructor & Destructor Documentation

numeric::expression_parser::ExpressionCreator::ExpressionCreator ( )
numeric::expression_parser::ExpressionCreator::~ExpressionCreator ( )

Member Function Documentation

ExpressionCOP numeric::expression_parser::ExpressionCreator::create_expression_tree ( ArithmeticASTExpression const &  expr)
ExpressionCOP numeric::expression_parser::ExpressionCreator::handle_function_expression ( FunctionTokenCOP  function,
utility::vector1< ExpressionCOP > const &  args 
)
virtual

Factory method to be implemented by derived classes which may wish to handle function expressions in a specific manner.

Reimplemented in numeric::expression_parser::BooleanExpressionCreator.

References utility::to_string(), and utility_exit_with_message.

Referenced by numeric::expression_parser::BooleanExpressionCreator::handle_function_expression(), and visit().

ExpressionCOP numeric::expression_parser::ExpressionCreator::handle_variable_expression ( ArithmeticASTValue const &  )
virtual

Factory method to be implemented by derived classes which may wish to handle variable expressions in a specific manner.

Factory method to be implemented by derived classes which may wish to handle variable expressions differently.

Reimplemented in numeric::expression_parser::SimpleExpressionCreator.

References utility_exit_with_message.

Referenced by visit().

void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTExpression const &  node)
virtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTFunction const &  node)
virtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTTerm const &  node)
virtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTFactor const &  node)
virtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTValue const &  node)
virtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTRestTerm const &  node)
virtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTRestExpression const &  node)
virtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTNode const &  )
virtual

Member Data Documentation

ExpressionCOP numeric::expression_parser::ExpressionCreator::last_constructed_expression_
private

Created inside a traversal of the AST – return expression trees using this variable, and keep living trees alive by storing them on the stack during the AST recursive traversal.

Referenced by create_expression_tree(), and visit().

ExpressionCOP numeric::expression_parser::ExpressionCreator::semi_constructed_expression_
private

Referenced by create_expression_tree(), and visit().


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