#include "symscope.h"
Public Types | |
typedef std::map< std::string, octave_value >::const_iterator | subfunctions_const_iterator |
typedef std::map< std::string, octave_value >::iterator | subfunctions_iterator |
typedef std::map< std::string, symbol_record >::const_iterator | table_const_iterator |
typedef std::map< std::string, symbol_record >::iterator | table_iterator |
Public Member Functions | |
symbol_scope_rep (const std::string &name="") | |
symbol_scope_rep (const symbol_scope &)=delete | |
~symbol_scope_rep (void)=default | |
void | cache_dir_name (const std::string &name) |
void | cache_fcn_file_name (const std::string &name) |
void | cache_fcn_name (const std::string &name) |
void | cache_name (const std::string &name) |
std::string | dir_name (void) const |
octave_value | dump (void) const |
octave_value | dump_symbols_map (void) const |
std::shared_ptr< symbol_scope_rep > | dup (void) const |
void | erase_subfunctions (void) |
std::string | fcn_file_name (void) const |
std::string | fcn_name (void) const |
octave_value | find_subfunction (const std::string &name) const |
symbol_record | find_symbol (const std::string &name) |
bool | has_subfunctions (void) const |
symbol_record | insert (const std::string &name) |
symbol_record | insert_local (const std::string &name) |
void | insert_symbol_record (symbol_record &sr) |
void | install_nestfunction (const std::string &name, const octave_value &fval, const symbol_scope &fcn_scope) |
void | install_subfunction (const std::string &name, const octave_value &fval) |
bool | is_nested (void) const |
bool | is_parent (void) const |
bool | is_primary_fcn_scope (void) const |
bool | is_relative (const std::shared_ptr< symbol_scope_rep > &scope) const |
bool | is_static (void) const |
bool | is_variable (const std::string &nm) const |
std::list< octave_value > | localfunctions (void) const |
void | lock_subfunctions (void) |
bool | look_nonlocal (const std::string &name, std::size_t offset, symbol_record &result) |
symbol_record | lookup_symbol (const std::string &name) const |
void | mark_as_variable (const std::string &nm) |
void | mark_as_variables (const std::list< std::string > &lst) |
void | mark_primary_fcn_scope (void) |
void | mark_static (void) |
void | mark_subfunctions_in_scope_as_private (const std::string &class_name) |
std::string | name (void) const |
std::size_t | nesting_depth (void) const |
std::size_t | num_symbols (void) const |
symbol_scope_rep & | operator= (const symbol_scope &)=delete |
std::list< std::string > | parent_fcn_names (void) const |
std::shared_ptr< symbol_scope_rep > | parent_scope_rep (void) const |
octave_value & | persistent_varref (std::size_t data_offset) |
octave_value | persistent_varval (std::size_t data_offset) const |
std::shared_ptr< symbol_scope_rep > | primary_parent_scope_rep (void) const |
void | rename (const std::string &old_name, const std::string &new_name) |
void | set_nesting_depth (std::size_t depth) |
void | set_parent (const std::shared_ptr< symbol_scope_rep > &parent) |
void | set_primary_parent (const std::shared_ptr< symbol_scope_rep > &parent) |
void | set_user_code (octave_user_code *code) |
void | stash_subfunction_names (const std::list< std::string > &names) |
std::list< std::string > | subfunction_names (void) const |
std::map< std::string, octave_value > | subfunctions (void) const |
std::list< symbol_record > | symbol_list (void) const |
std::map< std::string, symbol_record > & | symbols (void) |
const std::map< std::string, symbol_record > & | symbols (void) const |
void | unlock_subfunctions (void) |
void | update_nest (void) |
octave_user_code * | user_code (void) const |
Private Attributes | |
std::vector< symbol_scope > | m_children |
Child nested functions. More... | |
octave_user_code * | m_code |
The associated user code (may be null). More... | |
std::string | m_dir_name |
The directory associated with m_code. More... | |
std::string | m_fcn_file_name |
The file name associated with m_code. More... | |
std::string | m_fcn_name |
Simple name of the function corresponding to this scope. More... | |
bool | m_is_primary_fcn_scope |
If true, this is the scope of a primary function. More... | |
bool | m_is_static |
If true then no variables can be added. More... | |
std::string | m_name |
Name for this scope (usually the corresponding filename of the function corresponding to the scope). More... | |
std::size_t | m_nesting_depth |
If true, then this scope belongs to a nested function. More... | |
std::weak_ptr< symbol_scope_rep > | m_parent |
Parent of nested function (may be null). More... | |
std::map< std::size_t, octave_value > | m_persistent_values |
Map from data offset to persistent values in this scope. More... | |
std::weak_ptr< symbol_scope_rep > | m_primary_parent |
Primary (top) parent of nested function (may be null). More... | |
std::list< std::string > | m_subfunction_names |
The list of subfunctions (if any) in the order they appear in the function file. More... | |
std::map< std::string, octave_value > | m_subfunctions |
Map from symbol names to subfunctions. More... | |
std::map< std::string, symbol_record > | m_symbols |
Map from symbol names to symbol info. More... | |
Definition at line 53 of file symscope.h.
typedef std::map<std::string, octave_value>::const_iterator symbol_scope_rep::subfunctions_const_iterator |
Definition at line 64 of file symscope.h.
typedef std::map<std::string, octave_value>::iterator symbol_scope_rep::subfunctions_iterator |
Definition at line 66 of file symscope.h.
typedef std::map<std::string, symbol_record>::const_iterator symbol_scope_rep::table_const_iterator |
Definition at line 59 of file symscope.h.
typedef std::map<std::string, symbol_record>::iterator symbol_scope_rep::table_iterator |
Definition at line 61 of file symscope.h.
|
inline |
Definition at line 68 of file symscope.h.
References insert_local().
|
delete |
|
default |
void symbol_scope_rep::cache_dir_name | ( | const std::string & | name | ) |
Definition at line 230 of file symscope.cc.
References canonicalize_file_name(), m_dir_name, and name().
|
inline |
Definition at line 269 of file symscope.h.
References m_fcn_file_name, and name().
|
inline |
Definition at line 257 of file symscope.h.
References m_fcn_name, and name().
|
inline |
Definition at line 253 of file symscope.h.
|
inline |
Definition at line 278 of file symscope.h.
References m_dir_name.
octave_value symbol_scope_rep::dump | ( | void | ) | const |
Definition at line 133 of file symscope.cc.
References dump_function_map(), dump_symbols_map(), m, m_is_static, m_name, m_nesting_depth, m_subfunction_names, m_subfunctions, and octave_value().
octave_value symbol_scope_rep::dump_symbols_map | ( | void | ) | const |
Definition at line 148 of file symscope.cc.
References symbol_record::dump(), m_symbols, and octave_value().
Referenced by dump().
|
inline |
Definition at line 118 of file symscope.h.
References m_children, m_code, m_dir_name, m_fcn_file_name, m_fcn_name, m_is_primary_fcn_scope, m_is_static, m_name, m_nesting_depth, m_parent, m_persistent_values, m_primary_parent, m_subfunction_names, m_subfunctions, and m_symbols.
|
inline |
Definition at line 225 of file symscope.h.
References m_subfunctions.
|
inline |
Definition at line 274 of file symscope.h.
References m_fcn_file_name.
|
inline |
Definition at line 255 of file symscope.h.
References m_fcn_name.
octave_value symbol_scope_rep::find_subfunction | ( | const std::string & | name | ) | const |
Definition at line 173 of file symscope.cc.
References m_parent, m_subfunctions, name(), and octave_value().
|
inline |
Definition at line 155 of file symscope.h.
|
inline |
Definition at line 232 of file symscope.h.
References m_subfunction_names.
symbol_record symbol_scope_rep::insert | ( | const std::string & | name | ) |
Definition at line 64 of file symscope.cc.
References is_nested(), m_is_static, m_parent, m_symbols, symbol_record::mark_added_static(), name(), num_symbols(), and symbol_record::set_data_offset().
Referenced by find_symbol().
symbol_record symbol_scope_rep::insert_local | ( | const std::string & | name | ) |
Definition at line 45 of file symscope.cc.
Referenced by symbol_scope_rep().
void symbol_scope_rep::insert_symbol_record | ( | symbol_record & | sr | ) |
Definition at line 54 of file symscope.cc.
References m_symbols, symbol_record::name(), name(), num_symbols(), and symbol_record::set_data_offset().
|
inline |
Definition at line 196 of file symscope.h.
References m_children, m_subfunctions, and name().
|
inline |
Definition at line 190 of file symscope.h.
References m_subfunctions, and name().
|
inline |
Definition at line 96 of file symscope.h.
References m_nesting_depth.
Referenced by insert(), is_relative(), is_variable(), look_nonlocal(), and update_nest().
|
inline |
Definition at line 102 of file symscope.h.
References m_children.
|
inline |
Definition at line 282 of file symscope.h.
References m_is_primary_fcn_scope.
bool symbol_scope_rep::is_relative | ( | const std::shared_ptr< symbol_scope_rep > & | scope | ) | const |
Definition at line 236 of file symscope.cc.
References is_nested(), m_parent, and m_primary_parent.
|
inline |
Definition at line 104 of file symscope.h.
References m_is_static.
bool symbol_scope_rep::is_variable | ( | const std::string & | nm | ) | const |
Definition at line 288 of file symscope.cc.
References is_nested(), m_parent, and m_symbols.
std::list< octave_value > symbol_scope_rep::localfunctions | ( | void | ) | const |
Definition at line 95 of file symscope.cc.
References m_subfunction_names, m_subfunctions, symbol_scope::parent_fcn_names(), octave_user_code::scope(), and octave_value::user_code_value().
|
inline |
Definition at line 207 of file symscope.h.
References m_subfunctions.
bool symbol_scope_rep::look_nonlocal | ( | const std::string & | name, |
std::size_t | offset, | ||
symbol_record & | result | ||
) |
Definition at line 338 of file symscope.cc.
References is_nested(), m_parent, m_symbols, name(), symbol_record::set_data_offset(), and symbol_record::set_frame_offset().
|
inline |
Definition at line 165 of file symscope.h.
void symbol_scope_rep::mark_as_variable | ( | const std::string & | nm | ) |
Definition at line 274 of file symscope.cc.
References m_symbols.
Referenced by mark_as_variables().
void symbol_scope_rep::mark_as_variables | ( | const std::list< std::string > & | lst | ) |
Definition at line 282 of file symscope.cc.
References mark_as_variable().
|
inline |
Definition at line 280 of file symscope.h.
References m_is_primary_fcn_scope.
|
inline |
Definition at line 106 of file symscope.h.
References m_is_static.
void symbol_scope_rep::mark_subfunctions_in_scope_as_private | ( | const std::string & | class_name | ) |
Definition at line 189 of file symscope.cc.
References octave_base_value::function_value(), m_subfunctions, and octave_function::mark_as_private_function().
|
inline |
Definition at line 251 of file symscope.h.
References m_name.
Referenced by cache_dir_name(), cache_fcn_file_name(), cache_fcn_name(), cache_name(), find_subfunction(), find_symbol(), insert(), insert_symbol_record(), install_nestfunction(), install_subfunction(), look_nonlocal(), and lookup_symbol().
|
inline |
Definition at line 98 of file symscope.h.
References m_nesting_depth.
|
inline |
Definition at line 88 of file symscope.h.
References m_symbols.
Referenced by insert(), and insert_symbol_record().
|
delete |
std::list< std::string > symbol_scope_rep::parent_fcn_names | ( | void | ) | const |
Definition at line 201 of file symscope.cc.
References parent_scope_rep().
|
inline |
|
inline |
Definition at line 143 of file symscope.h.
References m_persistent_values.
|
inline |
Definition at line 148 of file symscope.h.
References m_persistent_values, and octave_value().
|
inline |
Definition at line 113 of file symscope.h.
References m_primary_parent.
|
inline |
Definition at line 174 of file symscope.h.
References m_symbols, and symbol_record::rename().
|
inline |
Definition at line 100 of file symscope.h.
References m_nesting_depth.
void symbol_scope_rep::set_parent | ( | const std::shared_ptr< symbol_scope_rep > & | parent | ) |
Definition at line 218 of file symscope.cc.
References m_parent.
void symbol_scope_rep::set_primary_parent | ( | const std::shared_ptr< symbol_scope_rep > & | parent | ) |
Definition at line 224 of file symscope.cc.
References m_primary_parent.
|
inline |
Definition at line 263 of file symscope.h.
References m_code.
|
inline |
Definition at line 237 of file symscope.h.
References m_subfunction_names.
|
inline |
Definition at line 242 of file symscope.h.
References m_subfunction_names.
|
inline |
Definition at line 220 of file symscope.h.
References m_subfunctions.
std::list< symbol_record > symbol_scope_rep::symbol_list | ( | void | ) | const |
Definition at line 162 of file symscope.cc.
References m_symbols.
|
inline |
Definition at line 303 of file symscope.h.
References m_symbols.
|
inline |
Definition at line 298 of file symscope.h.
References m_symbols.
|
inline |
Definition at line 213 of file symscope.h.
References m_subfunctions.
void symbol_scope_rep::update_nest | ( | void | ) |
Definition at line 307 of file symscope.cc.
References symbol_record::is_formal(), is_nested(), m_children, m_is_static, m_parent, and m_symbols.
|
inline |
Definition at line 261 of file symscope.h.
References m_code.
|
private |
Child nested functions.
Definition at line 360 of file symscope.h.
Referenced by dup(), install_nestfunction(), is_parent(), and update_nest().
|
private |
The associated user code (may be null).
Definition at line 335 of file symscope.h.
Referenced by dup(), set_user_code(), and user_code().
|
private |
The directory associated with m_code.
Definition at line 347 of file symscope.h.
Referenced by cache_dir_name(), dir_name(), and dup().
|
private |
The file name associated with m_code.
Definition at line 343 of file symscope.h.
Referenced by cache_fcn_file_name(), dup(), and fcn_file_name().
|
private |
Simple name of the function corresponding to this scope.
Definition at line 339 of file symscope.h.
Referenced by cache_fcn_name(), dup(), and fcn_name().
|
private |
If true, this is the scope of a primary function.
Definition at line 371 of file symscope.h.
Referenced by dup(), is_primary_fcn_scope(), and mark_primary_fcn_scope().
|
private |
If true then no variables can be added.
Definition at line 368 of file symscope.h.
Referenced by dump(), dup(), insert(), is_static(), mark_static(), and update_nest().
|
private |
Name for this scope (usually the corresponding filename of the function corresponding to the scope).
Definition at line 315 of file symscope.h.
Referenced by cache_name(), dump(), dup(), and name().
|
private |
If true, then this scope belongs to a nested function.
Definition at line 364 of file symscope.h.
Referenced by dump(), dup(), is_nested(), nesting_depth(), and set_nesting_depth().
|
private |
Parent of nested function (may be null).
Definition at line 351 of file symscope.h.
Referenced by dup(), find_subfunction(), insert(), is_relative(), is_variable(), look_nonlocal(), parent_scope_rep(), set_parent(), and update_nest().
|
private |
Map from data offset to persistent values in this scope.
Definition at line 326 of file symscope.h.
Referenced by dup(), persistent_varref(), and persistent_varval().
|
private |
Primary (top) parent of nested function (may be null).
Used to determine whether two nested functions are related.
Definition at line 356 of file symscope.h.
Referenced by dup(), is_relative(), primary_parent_scope_rep(), and set_primary_parent().
|
private |
The list of subfunctions (if any) in the order they appear in the function file.
Definition at line 331 of file symscope.h.
Referenced by dump(), dup(), has_subfunctions(), localfunctions(), stash_subfunction_names(), and subfunction_names().
|
private |
Map from symbol names to subfunctions.
Definition at line 323 of file symscope.h.
Referenced by dump(), dup(), erase_subfunctions(), find_subfunction(), install_nestfunction(), install_subfunction(), localfunctions(), lock_subfunctions(), mark_subfunctions_in_scope_as_private(), subfunctions(), and unlock_subfunctions().
|
private |
Map from symbol names to symbol info.
Definition at line 319 of file symscope.h.
Referenced by dump_symbols_map(), dup(), find_symbol(), insert(), insert_symbol_record(), is_variable(), look_nonlocal(), lookup_symbol(), mark_as_variable(), num_symbols(), rename(), symbol_list(), symbols(), and update_nest().