yast2-core
|
#include <SymbolTable.h>
Public Types | |
typedef bool(* | EntryConsumer )(const SymbolEntry &) |
Public Member Functions | |
size_t | mem_size () const |
SymbolTable (int prime) | |
~SymbolTable () | |
void | tableCopy (Y2Namespace *tofill) const |
int | size () const |
void | forEach (EntryConsumer consumer) const |
TableEntry * | enter (const char *key, SymbolEntryPtr entry, const Point *point) |
TableEntry * | enter (TableEntry *entry) |
TableEntry * | find (const char *key, SymbolEntry::category_t category=SymbolEntry::c_unspec) |
TableEntry * | xref (const char *key) |
void | remove (TableEntry *entry) |
void | openXRefs () |
void | closeXRefs () |
SymbolEntryPtr | getXRef (unsigned int position) const |
void | startUsage () |
int | countUsage () |
void | endUsage () |
void | enableUsage () |
void | disableUsage () |
std::ostream & | writeUsage (std::ostream &str) const |
std::ostream & | writeXmlUsage (std::ostream &str, int indent) const |
string | toString () const |
string | toStringSymbols () const |
Private Types | |
typedef std::stack < std::vector< TableEntry * > * > | xrefs_t |
Private Member Functions | |
int | hash (const char *s) |
Private Attributes | |
int | m_prime |
TableEntry ** | m_table |
bool | m_track_usage |
std::map< const char *, TableEntry * > * | m_used |
xrefs_t * | m_xrefs |
typedef bool(* SymbolTable::EntryConsumer)(const SymbolEntry &) |
|
private |
SymbolTable::SymbolTable | ( | int | prime | ) |
References m_prime, and m_table.
Referenced by mem_size().
SymbolTable::~SymbolTable | ( | ) |
References endUsage(), TableEntry::m_next, TableEntry::m_outer, m_prime, m_table, m_xrefs, and y2debug.
void SymbolTable::closeXRefs | ( | ) |
References m_xrefs, y2debug, and y2error.
Referenced by Xmlcode::popNamespace(), Bytecode::popNamespace(), Xmlcode::popUptoNamespace(), and Bytecode::popUptoNamespace().
void SymbolTable::disableUsage | ( | ) |
References m_track_usage, and y2debug.
Referenced by Import::import(), and Y2Namespace::initialize().
void SymbolTable::enableUsage | ( | ) |
References m_track_usage, and y2debug.
Referenced by Import::enableTracking(), and Y2Namespace::initialize().
void SymbolTable::endUsage | ( | ) |
References m_used, and y2debug.
Referenced by Parser::init(), and ~SymbolTable().
TableEntry * SymbolTable::enter | ( | const char * | key, |
SymbolEntryPtr | entry, | ||
const Point * | point | ||
) |
TableEntry * SymbolTable::enter | ( | TableEntry * | entry | ) |
TableEntry * SymbolTable::find | ( | const char * | key, |
SymbolEntry::category_t | category = SymbolEntry::c_unspec |
||
) |
References SymbolEntry::c_unspec, hash(), TableEntry::m_key, TableEntry::m_next, TableEntry::m_outer, m_table, m_track_usage, m_used, and TableEntry::sentry().
Referenced by Y2SystemNamespace::createFunctionCall(), YBlock::createFunctionCall(), StaticDeclaration::findDeclaration(), Y2Namespace::initialize(), StaticDeclaration::registerDeclarations(), switch(), while(), and xref().
void SymbolTable::forEach | ( | SymbolTable::EntryConsumer | consumer | ) | const |
call the consumer for each entry (or until it requests a break)
Example: static bool MyClass::DoIt (const SymbolEntry & se) { cout << se.name() << endl; return true; }
void MyClass::Foo () { my_y2namespace->table()->forEach (&DoIt); }
References TableEntry::m_next, m_prime, m_table, and TableEntry::sentry().
SymbolEntryPtr SymbolTable::getXRef | ( | unsigned int | position | ) | const |
References m_xrefs, and y2error.
Referenced by Bytecode::readEntry().
|
private |
|
inline |
References SymbolTable().
void SymbolTable::openXRefs | ( | ) |
References m_xrefs, and y2debug.
Referenced by Xmlcode::pushNamespace(), Bytecode::pushNamespace(), and YBlock::YBlock().
void SymbolTable::remove | ( | TableEntry * | entry | ) |
References hash(), TableEntry::key(), TableEntry::m_key, TableEntry::m_next, TableEntry::m_outer, TableEntry::m_prev, m_table, and y2internal.
Referenced by YBlock::detachEnvironment(), StaticDeclaration::registerDeclarations(), and TableEntry::remove().
int SymbolTable::size | ( | ) | const |
References m_prime.
void SymbolTable::startUsage | ( | ) |
References m_used, and y2debug.
Referenced by Import::import(), and Parser::init().
void SymbolTable::tableCopy | ( | Y2Namespace * | tofill | ) | const |
References Y2Namespace::enterSymbol(), TableEntry::key(), TableEntry::m_next, m_prime, m_table, TableEntry::sentry(), and y2milestone.
Referenced by Y2SystemNamespace::Y2SystemNamespace().
string SymbolTable::toString | ( | void | ) | const |
References SymbolEntry::c_builtin, SymbolEntry::c_function, SymbolEntry::c_reference, SymbolEntry::c_variable, TableEntry::key(), TableEntry::m_next, TableEntry::m_outer, m_prime, m_table, and TableEntry::sentry().
Referenced by YBlock::detachEnvironment(), enter(), switch(), and Y2Namespace::toString().
string SymbolTable::toStringSymbols | ( | ) | const |
std::ostream & SymbolTable::writeUsage | ( | std::ostream & | str | ) | const |
References m_used, TableEntry::sentry(), str, Bytecode::writeCharp(), Bytecode::writeInt32(), XREFDEBUG, y2debug, and y2milestone.
Referenced by YSImport::toStream().
std::ostream & SymbolTable::writeXmlUsage | ( | std::ostream & | str, |
int | indent | ||
) | const |
References m_used, TableEntry::sentry(), Xmlcode::spaces(), str, XREFDEBUG, y2debug, and y2milestone.
TableEntry * SymbolTable::xref | ( | const char * | key | ) |
References SymbolEntry::c_unspec, find(), and m_xrefs.
Referenced by YSImport::YSImport().
|
private |
Referenced by forEach(), hash(), size(), SymbolTable(), tableCopy(), toString(), toStringSymbols(), and ~SymbolTable().
|
private |
Referenced by enter(), find(), forEach(), remove(), SymbolTable(), tableCopy(), toString(), toStringSymbols(), and ~SymbolTable().
|
private |
Referenced by disableUsage(), enableUsage(), and find().
|
private |
Referenced by countUsage(), endUsage(), find(), startUsage(), writeUsage(), and writeXmlUsage().
|
private |
Referenced by closeXRefs(), getXRef(), openXRefs(), xref(), and ~SymbolTable().