Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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>

Inheritance diagram for numeric::expression_parser::ExpressionCreator:
Inheritance graph
[legend]

Public Member Functions

 ExpressionCreator ()
 
 ~ExpressionCreator () override
 
void visit (ArithmeticASTExpression const &) override
 
void visit (ArithmeticASTAndClause const &) override
 
void visit (ArithmeticASTOrClause const &) override
 
void visit (ArithmeticASTFunction const &) override
 
void visit (ArithmeticASTTerm const &) override
 
void visit (ArithmeticASTFactor const &) override
 
void visit (ArithmeticASTValue const &) override
 
void visit (ArithmeticASTRestTerm const &) override
 
void visit (ArithmeticASTRestAndClause const &) override
 
void visit (ArithmeticASTRestOrClause const &) override
 
void visit (ArithmeticASTRestExpression const &) override
 
void visit (ArithmeticASTNode const &) override
 
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
 ~ASTVisitor () override
 Automatically generated virtual destructor for class deriving directly from VirtualBase. More...
 
- Public Member Functions inherited from utility::VirtualBase
 VirtualBase ()=default
 Default constructor. More...
 
virtual ~VirtualBase ()=default
 The virtual destructor is one of the main reasons for the VirtualBase class. More...
 
 VirtualBase (VirtualBase const &)=default
 
 VirtualBase (VirtualBase &&)=default
 
VirtualBaseoperator= (VirtualBase const &)=default
 
VirtualBaseoperator= (VirtualBase &&)=default
 

Private Attributes

ExpressionCOP last_constructed_expression_
 
ExpressionCOP semi_constructed_expression_
 

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 ( )
default
numeric::expression_parser::ExpressionCreator::~ExpressionCreator ( )
overridedefault

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)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTAndClause const &  node)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTOrClause const &  node)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTFunction const &  node)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTTerm const &  node)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTFactor const &  node)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTValue const &  node)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTRestTerm const &  node)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTRestAndClause const &  node)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTRestOrClause const &  node)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTRestExpression const &  node)
overridevirtual
void numeric::expression_parser::ExpressionCreator::visit ( ArithmeticASTNode const &  )
overridevirtual

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: