OGRE-Next
2.3
Object-Oriented Graphics Rendering Engine
|
This is the main class for the compiler. More...
#include <OgreScriptCompiler.h>
Classes | |
struct | Error |
Public Types | |
enum | { CE_STRINGEXPECTED , CE_NUMBEREXPECTED , CE_FEWERPARAMETERSEXPECTED , CE_VARIABLEEXPECTED , CE_UNDEFINEDVARIABLE , CE_OBJECTNAMEEXPECTED , CE_OBJECTALLOCATIONERROR , CE_INVALIDPARAMETERS , CE_DUPLICATEOVERRIDE , CE_UNEXPECTEDTOKEN , CE_OBJECTBASENOTFOUND , CE_UNSUPPORTEDBYRENDERSYSTEM , CE_REFERENCETOANONEXISTINGOBJECT } |
enum | { ID_ON = 1 , ID_OFF = 2 , ID_TRUE = 1 , ID_FALSE = 2 , ID_YES = 1 , ID_NO = 2 } |
typedef list< ErrorPtr >::type | ErrorList |
typedef SharedPtr< Error > | ErrorPtr |
typedef unordered_map< String, uint32 >::type | IdMap |
Public Member Functions | |
ScriptCompiler () | |
virtual | ~ScriptCompiler () |
bool | _compile (AbstractNodeListPtr nodes, const String &group, bool doImports=true, bool doObjects=true, bool doVariables=true) |
Compiles the given abstract syntax tree. More... | |
bool | _fireEvent (ScriptCompilerEvent *evt, void *retval) |
Internal method for firing the handleEvent method. More... | |
AbstractNodeListPtr | _generateAST (const String &str, const String &source, bool doImports=false, bool doObjects=false, bool doVariables=false) |
Generates the AST from the given string script. More... | |
void | addError (uint32 code, const String &file, int line, const String &msg="") |
Adds the given error to the compiler's list of errors. More... | |
void | addNameExclusion (const String &type) |
Adds a name exclusion to the map. More... | |
bool | compile (const ConcreteNodeListPtr &nodes, const String &group) |
Compiles resources from the given concrete node list. More... | |
bool | compile (const String &str, const String &source, const String &group) |
Takes in a string of script code and compiles it into resources. More... | |
ScriptCompilerListener * | getListener () |
Returns the currently set listener. More... | |
const String & | getResourceGroup () const |
Returns the resource group currently set for this compiler. More... | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete (void *ptr, void *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info More... | |
void * | operator new (size_t sz, void *ptr) |
placement operator new More... | |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info More... | |
uint32 | registerCustomWordId (const String &word) |
Adds a custom word id which can be used for custom script translators. More... | |
void | removeNameExclusion (const String &type) |
Removes a name exclusion. More... | |
void | setListener (ScriptCompilerListener *listener) |
Sets the listener used by the compiler. More... | |
Static Public Member Functions | |
static String | formatErrorCode (uint32 code) |
Friends | |
class | AbstractTreeBuilder |
This is the main class for the compiler.
It calls the parser and processes the CST into an AST and then uses translators to translate the AST into the final resources.
typedef list<ErrorPtr>::type Ogre::ScriptCompiler::ErrorList |
typedef SharedPtr<Error> Ogre::ScriptCompiler::ErrorPtr |
typedef unordered_map<String,uint32>::type Ogre::ScriptCompiler::IdMap |
anonymous enum |
Ogre::ScriptCompiler::ScriptCompiler | ( | ) |
|
inlinevirtual |
bool Ogre::ScriptCompiler::_compile | ( | AbstractNodeListPtr | nodes, |
const String & | group, | ||
bool | doImports = true , |
||
bool | doObjects = true , |
||
bool | doVariables = true |
||
) |
Compiles the given abstract syntax tree.
bool Ogre::ScriptCompiler::_fireEvent | ( | ScriptCompilerEvent * | evt, |
void * | retval | ||
) |
Internal method for firing the handleEvent method.
AbstractNodeListPtr Ogre::ScriptCompiler::_generateAST | ( | const String & | str, |
const String & | source, | ||
bool | doImports = false , |
||
bool | doObjects = false , |
||
bool | doVariables = false |
||
) |
Generates the AST from the given string script.
void Ogre::ScriptCompiler::addError | ( | uint32 | code, |
const String & | file, | ||
int | line, | ||
const String & | msg = "" |
||
) |
Adds the given error to the compiler's list of errors.
void Ogre::ScriptCompiler::addNameExclusion | ( | const String & | type | ) |
Adds a name exclusion to the map.
Name exclusions identify object types which cannot accept names. This means that excluded types will always have empty names. All values in the object header are stored as object values.
bool Ogre::ScriptCompiler::compile | ( | const ConcreteNodeListPtr & | nodes, |
const String & | group | ||
) |
Compiles resources from the given concrete node list.
bool Ogre::ScriptCompiler::compile | ( | const String & | str, |
const String & | source, | ||
const String & | group | ||
) |
Takes in a string of script code and compiles it into resources.
str | The script code |
source | The source of the script code (e.g. a script file) |
group | The resource group to place the compiled resources into |
ScriptCompilerListener* Ogre::ScriptCompiler::getListener | ( | ) |
Returns the currently set listener.
const String& Ogre::ScriptCompiler::getResourceGroup | ( | ) | const |
Returns the resource group currently set for this compiler.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
operator new, with debug line info
|
inlineinherited |
placement operator new
|
inlineinherited |
|
inlineinherited |
array operator new, with debug line info
Adds a custom word id which can be used for custom script translators.
word | The word to be registered. |
void Ogre::ScriptCompiler::removeNameExclusion | ( | const String & | type | ) |
Removes a name exclusion.
void Ogre::ScriptCompiler::setListener | ( | ScriptCompilerListener * | listener | ) |
Sets the listener used by the compiler.
|
friend |