Loading...
Searching...
No Matches
Ogre::ScriptCompiler Class Reference
Core » Script

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

`#include <OgreScriptCompiler.h>`

Inheritance diagram for Ogre::ScriptCompiler:
[legend]

## 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_REFERENCETOANONEXISTINGOBJECT , CE_DEPRECATEDSYMBOL }
enum | { ID_ON = 1 , ID_OFF = 2 , ID_TRUE = 1 , ID_FALSE = 2 , ID_YES = 1 , ID_NO = 2 }
typedef std::unordered_map< String, uint32 > | IdMap

## Public Member Functions

| ScriptCompiler ()
virtual | ~ScriptCompiler ()
bool | _fireEvent (ScriptCompilerEvent *evt, void *retval)
| Internal method for firing the handleEvent method.
void | addError (const AbstractNode &node, const String &msg="", uint32 code=CE_INVALIDPARAMETERS)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void | addError (uint32 code, const String &file, int line, const String &msg="")
| Adds the given error to the compiler's list of errors.
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.
const String & | getFileName () const
| Returns the current source file name.
ScriptCompilerListener * | getListener ()
| Returns the currently set listener.
const String & | getResourceGroup () const
| Returns the resource group currently set for this compiler.
uint32 | registerCustomWordId (const String &word)
| Adds a custom word id which can be used for custom script translators.
void | setListener (ScriptCompilerListener *listener)
| Sets the listener used by the compiler.

## Static Public Member Functions

static String | formatErrorCode (uint32 code)

## 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

## IdMap

typedef std::unordered_map<String,uint32> Ogre::ScriptCompiler::IdMap

## Member Enumeration Documentation

## anonymous enum

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_REFERENCETOANONEXISTINGOBJECT |
CE_DEPRECATEDSYMBOL |

## anonymous enum

anonymous enum

Enumerator
ID_ON |
ID_OFF |
ID_TRUE |
ID_FALSE |
ID_YES |
ID_NO |

## Constructor & Destructor Documentation

## ScriptCompiler()

Ogre::ScriptCompiler::ScriptCompiler | ( |  | ) |

Referenced by getPropertyName.

## ~ScriptCompiler()

virtual Ogre::ScriptCompiler::~ScriptCompiler | ( |  | ) |

inline virtual

## Member Function Documentation

## formatErrorCode()

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

static

## compile() [1/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

  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

## compile() [2/2]

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

Compiles resources from the given concrete node list.

## addError() [1/2]

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.

## addError() [2/2]

void Ogre::ScriptCompiler::addError | ( | const AbstractNode & | node,
|  | const String & | msg = "",
|  | uint32 | code = CE_INVALIDPARAMETERS )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References CE_INVALIDPARAMETERS.

## setListener()

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

Sets the listener used by the compiler.

## 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.

## getFileName()

const String & Ogre::ScriptCompiler::getFileName | ( |  | ) | const

inline

Returns the current source file name.

## _fireEvent()

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

Internal method for firing the handleEvent method.

## registerCustomWordId()

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

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

Parameters

  word | The 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.

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

- OgreScriptCompiler.h