summaryrefslogtreecommitdiff
path: root/indra/llui/llkeywords.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llkeywords.h')
-rw-r--r--indra/llui/llkeywords.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h
index 53b5435324..9d9c8f964c 100644
--- a/indra/llui/llkeywords.h
+++ b/indra/llui/llkeywords.h
@@ -36,6 +36,8 @@
#include <map>
#include <list>
#include <deque>
+#include <vector>
+#include <cstddef>
#include "llpointer.h"
class LLTextSegment;
@@ -53,6 +55,7 @@ public:
* - TT_ONE_SIDED_DELIMITER are for open-ended delimiters which are terminated by EOL.
* - TT_TWO_SIDED_DELIMITER are for delimiters that end with a different delimiter than they open with.
* - TT_DOUBLE_QUOTATION_MARKS are for delimiting areas using the same delimiter to open and close.
+ * - TT_LONG_BRACKET are for Lua tokens that use brackets with counted equals signs.
*/
typedef enum e_token_type
{
@@ -62,6 +65,7 @@ public:
TT_TWO_SIDED_DELIMITER,
TT_ONE_SIDED_DELIMITER,
TT_DOUBLE_QUOTATION_MARKS,
+ TT_LONG_BRACKET, // Lua long brackets: --[=*[ or [=*[
// Following constants are more specific versions of the preceding ones
TT_CONSTANT, // WORD
TT_CONTROL, // WORD
@@ -82,6 +86,10 @@ public:
{
}
+ ~LLKeywordToken()
+ {
+ }
+
S32 getLengthHead() const { return static_cast<S32>(mToken.size()); }
S32 getLengthTail() const { return static_cast<S32>(mDelimiter.size()); }
bool isHead(const llwchar* s) const;
@@ -118,7 +126,33 @@ public:
const LLWString& text,
class LLTextEditor& editor,
LLStyleConstSP style);
- void initialize(LLSD SyntaxXML);
+ struct SegmentOp
+ {
+ enum EOpType
+ {
+ OP_LINE_BREAK,
+ OP_TOKEN
+ };
+ EOpType type;
+ S32 start;
+ S32 end;
+ LLKeywordToken* token;
+ };
+ typedef std::vector<SegmentOp> segment_ops_t;
+ void collectSegmentOps(segment_ops_t& ops, const LLWString& text, bool disable_syntax_highlighting) const;
+ void applySegmentOps(std::vector<LLTextSegmentPtr> *seg_list,
+ const LLWString& text,
+ const segment_ops_t& ops,
+ class LLTextEditor& editor,
+ LLStyleConstSP style);
+ bool applySegmentOpsRange(std::vector<LLTextSegmentPtr> *seg_list,
+ const LLWString& text,
+ const segment_ops_t& ops,
+ size_t& op_index,
+ size_t max_ops,
+ class LLTextEditor& editor,
+ LLStyleConstSP style);
+ void initialize(LLSD SyntaxXML, bool luau_language = false);
void processTokens();
// Add the token as described
@@ -189,10 +223,14 @@ protected:
bool mLoaded;
LLSD mSyntax;
+ bool mLuauLanguage;
word_token_map_t mWordTokenMap;
typedef std::deque<LLKeywordToken*> token_list_t;
token_list_t mLineTokenList;
token_list_t mDelimiterTokenList;
+ typedef std::map<llwchar, token_list_t> token_by_first_char_map_t;
+ token_by_first_char_map_t mLineTokenByFirstChar;
+ token_by_first_char_map_t mDelimiterTokenByFirstChar;
typedef std::unordered_map<std::string, std::string, ll::string_hash, std::equal_to<>> element_attributes_t;
typedef element_attributes_t::const_iterator attribute_iterator_t;