#include <Y2Namespace.h>
Public Member Functions | |
Y2Namespace () | |
virtual | ~Y2Namespace () |
void | finish () |
virtual const string | name () const |
what namespace do we implement | |
virtual const string | filename () const =0 |
used for error reporting | |
virtual unsigned int | symbolCount () const |
gives the number of symbol declarations | |
virtual SymbolEntryPtr | symbolEntry (unsigned int position) const |
access to definitions of this namespace | |
virtual string | toString () const |
unparse. useful for debugging | |
string | symbolsToString () const |
virtual YCPValue | evaluate (bool cse=false)=0 |
called when evaluating the import statement | |
virtual SymbolTable * | table () const |
get our whole symbol table? | |
void | createTable () |
virtual Y2Function * | createFunctionCall (const string name, constFunctionTypePtr type)=0 |
void | pushToStack () |
void | popFromStack () |
virtual void | initialize () |
Protected Types | |
typedef vector< SymbolEntryPtr > | symbols_t |
Protected Member Functions | |
unsigned int | addSymbol (SymbolEntryPtr sentry) |
void | enterSymbol (SymbolEntryPtr sentry, Point *point=0) |
SymbolEntryPtr | lookupSymbol (const char *name) const |
void | releaseSymbol (unsigned int position) |
Protected Attributes | |
SymbolTable * | m_table |
unsigned int | m_symbolcount |
symbols_t | m_symbols |
bool | m_initialized |
Friends | |
class | SymbolTable |
Y2Namespace implements a hash(?) table of nested(?) SymbolEntries and allows to look them up
typedef vector<SymbolEntryPtr> Y2Namespace::symbols_t [protected] |
Y2Namespace::Y2Namespace | ( | ) |
unsigned int Y2Namespace::addSymbol | ( | SymbolEntryPtr | sentry | ) | [protected] |
References m_symbolcount, m_symbols, and y2debug.
Referenced by enterSymbol(), YBlock::newEntry(), YBlock::newValue(), and YBlock::YBlock().
virtual Y2Function* Y2Namespace::createFunctionCall | ( | const string | name, | |
constFunctionTypePtr | type | |||
) | [pure virtual] |
Creates a function call instance, which can be used to call a function from this namespace. The object is NOT owned anymore by this instance, the caller can (and should) delete it.
name | name of the required function | |
type | the type of the function (needed for overloading) |
Implemented in YBlock, and Y2SystemNamespace.
Referenced by Y2SystemNamespace::createFunctionCall(), YEFunctionPointer::evaluate(), and initialize().
void Y2Namespace::createTable | ( | ) |
References m_table, and SymbolTable.
Referenced by StaticDeclaration::registerDeclarations(), Y2SystemNamespace::Y2SystemNamespace(), and YBlock::YBlock().
void Y2Namespace::enterSymbol | ( | SymbolEntryPtr | sentry, | |
Point * | point = 0 | |||
) | [protected] |
References addSymbol(), SymbolTable::enter(), m_table, and SymbolTable.
Referenced by SymbolTable::tableCopy().
virtual YCPValue Y2Namespace::evaluate | ( | bool | cse = false |
) | [pure virtual] |
called when evaluating the import statement
Implemented in YBlock, and Y2SystemNamespace.
Referenced by Y2SystemNamespace::evaluate(), and initialize().
virtual const string Y2Namespace::filename | ( | ) | const [pure virtual] |
used for error reporting
Implemented in YBlock, and Y2SystemNamespace.
void Y2Namespace::finish | ( | ) |
References SymbolEntry::setPosition(), and y2debug.
void Y2Namespace::initialize | ( | ) | [virtual] |
References createFunctionCall(), SymbolTable::disableUsage(), SymbolTable::enableUsage(), evaluate(), Y2Function::evaluateCall(), SymbolTable::find(), m_initialized, name(), and table().
Referenced by YSImport::evaluate().
SymbolEntryPtr Y2Namespace::lookupSymbol | ( | const char * | name | ) | const [protected] |
References m_symbolcount, m_symbols, and name().
Referenced by YBlock::newEntry().
const string Y2Namespace::name | ( | ) | const [virtual] |
what namespace do we implement
Reimplemented in YBlock, and Y2SystemNamespace.
Referenced by Y2SystemNamespace::createFunctionCall(), initialize(), lookupSymbol(), Bytecode::readEntry(), YSymbolEntry::toString(), SymbolEntry::toString(), Y2SystemNamespace::useRemote(), Xmlcode::writeEntry(), and Y2SystemNamespace::Y2SystemNamespace().
void Y2Namespace::popFromStack | ( | ) |
References m_symbolcount, and m_symbols.
Referenced by YBlock::evaluate(), and YBlock::evaluateFrom().
void Y2Namespace::pushToStack | ( | ) |
References m_symbolcount, and m_symbols.
Referenced by YBlock::evaluate(), and YBlock::evaluateFrom().
void Y2Namespace::releaseSymbol | ( | unsigned int | position | ) | [protected] |
References m_symbolcount, and m_symbols.
unsigned int Y2Namespace::symbolCount | ( | ) | const [virtual] |
gives the number of symbol declarations
References m_symbols.
Referenced by YBlock::newEntry(), YBlock::newValue(), YBlock::toStream(), and YBlock::toXml().
SymbolEntryPtr Y2Namespace::symbolEntry | ( | unsigned int | position | ) | const [virtual] |
access to definitions of this namespace
References m_symbolcount, and m_symbols.
Referenced by Bytecode::readEntry(), YBlock::toStream(), YBlock::toXml(), and YBlock::YBlock().
string Y2Namespace::symbolsToString | ( | ) | const |
References m_symbolcount, and m_symbols.
Referenced by YBlock::environmentToString(), and toString().
SymbolTable * Y2Namespace::table | ( | ) | const [virtual] |
get our whole symbol table?
Reimplemented in YBlock.
References m_table.
Referenced by Y2SystemNamespace::createFunctionCall(), Import::import(), Parser::init(), initialize(), Xmlcode::popNamespace(), Bytecode::popNamespace(), Xmlcode::popUptoNamespace(), Bytecode::popUptoNamespace(), Xmlcode::pushNamespace(), Bytecode::pushNamespace(), Bytecode::readEntry(), and Y2SystemNamespace::Y2SystemNamespace().
string Y2Namespace::toString | ( | ) | const [virtual] |
unparse. useful for debugging
Reimplemented in YBlock.
References m_table, symbolsToString(), and SymbolTable::toString().
Referenced by YBlock::newEntry().
friend class SymbolTable [friend] |
Referenced by createTable(), enterSymbol(), and YBlock::YBlock().
bool Y2Namespace::m_initialized [protected] |
Referenced by initialize().
unsigned int Y2Namespace::m_symbolcount [protected] |
Referenced by addSymbol(), YBlock::createFunctionCall(), lookupSymbol(), popFromStack(), pushToStack(), releaseSymbol(), symbolEntry(), and symbolsToString().
symbols_t Y2Namespace::m_symbols [protected] |
SymbolTable* Y2Namespace::m_table [protected] |
Referenced by createTable(), enterSymbol(), YBlock::table(), table(), toString(), YBlock::YBlock(), ~Y2Namespace(), and Y2SystemNamespace::~Y2SystemNamespace().