Calculator
Step 4
|
Go to the source code of this file.
Classes | |
class | set_symbol_table |
Typedefs | |
typedef std::map< std::string, node > | symbol_table |
Functions | |
node | get_variable (std::string const &name) |
node | get_function (std::string const &name) |
void | set_variable (std::string const &name, node value) |
void | set_function (std::string const &name, node definition) |
typedef std::map<std::string, node> symbol_table |
Represent a global or local symbol table, which stores variables and functions. In fact, there's no difference between a variable and a function of no arguments.
Definition at line 13 of file variables.hpp.
node get_function | ( | std::string const & | name | ) |
Get the definition of a function.
name | The function name |
name
no_such_function | if the function is not defined |
Definition at line 61 of file variables.cpp.
References find_symbol().
Referenced by node_function_call::evaluate_node().
node get_variable | ( | std::string const & | name | ) |
Get the value of a variable.
name | The variable name |
name
or node() if the variable is undefined. Definition at line 45 of file variables.cpp.
References find_symbol().
Referenced by BOOST_AUTO_TEST_CASE(), and node_identifier::evaluate_node().
void set_function | ( | std::string const & | name, |
node | definition | ||
) |
Set the definition of a function.
name | The function name |
definition | The function definition |
Definition at line 70 of file variables.cpp.
References set_variable().
Referenced by BOOST_AUTO_TEST_CASE(), and parser::get_statement().
void set_variable | ( | std::string const & | name, |
node | value | ||
) |
Set the value of a variable.
name | The variable name |
value | The value. if the variable is already defined, changes its value. |
Definition at line 56 of file variables.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), and set_function().