summaryrefslogtreecommitdiff
path: root/indra/llui/llkeywords.h
diff options
context:
space:
mode:
authorniel@nirvana-win7hp.planescape.home <niel@nirvana-win7hp.planescape.home>2011-10-26 01:38:29 +0100
committerniel@nirvana-win7hp.planescape.home <niel@nirvana-win7hp.planescape.home>2011-10-26 01:38:29 +0100
commit42c166e451d362609d83fb17261f9e8f344e974d (patch)
treef1b68ddb7c50daf4140dda6288bb5bf25076d4e9 /indra/llui/llkeywords.h
parentdaca4ed45845d49a3ad98bae76a468ceb4595316 (diff)
STORM-959 Adding syntax highlighting for /* */ style comments
Diffstat (limited to 'indra/llui/llkeywords.h')
-rw-r--r--indra/llui/llkeywords.h33
1 files changed, 28 insertions, 5 deletions
diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h
index f6d75b7e75..d050cd7d7c 100644
--- a/indra/llui/llkeywords.h
+++ b/indra/llui/llkeywords.h
@@ -41,23 +41,44 @@ typedef LLPointer<LLTextSegment> LLTextSegmentPtr;
class LLKeywordToken
{
public:
- enum TOKEN_TYPE { WORD, LINE, TWO_SIDED_DELIMITER, ONE_SIDED_DELIMITER };
+ /**
+ * @brief Types of tokens/delimters being parsed.
+ *
+ * @desc Tokens/delimiters that need to be identified/highlighted. All are terminated if an EOF is encountered.
+ * - WORD are keywords in the normal sense, i.e. constants, events, etc.
+ * - LINE are for entire lines (currently only flow control labels use this).
+ * - ONE_SIDED_DELIMITER are for open-ended delimiters which are terminated by EOL.
+ * - TWO_SIDED_DELIMITER are for delimiters that end with a different delimiter than they open with.
+ * - DOUBLE_QUOTATION_MARKS are for delimiting areas using the same delimiter to open and close.
+ */
+ typedef enum TOKEN_TYPE
+ {
+ WORD,
+ LINE,
+ TWO_SIDED_DELIMITER,
+ ONE_SIDED_DELIMITER,
+ DOUBLE_QUOTATION_MARKS
+ };
- LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip )
+ LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter )
:
mType( type ),
mToken( token ),
mColor( color ),
- mToolTip( tool_tip )
+ mToolTip( tool_tip ),
+ mDelimiter( delimiter ) // right delimiter
{
}
- S32 getLength() const { return mToken.size(); }
+ S32 getLengthHead() const { return mToken.size(); }
+ S32 getLengthTail() const { return mDelimiter.size(); }
BOOL isHead(const llwchar* s) const;
+ BOOL isTail(const llwchar* s) const;
const LLWString& getToken() const { return mToken; }
const LLColor3& getColor() const { return mColor; }
TOKEN_TYPE getType() const { return mType; }
const LLWString& getToolTip() const { return mToolTip; }
+ const LLWString& getDelimiter() const { return mDelimiter; }
#ifdef _DEBUG
void dump();
@@ -68,6 +89,7 @@ private:
LLWString mToken;
LLColor3 mColor;
LLWString mToolTip;
+ LLWString mDelimiter;
};
class LLKeywords
@@ -85,7 +107,8 @@ public:
void addToken(LLKeywordToken::TOKEN_TYPE type,
const std::string& key,
const LLColor3& color,
- const std::string& tool_tip = LLStringUtil::null);
+ const std::string& tool_tip = LLStringUtil::null,
+ const std::string& delimiter = LLStringUtil::null);
// This class is here as a performance optimization.
// The word token map used to be defined as std::map<LLWString, LLKeywordToken*>.