summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIma Mechanique <ima.mechanique@secondlife.com>2014-01-14 03:45:14 +0000
committerIma Mechanique <ima.mechanique@secondlife.com>2014-01-14 03:45:14 +0000
commit8df2007187236d1b77ccec916fc63f0481cf599c (patch)
tree5e2a0811e9bd8cce4e3b8fa9be53143a19846c4a
parentbc1cecd75435f29d360bc305ed3f20bc2d2dda7e (diff)
storm-1831 Enabling highlighting of deprecated and god-mode functions.
-rwxr-xr-xindra/llui/llkeywords.cpp94
-rwxr-xr-xindra/newview/skins/default/colors.xml4
2 files changed, 64 insertions, 34 deletions
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 9dd14f4a2f..fe91c74fa0 100755
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -177,33 +177,68 @@ std::string LLKeywords::getAttribute(const std::string& key)
LLColor4 LLKeywords::getColorGroup(const std::string key_in)
{
std::string ColourGroup = "Black";
- if (key_in == "constants-float") {
+ if (key_in == "constants-float")
+ {
ColourGroup = "SyntaxLslConstantFloat";
- } else if (key_in == "constants-integer") {
+ }
+ else if (key_in == "constants-integer")
+ {
ColourGroup = "SyntaxLslConstantInteger";
- } else if (key_in == "constants-key") {
+ }
+ else if (key_in == "constants-key")
+ {
ColourGroup = "SyntaxLslConstantKey";
- } else if (key_in == "constants-string") {
+ }
+ else if (key_in == "constants-string")
+ {
ColourGroup = "SyntaxLslConstantRotation";
- } else if (key_in == "constants-string") {
+ }
+ else if (key_in == "constants-string")
+ {
ColourGroup = "SyntaxLslConstantString";
- } else if (key_in == "constants-vector") {
+ }
+ else if (key_in == "constants-vector")
+ {
ColourGroup = "SyntaxLslConstantVector";
- } else if (key_in == "controls") {
+ }
+ else if (key_in == "controls")
+ {
ColourGroup = "SyntaxLslControlFlow";
- } else if (key_in == "events") {
+ }
+ else if (key_in =="deprecated")
+ {
+ ColourGroup = "SyntaxLslDeprecated";
+ }
+ else if (key_in == "events")
+ {
ColourGroup = "SyntaxLslEvent";
- } else if (key_in == "functions") {
+ }
+ else if (key_in == "functions")
+ {
ColourGroup = "SyntaxLslFunction";
- } else if (key_in == "types") {
+ }
+ else if (key_in =="god-mode")
+ {
+ ColourGroup = "SyntaxLslGodMode";
+ }
+ else if (key_in == "types")
+ {
ColourGroup = "SyntaxLslDataType";
- } else if (key_in == "sections") {
+ }
+ else if (key_in == "sections")
+ {
ColourGroup = "SyntaxLslSection";
- } else if (key_in == "misc-double_quotation_marks") {
+ }
+ else if (key_in == "misc-double_quotation_marks")
+ {
ColourGroup = "SyntaxLslStringLiteral";
- } else if (key_in == "misc-comments_1_sided") {
+ }
+ else if (key_in == "misc-comments_1_sided")
+ {
ColourGroup = "SyntaxLslComment1Sided";
- } else if (key_in == "misc-comments_2_sided") {
+ }
+ else if (key_in == "misc-comments_2_sided")
+ {
ColourGroup = "SyntaxLslComment2Sided";
}
@@ -228,20 +263,9 @@ void LLKeywords::processTokens()
LLSD::map_iterator outerIt = mSyntax.beginMap();
for ( ; outerIt != mSyntax.endMap(); ++outerIt)
{
- if (outerIt->first == "misc")
+ if (outerIt->first == "llsd-lsl-syntax-version")
{
- if (outerIt->second.isMap())
- {
- LLSD::map_iterator innerIt = outerIt->second.beginMap();
- for ( ; innerIt != outerIt->second.endMap(); ++innerIt)
- {
- processTokensGroup(innerIt->second, "misc-" + innerIt->first);
- }
- }
- else
- {
- LL_ERRS("LSL-Tokens-Processing") << "Map for misc entries is missing! Ignoring." << LL_ENDL;
- }
+ LL_INFOS("SyntaxLSL") << "Skipping over version key." << LL_ENDL;
}
else
{
@@ -255,12 +279,15 @@ void LLKeywords::processTokens()
}
}
}
- LL_INFOS("") << LL_ENDL;
+ LL_INFOS("SyntaxLSL") << "Finished processing tokens." << LL_ENDL;
}
void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group)
{
LLColor4 Color;
+ LLColor4 ColorGroup;
+ LLColor4 ColorDeprecated = getColorGroup("deprecated");
+ LLColor4 ColorGM = getColorGroup("god-mode");
LLKeywordToken::TOKEN_TYPE token_type = LLKeywordToken::TT_UNKNOWN;
// If a new token type is added here, it must also be added to the 'addToken' method
@@ -289,7 +316,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group)
token_type = LLKeywordToken::TT_TYPE;
}
- Color = getColorGroup(Group);
+ ColorGroup = getColorGroup(Group);
LL_INFOS("Tokens") << "Group: '" << Group << "', using colour: '" << Color << "'" << LL_ENDL;
if (Tokens.isMap())
@@ -299,6 +326,7 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group)
{
if (outerIt->second.isMap())
{
+ Color = ColorGroup;
mAttributes.clear();
bool deprecated = false;
LLSD arguments = LLSD ();
@@ -348,11 +376,13 @@ void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group)
tooltip += getAttribute("tooltip");
}
- deprecated = getAttribute("deprecated") == "true" ? true : false;
- if (deprecated)
+ Color = getAttribute("deprecated") == "true" ? ColorDeprecated : ColorGroup;
+
+ if (getAttribute("god-mode") == "true")
{
- Color = getColorGroup("deprecated");
+ Color = ColorGM;
}
+
addToken(token_type, outerIt->first, Color, tooltip);
}
}
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 77a8fc7e22..dab4c5eb3b 100755
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -936,9 +936,9 @@
<color
name="SyntaxLslDataType"
value=".1 .3 .1 1.0" />
- <color
+ <color
name="SyntaxLslDeprecated"
- value=".9 .4 .55 1.0" />
+ value="0.9 0.0 0.66, 1.0" />
<color
name="SyntaxLslEvent"
value="0 .3 .5 1.0" />