summaryrefslogtreecommitdiff
path: root/indra/newview/llscripteditor.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2025-02-25 06:43:52 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2025-02-25 07:43:20 +0200
commit0cc0db81afec26842ea9887aa50afb072d13914c (patch)
tree460f042d65824849c786d3dbd69722a07083d6da /indra/newview/llscripteditor.cpp
parent10de131019c7ceaad6f156f8397b1ec2a8d84fc9 (diff)
#3422 Better handling of Lua syntax
Diffstat (limited to 'indra/newview/llscripteditor.cpp')
-rw-r--r--indra/newview/llscripteditor.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp
index 59cf3ac02b..0edaf43753 100644
--- a/indra/newview/llscripteditor.cpp
+++ b/indra/newview/llscripteditor.cpp
@@ -141,20 +141,24 @@ void LLScriptEditor::drawLineNumbers()
}
}
-void LLScriptEditor::initKeywords()
+void LLScriptEditor::initKeywords(bool luau_language)
{
- mKeywords.initialize(LLSyntaxIdLSL::getInstance()->getKeywordsXML());
+ mKeywordsLua.initialize(LLSyntaxLua::getInstance()->getKeywordsXML(), true);
+ mKeywordsLSL.initialize(LLSyntaxIdLSL::getInstance()->getKeywordsXML(), false);
+
+ mLuauLanguage = luau_language;
+
}
void LLScriptEditor::loadKeywords()
{
LL_PROFILE_ZONE_SCOPED;
- mKeywords.processTokens();
+ getKeywords().processTokens();
LLStyleConstSP style = new LLStyle(LLStyle::Params().font(getScriptFont()).color(mDefaultColor.get()));
segment_vec_t segment_list;
- mKeywords.findSegments(&segment_list, getWText(), *this, style);
+ getKeywords().findSegments(&segment_list, getWText(), *this, style);
mSegments.clear();
segment_set_t::iterator insert_it = mSegments.begin();
@@ -166,7 +170,7 @@ void LLScriptEditor::loadKeywords()
void LLScriptEditor::updateSegments()
{
- if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly)
+ if (mReflowIndex < S32_MAX && getKeywords().isLoaded() && mParseOnTheFly)
{
LL_PROFILE_ZONE_SCOPED;
@@ -174,7 +178,7 @@ void LLScriptEditor::updateSegments()
// HACK: No non-ascii keywords for now
segment_vec_t segment_list;
- mKeywords.findSegments(&segment_list, getWText(), *this, style);
+ getKeywords().findSegments(&segment_list, getWText(), *this, style);
clearSegments();
for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it)
@@ -194,6 +198,21 @@ void LLScriptEditor::clearSegments()
}
}
+LLKeywords::keyword_iterator_t LLScriptEditor::keywordsBegin()
+{
+ return mLuauLanguage ? mKeywordsLua.begin() : mKeywordsLSL.begin();
+}
+
+LLKeywords::keyword_iterator_t LLScriptEditor::keywordsEnd()
+{
+ return mLuauLanguage ? mKeywordsLua.end() : mKeywordsLSL.end();
+}
+
+LLKeywords& LLScriptEditor::getKeywords()
+{
+ return mLuauLanguage ? mKeywordsLua : mKeywordsLSL;
+}
+
// Most of this is shamelessly copied from LLTextBase
void LLScriptEditor::drawSelectionBackground()
{