From 79645e6981a97224024c5226d8713dce9569d54a Mon Sep 17 00:00:00 2001
From: Ima Mechanique <ima.mechanique@secondlife.com>
Date: Mon, 21 Oct 2013 04:09:20 +0100
Subject: [PATCH] STORM-1831 First attempt at using SyntaxIdLSL capability.
 (incomplete)

---
 indra/llui/llkeywords.cpp         |  6 +++---
 indra/llui/llkeywords.h           |  3 ++-
 indra/newview/CMakeLists.txt      |  2 ++
 indra/newview/llpreviewscript.cpp | 10 +++++++++-
 indra/newview/llpreviewscript.h   |  2 ++
 5 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 33a8cc947df..687c2fb31d6 100755
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -29,7 +29,6 @@
 #include <iostream>
 #include <fstream>
 
-#include "lldir.h"
 #include "llkeywords.h"
 #include "llsdserialize.h"
 #include "lltexteditor.h"
@@ -70,7 +69,7 @@ inline BOOL LLKeywordToken::isTail(const llwchar* s) const
 
 LLKeywords::LLKeywords() : mLoaded(FALSE)
 {
-	setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_default.xml") );
+	//setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_default.xml") );
 }
 
 LLKeywords::~LLKeywords()
@@ -199,9 +198,10 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in)
 	return LLUIColorTable::instance().getColor(ColourGroup);
 }
 
-BOOL LLKeywords::initialise()
+BOOL LLKeywords::initialise(ELLPath path, const std::string filename)
 {
 	mReady = false;
+	setFilenameSyntax( gDirUtilp->getExpandedFilename(path, filename) );
 
 	if (! loadIntoLLSD(mFilenameSyntax, mSyntax) )
 	{
diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h
index 77a12bc1e5a..1bd23549d23 100755
--- a/indra/llui/llkeywords.h
+++ b/indra/llui/llkeywords.h
@@ -28,6 +28,7 @@
 #define LL_LLKEYWORDS_H
 
 
+#include "lldir.h"
 #include "llstring.h"
 #include "v3color.h"
 #include "v4color.h"
@@ -116,7 +117,7 @@ class LLKeywords
 	void		setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; }
 
 	void		findSegments(std::vector<LLTextSegmentPtr> *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor );
-	BOOL		initialise();
+	BOOL		initialise(ELLPath path, const std::string filename);
 	std::string	processColors();
 	std::string	processColors(LLSD &data, const std::string strGroup);
 	void		processTokens();
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 97243bc8b1f..b7627f2eb09 100755
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -519,6 +519,7 @@ set(viewer_SOURCE_FILES
     llstylemap.cpp
     llsurface.cpp
     llsurfacepatch.cpp
+    llsyntaxid.cpp
     llsyswellitem.cpp
     llsyswellwindow.cpp
     llteleporthistory.cpp
@@ -1093,6 +1094,7 @@ set(viewer_HEADER_FILES
     llstylemap.h
     llsurface.h
     llsurfacepatch.h
+    llsyntaxid.h
     llsyswellitem.h
     llsyswellwindow.h
     lltable.h
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 2e9907fcd27..62e1d765b32 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -406,7 +406,15 @@ BOOL LLScriptEdCore::postBuild()
 
 	initMenu();
 
-	mEditor->mKeywords.initialise();
+// Make this work ;-)
+	mSyntaxLSL = LLSyntaxIdLSL();
+
+//	mSyntaxLSL.initialise();
+//	mSyntaxLSL.mKeywords = &mEditor->mKeywords;
+	// ...
+//	mSyntaxLSL->mKeywords.initialise();
+// Move into the SyntaxIdLSL class
+	mEditor->mKeywords.initialise(mSyntaxLSL.filenamePath(), mSyntaxLSL.filenameCurrent());
 
 	// FIX: Refactor LLTextEditor::loadKeywords so these can be removed.
 	std::vector<std::string> funcs;
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index 9fb0a4fb63b..21e33f30d5d 100755
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -35,6 +35,7 @@
 #include "lliconctrl.h"
 #include "llframetimer.h"
 #include "llfloatergotoline.h"
+#include "llsyntaxid.h"
 
 class LLLiveLSLFile;
 class LLMessageSystem;
@@ -149,6 +150,7 @@ class LLScriptEdCore : public LLPanel
 	BOOL			mEnableSave;
 	BOOL			mHasScriptData;
 	LLLiveLSLFile*	mLiveFile;
+	LLSyntaxIdLSL	mSyntaxLSL;
 
 	LLScriptEdContainer* mContainer; // parent view
 };
-- 
GitLab