| 388 | } |
| 389 | |
| 390 | bool ScriptCompiler::_compile( AbstractNodeListPtr nodes, const String &group, bool doImports, |
| 391 | bool doObjects, bool doVariables ) |
| 392 | { |
| 393 | // Set up the compilation context |
| 394 | mGroup = group; |
| 395 | |
| 396 | // Clear the past errors |
| 397 | mErrors.clear(); |
| 398 | |
| 399 | // Clear the environment |
| 400 | mEnv.clear(); |
| 401 | |
| 402 | // Processes the imports for this script |
| 403 | if( doImports ) |
| 404 | processImports( nodes ); |
| 405 | // Process object inheritance |
| 406 | if( doObjects ) |
| 407 | processObjects( nodes.get(), nodes ); |
| 408 | // Process variable expansion |
| 409 | if( doVariables ) |
| 410 | processVariables( nodes.get() ); |
| 411 | |
| 412 | // Translate the nodes |
| 413 | for( AbstractNodeList::iterator i = nodes->begin(); i != nodes->end(); ++i ) |
| 414 | { |
| 415 | // logAST(0, *i); |
| 416 | if( ( *i )->type == ANT_OBJECT && |
| 417 | static_cast<ObjectAbstractNode *>( ( *i ).get() )->abstract ) |
| 418 | continue; |
| 419 | ScriptTranslator *translator = ScriptCompilerManager::getSingleton().getTranslator( *i ); |
| 420 | if( translator ) |
| 421 | translator->translate( this, *i ); |
| 422 | } |
| 423 | |
| 424 | return mErrors.empty(); |
| 425 | } |
| 426 | |
| 427 | void ScriptCompiler::addError( uint32 code, const Ogre::String &file, unsigned int line, |
| 428 | const String &msg ) |