OGRE 2.1
Object-Oriented Graphics Rendering Engine
Loading...
Searching...
No Matches
Ogre::ScriptCompiler Class Reference

This is the main class for the compiler. More...

#include <OgreScriptCompiler.h>

+ Inheritance diagram for Ogre::ScriptCompiler:

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< ErrorErrorPtr
 
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.
 
bool _fireEvent (ScriptCompilerEvent *evt, void *retval)
 Internal method for firing the handleEvent method.
 
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.
 
void addError (uint32 code, const String &file, int line, const String &msg="")
 Adds the given error to the compiler's list of errors.
 
void addNameExclusion (const String &type)
 Adds a name exclusion to the map.
 
bool compile (const ConcreteNodeListPtr &nodes, const String &group)
 Compiles resources from the given concrete node list.
 
bool compile (const String &str, const String &source, const String &group)
 Takes in a string of script code and compiles it into resources.
 
ScriptCompilerListenergetListener ()
 Returns the currently set listener.
 
const StringgetResourceGroup () const
 Returns the resource group currently set for this compiler.
 
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 *)
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info
 
voidoperator new (size_t sz, void *ptr)
 placement operator new
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info
 
uint32 registerCustomWordId (const String &word)
 Adds a custom word id which can be used for custom script translators.
 
void removeNameExclusion (const String &type)
 Removes a name exclusion.
 
void setListener (ScriptCompilerListener *listener)
 Sets the listener used by the compiler.
 

Static Public Member Functions

static String formatErrorCode (uint32 code)
 

Friends

class AbstractTreeBuilder
 

Detailed Description

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.

Member Typedef Documentation

◆ ErrorList

◆ ErrorPtr

◆ IdMap

Member Enumeration Documentation

◆ anonymous enum

Enumerator
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 

◆ anonymous enum

Enumerator
ID_ON 
ID_OFF 
ID_TRUE 
ID_FALSE 
ID_YES 
ID_NO 

Constructor & Destructor Documentation

◆ ScriptCompiler()

Ogre::ScriptCompiler::ScriptCompiler ( )

◆ ~ScriptCompiler()

virtual Ogre::ScriptCompiler::~ScriptCompiler ( )
inlinevirtual

Member Function Documentation

◆ _compile()

bool Ogre::ScriptCompiler::_compile ( AbstractNodeListPtr  nodes,
const String group,
bool  doImports = true,
bool  doObjects = true,
bool  doVariables = true 
)

Compiles the given abstract syntax tree.

◆ _fireEvent()

bool Ogre::ScriptCompiler::_fireEvent ( ScriptCompilerEvent evt,
void retval 
)

Internal method for firing the handleEvent method.

◆ _generateAST()

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.

◆ addError()

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.

◆ addNameExclusion()

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.

◆ compile() [1/2]

bool Ogre::ScriptCompiler::compile ( const ConcreteNodeListPtr nodes,
const String group 
)

Compiles resources from the given concrete node list.

◆ compile() [2/2]

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.

Parameters
strThe script code
sourceThe source of the script code (e.g. a script file)
groupThe resource group to place the compiled resources into

◆ formatErrorCode()

static String Ogre::ScriptCompiler::formatErrorCode ( uint32  code)
static

◆ getListener()

ScriptCompilerListener * Ogre::ScriptCompiler::getListener ( )

Returns the currently set listener.

◆ getResourceGroup()

const String & Ogre::ScriptCompiler::getResourceGroup ( ) const

Returns the resource group currently set for this compiler.

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr,
const char ,
int  ,
const char  
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr,
void  
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void ptr,
const char ,
int  ,
const char  
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [2/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char file,
int  line,
const char func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [3/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ operator new[]() [2/2]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char file,
int  line,
const char func 
)
inlineinherited

array operator new, with debug line info

◆ registerCustomWordId()

uint32 Ogre::ScriptCompiler::registerCustomWordId ( const String word)

Adds a custom word id which can be used for custom script translators.

Parameters
wordThe word to be registered.
Returns
The word id for the registered word.
Note
If the word is already registered, the already registered id is returned.

◆ removeNameExclusion()

void Ogre::ScriptCompiler::removeNameExclusion ( const String type)

Removes a name exclusion.

◆ setListener()

void Ogre::ScriptCompiler::setListener ( ScriptCompilerListener listener)

Sets the listener used by the compiler.

Friends And Related Symbol Documentation

◆ AbstractTreeBuilder

friend class AbstractTreeBuilder
friend

The documentation for this class was generated from the following file: