#include <symbol.h>
Public Types | |
Public Member Functions | |
Symbol * | addParam (const String ¶m) |
Candy grammar to add a parameter to a function (internal or external). | |
int32 | declaredAt () const |
void | declaredAt (int32 line) |
bool | exported () const |
Symbol * | exported (bool exp) |
Sets the symbol export class. | |
bool | fromClass (const String &find_name) const |
If the symbol is a class, check if this class is the named one or derived from the named one. | |
ClassDef * | getClassDef () const |
ExtFuncDef * | getExtFuncDef () const |
FuncDef * | getFuncDef () const |
ImportAlias * | getImportAlias () const |
Symbol * | getInstance () const |
uint16 | getItemId () const |
VarDef * | getVarDef () const |
uint32 | id () const |
void | id (uint32 i) |
Changes the symbol id. | |
bool | imported () const |
Symbol * | imported (bool exp) |
Sets the symbol import class. | |
bool | isCallable () const |
bool | isClass () const |
bool | isConst () const |
bool | isEnum () const |
bool | isEta () const |
bool | isExtFunc () const |
bool | isFunction () const |
bool | isGlobal () const |
bool | isImportAlias () const |
bool | isInstance () const |
bool | isLocal () const |
bool | isLocalUndef () const |
bool | isParam () const |
bool | isProp () const |
bool | isUndefined () const |
bool | isVar () const |
bool | isWKS () const |
void | itemId (uint16 ip) |
uint16 | itemId () const |
bool | load (Stream *in) |
void | module (Module *mod) |
const Module * | module () const |
Returns the module associated with a symbol. | |
const String & | name () const |
void | name (const String *name) |
Changes the symbol name. | |
bool | save (Stream *out) const |
void | setClass (ClassDef *f) |
void | setConst (VarDef *p) |
Symbol * | setEnum (bool exp) |
Declares the symbol as an "enum class". | |
Symbol * | setEta (bool exp) |
Declares the symbol as an "eta function". | |
void | setExtFunc (ExtFuncDef *f) |
void | setFunction (FuncDef *func) |
void | setGlobal () |
void | setImportAlias (const String *name, const String *origModule, bool bIsFileName=false) |
void | setImportAlias (ImportAlias *alias) |
void | setInstance (Symbol *base_class) |
void | setLocal () |
void | setLocalUndef () |
void | setParam () |
void | setProp (VarDef *p) |
void | setUndefined () |
void | setVar (VarDef *p) |
Symbol * | setWKS (bool exp) |
Declares the symbol as an "well known symbol". | |
Symbol (Module *owner) | |
Basic empty constructor. | |
Symbol (Module *mod, const String *name) | |
Builds a symbol without ID and export class. | |
Symbol (Module *mod, uint32 id, const String *name, bool exp) | |
Convenience constructor. | |
type_t | type () const |
~Symbol () |
As symbol names are allocated in the symbol table part of the module, they are currently not deleted at item destruction. Symbol names must be allocated in the module symbol table.
Convenience constructor.
This creates the symbol with minimal setup
mod | the owner module | |
id | the id of the symbol in the module | |
name | the name of the symbol | |
exp | true if this symbol is exported. |
Builds a symbol without ID and export class.
The symbol is by default not exported, and it's id is left to a non-meaningful value. This constructor is meant to be used only on symbols that are going to be added somehow to a module soon after.
The type of the symbol is Symbol::tundef.
mod | the owner module | |
name | a String that has been created and stored somewhere safe (i.e. module string table). |
Falcon::Symbol::Symbol | ( | Module * | owner | ) | [inline] |
Basic empty constructor.
This is mainly used for de-serialization to prepare the symbols before it can be de-serialized.
owner | the module that is owning this symbol |
Falcon::Symbol::~Symbol | ( | ) | [inline] |
Candy grammar to add a parameter to a function (internal or external).
int32 Falcon::Symbol::declaredAt | ( | ) | const [inline] |
void Falcon::Symbol::declaredAt | ( | int32 | line | ) | [inline] |
bool Falcon::Symbol::exported | ( | ) | const [inline] |
Symbol* Falcon::Symbol::exported | ( | bool | exp | ) | [inline] |
Sets the symbol export class.
exp | true if the symbol must be exported, false otherwise. |
bool Falcon::Symbol::fromClass | ( | const String & | find_name | ) | const |
If the symbol is a class, check if this class is the named one or derived from the named one.
If the name passed as parameters is the name of this class or one of its ancestor names, the function returns true.
find_name | The class name. |
ClassDef* Falcon::Symbol::getClassDef | ( | ) | const [inline] |
ExtFuncDef* Falcon::Symbol::getExtFuncDef | ( | ) | const [inline] |
FuncDef* Falcon::Symbol::getFuncDef | ( | ) | const [inline] |
ImportAlias* Falcon::Symbol::getImportAlias | ( | ) | const [inline] |
uint16 Falcon::Symbol::getItemId | ( | ) | const [inline] |
VarDef* Falcon::Symbol::getVarDef | ( | ) | const [inline] |
uint32 Falcon::Symbol::id | ( | ) | const [inline] |
void Falcon::Symbol::id | ( | uint32 | i | ) | [inline] |
Changes the symbol id.
i | the new id. |
bool Falcon::Symbol::imported | ( | ) | const [inline] |
Symbol* Falcon::Symbol::imported | ( | bool | exp | ) | [inline] |
Sets the symbol import class.
Import class is prioritary to export class; that is, if a symbol is imported, exported() will always return false. Also, imported symbols report their type as unknonw, no matter what local setting is provided.
exp | true if the symbol must be imported, false otherwise. |
bool Falcon::Symbol::isCallable | ( | ) | const [inline] |
bool Falcon::Symbol::isClass | ( | ) | const [inline] |
bool Falcon::Symbol::isConst | ( | ) | const [inline] |
bool Falcon::Symbol::isEnum | ( | ) | const [inline] |
bool Falcon::Symbol::isEta | ( | ) | const [inline] |
bool Falcon::Symbol::isExtFunc | ( | ) | const [inline] |
bool Falcon::Symbol::isFunction | ( | ) | const [inline] |
bool Falcon::Symbol::isGlobal | ( | ) | const [inline] |
bool Falcon::Symbol::isImportAlias | ( | ) | const [inline] |
bool Falcon::Symbol::isInstance | ( | ) | const [inline] |
bool Falcon::Symbol::isLocal | ( | ) | const [inline] |
bool Falcon::Symbol::isLocalUndef | ( | ) | const [inline] |
bool Falcon::Symbol::isParam | ( | ) | const [inline] |
bool Falcon::Symbol::isProp | ( | ) | const [inline] |
bool Falcon::Symbol::isUndefined | ( | ) | const [inline] |
bool Falcon::Symbol::isVar | ( | ) | const [inline] |
bool Falcon::Symbol::isWKS | ( | ) | const [inline] |
void Falcon::Symbol::itemId | ( | uint16 | ip | ) | [inline] |
uint16 Falcon::Symbol::itemId | ( | ) | const [inline] |
bool Falcon::Symbol::load | ( | Stream * | in | ) |
void Falcon::Symbol::module | ( | Module * | mod | ) | [inline] |
const Module* Falcon::Symbol::module | ( | ) | const [inline] |
Returns the module associated with a symbol.
const String& Falcon::Symbol::name | ( | ) | const [inline] |
void Falcon::Symbol::name | ( | const String * | name | ) | [inline] |
Changes the symbol name.
Symbol names are never destroyed, so the old name is not de-allocated. If necessary, the application must keep track of that.
name | The new name. |
bool Falcon::Symbol::save | ( | Stream * | out | ) | const |
void Falcon::Symbol::setClass | ( | ClassDef * | f | ) | [inline] |
void Falcon::Symbol::setConst | ( | VarDef * | p | ) | [inline] |
Symbol* Falcon::Symbol::setEnum | ( | bool | exp | ) | [inline] |
Declares the symbol as an "enum class".
Enum classes are classes that only store constant values, or serve otherwise as namespaces. They cannot be instantiated.
exp | true if the symbol is an enumeration. |
Symbol* Falcon::Symbol::setEta | ( | bool | exp | ) | [inline] |
Declares the symbol as an "eta function".
Eta functions are self-managed functions in Sigma-evaluation (functional evaluation).
exp | true if the symbol is an ETA function, false otherwise. |
void Falcon::Symbol::setExtFunc | ( | ExtFuncDef * | f | ) | [inline] |
void Falcon::Symbol::setFunction | ( | FuncDef * | func | ) | [inline] |
void Falcon::Symbol::setGlobal | ( | ) | [inline] |
void Falcon::Symbol::setImportAlias | ( | const String * | name, | |
const String * | origModule, | |||
bool | bIsFileName = false | |||
) | [inline] |
void Falcon::Symbol::setImportAlias | ( | ImportAlias * | alias | ) | [inline] |
void Falcon::Symbol::setInstance | ( | Symbol * | base_class | ) | [inline] |
void Falcon::Symbol::setLocal | ( | ) | [inline] |
void Falcon::Symbol::setLocalUndef | ( | ) | [inline] |
void Falcon::Symbol::setParam | ( | ) | [inline] |
void Falcon::Symbol::setProp | ( | VarDef * | p | ) | [inline] |
void Falcon::Symbol::setUndefined | ( | ) | [inline] |
void Falcon::Symbol::setVar | ( | VarDef * | p | ) | [inline] |
Symbol* Falcon::Symbol::setWKS | ( | bool | exp | ) | [inline] |
Declares the symbol as an "well known symbol".
Normal symbols are generated in a module, and eventually exported to the global namespace of the VM. Well known symbols live in a special space in the VM; they are always referenced and the module declaring them receives a copy of the original item, but not the original one.
Modules can i.e. change objects and can alter functions, but a copy of the original well knonw items is kept by the VM and is available to C++ extensions.
Well known items are meant to provide language-oriented special features, or to provide special hooks for modules. Error, TimeStamp and other language relevant classes are WKS (well known symbol). Modules can declare new well known symbol to i.e. declare new classes and provide C++ factory functions.
exp | true if the symbol is a Well Known Symbol. |
type_t Falcon::Symbol::type | ( | ) | const [inline] |
Referenced by getInstance().