diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-02-25 06:43:52 +0200 |
|---|---|---|
| committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-02-25 07:43:20 +0200 |
| commit | 0cc0db81afec26842ea9887aa50afb072d13914c (patch) | |
| tree | 460f042d65824849c786d3dbd69722a07083d6da /indra/newview/llsyntaxid.cpp | |
| parent | 10de131019c7ceaad6f156f8397b1ec2a8d84fc9 (diff) | |
#3422 Better handling of Lua syntax
Diffstat (limited to 'indra/newview/llsyntaxid.cpp')
| -rw-r--r-- | indra/newview/llsyntaxid.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 5114ee3672..1f8766eea2 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -40,7 +40,8 @@ //----------------------------------------------------------------------------- const std::string SYNTAX_ID_CAPABILITY_NAME = "LSLSyntax"; const std::string SYNTAX_ID_SIMULATOR_FEATURE = "LSLSyntaxId"; -const std::string FILENAME_DEFAULT = "keywords_lsl_default.xml"; +const std::string FILENAME_DEFAULT_LSL = "keywords_lsl_default.xml"; +const std::string FILENAME_DEFAULT_LUA = "keywords_lua_default.xml"; /** * @brief LLSyntaxIdLSL constructor @@ -60,7 +61,7 @@ LLSyntaxIdLSL::LLSyntaxIdLSL() void LLSyntaxIdLSL::buildFullFileSpec() { ELLPath path = mSyntaxId.isNull() ? LL_PATH_APP_SETTINGS : LL_PATH_CACHE; - const std::string filename = mSyntaxId.isNull() ? FILENAME_DEFAULT : "keywords_lsl_" + mSyntaxId.asString() + ".llsd.xml"; + const std::string filename = mSyntaxId.isNull() ? FILENAME_DEFAULT_LSL : "keywords_lsl_" + mSyntaxId.asString() + ".llsd.xml"; mFullFileSpec = gDirUtilp->getExpandedFilename(path, filename); } @@ -325,3 +326,38 @@ boost::signals2::connection LLSyntaxIdLSL::addSyntaxIDCallback(const syntax_id_c { return mSyntaxIDChangedSignal.connect(cb); } + + + +//----------------------------------------------------------------------------- +// LLSyntaxLua +//----------------------------------------------------------------------------- +LLSyntaxLua::LLSyntaxLua() + : mKeywordsXml(LLSD()) + , mInitialized(false) +{ +} + +void LLSyntaxLua::initialize() +{ + if (mInitialized) return; + + loadDefaultKeywordsIntoLLSD(); + + mInitialized = true; +} + +void LLSyntaxLua::loadDefaultKeywordsIntoLLSD() +{ + std::string fullFileSpec = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, FILENAME_DEFAULT_LUA); + llifstream file(fullFileSpec.c_str()); + + if (file.good()) + { + LLSD content; + if (LLSDSerialize::fromXML(content, file) != LLSDParser::PARSE_FAILURE) + { + mKeywordsXml = content; + } + } +} |
