#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) |
void | cache_parent_fcn_names (const std::list< std::string > &names) |
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 |
std::list< octave_value > | localfunctions (void) const |
void | lock_subfunctions (void) |
bool | look_nonlocal (const std::string &name, size_t offset, symbol_record &result) |
symbol_record | lookup_symbol (const std::string &name) const |
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 |
size_t | nesting_depth (void) const |
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 (size_t data_offset) |
octave_value | persistent_varval (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 (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... | |
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::list< std::string > | m_parent_fcn_names |
List Simple names of the parent functions corresponding to this scope. More... | |
std::map< 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 octave::symbol_scope_rep::subfunctions_const_iterator |
Definition at line 64 of file symscope.h.
typedef std::map<std::string, octave_value>::iterator octave::symbol_scope_rep::subfunctions_iterator |
Definition at line 66 of file symscope.h.
typedef std::map<std::string, symbol_record>::const_iterator octave::symbol_scope_rep::table_const_iterator |
Definition at line 59 of file symscope.h.
typedef std::map<std::string, symbol_record>::iterator octave::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 octave::symbol_scope_rep::cache_dir_name | ( | const std::string & | name | ) |
Definition at line 212 of file symscope.cc.
References octave::sys::canonicalize_file_name(), m_dir_name, and name().
|
inline |
Definition at line 278 of file symscope.h.
References m_fcn_file_name, and name().
|
inline |
Definition at line 258 of file symscope.h.
References m_fcn_name, and name().
|
inline |
Definition at line 254 of file symscope.h.
|
inline |
Definition at line 265 of file symscope.h.
References m_parent_fcn_names.
|
inline |
Definition at line 287 of file symscope.h.
References m_dir_name.
octave_value octave::symbol_scope_rep::dump | ( | void | ) | const |
Definition at line 133 of file symscope.cc.
References octave::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 octave::symbol_scope_rep::dump_symbols_map | ( | void | ) | const |
Definition at line 147 of file symscope.cc.
References octave::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_parent_fcn_names, m_persistent_values, m_primary_parent, m_subfunction_names, m_subfunctions, and m_symbols.
|
inline |
Definition at line 226 of file symscope.h.
References m_subfunctions.
|
inline |
Definition at line 283 of file symscope.h.
References m_fcn_file_name.
|
inline |
Definition at line 256 of file symscope.h.
References m_fcn_name.
octave_value octave::symbol_scope_rep::find_subfunction | ( | const std::string & | name | ) | const |
Definition at line 172 of file symscope.cc.
References m_parent, m_subfunctions, name(), and octave_value().
|
inline |
Definition at line 156 of file symscope.h.
|
inline |
Definition at line 233 of file symscope.h.
References m_subfunction_names.
symbol_record octave::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, octave::symbol_record::mark_added_static(), name(), num_symbols(), and octave::symbol_record::set_data_offset().
Referenced by find_symbol().
symbol_record octave::symbol_scope_rep::insert_local | ( | const std::string & | name | ) |
Definition at line 45 of file symscope.cc.
References insert_symbol_record(), and name().
Referenced by symbol_scope_rep().
void octave::symbol_scope_rep::insert_symbol_record | ( | symbol_record & | sr | ) |
Definition at line 54 of file symscope.cc.
References m_symbols, octave::symbol_record::name(), name(), num_symbols(), and octave::symbol_record::set_data_offset().
Referenced by insert_local().
|
inline |
Definition at line 197 of file symscope.h.
References m_children, m_subfunctions, and name().
|
inline |
Definition at line 191 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(), look_nonlocal(), and update_nest().
|
inline |
Definition at line 102 of file symscope.h.
References m_children.
|
inline |
Definition at line 291 of file symscope.h.
References m_is_primary_fcn_scope.
bool octave::symbol_scope_rep::is_relative | ( | const std::shared_ptr< symbol_scope_rep > & | scope | ) | const |
Definition at line 218 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.
std::list< octave_value > octave::symbol_scope_rep::localfunctions | ( | void | ) | const |
Definition at line 95 of file symscope.cc.
References m_subfunction_names, m_subfunctions, octave::symbol_scope::parent_fcn_names(), retval, octave_user_code::scope(), and octave_value::user_code_value().
|
inline |
Definition at line 208 of file symscope.h.
References m_subfunctions.
bool octave::symbol_scope_rep::look_nonlocal | ( | const std::string & | name, |
size_t | offset, | ||
symbol_record & | result | ||
) |
Definition at line 293 of file symscope.cc.
References is_nested(), m_parent, m_symbols, name(), octave::symbol_record::set_data_offset(), and octave::symbol_record::set_frame_offset().
|
inline |
Definition at line 166 of file symscope.h.
|
inline |
Definition at line 289 of file symscope.h.
References m_is_primary_fcn_scope.
|
inline |
Definition at line 106 of file symscope.h.
References m_is_static.
void octave::symbol_scope_rep::mark_subfunctions_in_scope_as_private | ( | const std::string & | class_name | ) |
Definition at line 188 of file symscope.cc.
References octave_base_value::function_value(), m_subfunctions, and octave_function::mark_as_private_function().
|
inline |
Definition at line 252 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_local(), 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 |
|
inline |
Definition at line 260 of file symscope.h.
References m_parent_fcn_names.
Referenced by update_nest().
|
inline |
Definition at line 108 of file symscope.h.
References m_parent.
|
inline |
Definition at line 144 of file symscope.h.
References m_persistent_values.
|
inline |
Definition at line 149 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 175 of file symscope.h.
References m_symbols, and octave::symbol_record::rename().
|
inline |
Definition at line 100 of file symscope.h.
References m_nesting_depth.
void octave::symbol_scope_rep::set_parent | ( | const std::shared_ptr< symbol_scope_rep > & | parent | ) |
Definition at line 200 of file symscope.cc.
References m_parent.
void octave::symbol_scope_rep::set_primary_parent | ( | const std::shared_ptr< symbol_scope_rep > & | parent | ) |
Definition at line 206 of file symscope.cc.
References m_primary_parent.
|
inline |
Definition at line 272 of file symscope.h.
References m_code.
|
inline |
Definition at line 238 of file symscope.h.
References m_subfunction_names.
|
inline |
Definition at line 243 of file symscope.h.
References m_subfunction_names.
|
inline |
Definition at line 221 of file symscope.h.
References m_subfunctions.
std::list< symbol_record > octave::symbol_scope_rep::symbol_list | ( | void | ) | const |
Definition at line 161 of file symscope.cc.
|
inline |
Definition at line 307 of file symscope.h.
References m_symbols.
|
inline |
Definition at line 302 of file symscope.h.
References m_symbols.
|
inline |
Definition at line 214 of file symscope.h.
References m_subfunctions.
void octave::symbol_scope_rep::update_nest | ( | void | ) |
Definition at line 256 of file symscope.cc.
References octave::symbol_record::is_formal(), is_nested(), m_children, m_fcn_name, m_is_static, m_parent, m_symbols, and parent_fcn_names().
|
inline |
Definition at line 270 of file symscope.h.
References m_code.
|
private |
Child nested functions.
Definition at line 368 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 339 of file symscope.h.
Referenced by dup(), set_user_code(), and user_code().
|
private |
The directory associated with m_code.
Definition at line 355 of file symscope.h.
Referenced by cache_dir_name(), dir_name(), and dup().
|
private |
The file name associated with m_code.
Definition at line 351 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 343 of file symscope.h.
Referenced by cache_fcn_name(), dup(), fcn_name(), and update_nest().
|
private |
If true, this is the scope of a primary function.
Definition at line 379 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 376 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 319 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 372 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 359 of file symscope.h.
Referenced by dup(), find_subfunction(), insert(), is_relative(), look_nonlocal(), parent_scope_rep(), set_parent(), and update_nest().
|
private |
List Simple names of the parent functions corresponding to this scope.
Definition at line 347 of file symscope.h.
Referenced by cache_parent_fcn_names(), dup(), and parent_fcn_names().
|
private |
Map from data offset to persistent values in this scope.
Definition at line 330 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 364 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 335 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 327 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 323 of file symscope.h.
Referenced by dump_symbols_map(), dup(), find_symbol(), insert(), insert_symbol_record(), look_nonlocal(), lookup_symbol(), num_symbols(), rename(), symbol_list(), symbols(), and update_nest().