two_sided_delimiter workaround (Broken comment blocks in LSL '/*comment*/') Didn't want to mess with the token class for one single case. This fix is pretty straight-forward and self-contained.

This commit is contained in:
Shyotl
2011-06-25 00:28:28 -05:00
parent 046bbf52f9
commit 378053bd48
3 changed files with 11 additions and 6 deletions

View File

@@ -344,7 +344,10 @@ void LLKeywords::findSegments(std::vector<LLTextSegment *>* seg_list, const LLWS
if( cur_delimiter->getType() == LLKeywordToken::TWO_SIDED_DELIMITER )
{
while( *cur && !cur_delimiter->isHead(cur))
LLWString str = cur_delimiter->getToken();
std::reverse(str.begin(),str.end()); //Flip the delim around (/* changes to */)
LLKeywordToken reverse_delimiter(cur_delimiter->getType(),cur_delimiter->getColor(),str,cur_delimiter->getToolTip());
while( *cur && !reverse_delimiter.isHead(cur))
{
// Check for an escape sequence.
if (*cur == '\\')
@@ -358,7 +361,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegment *>* seg_list, const LLWS
cur++;
}
// Is the next character the end delimiter?
if (cur_delimiter->isHead(cur))
if (reverse_delimiter.isHead(cur))
{
// Is there was an odd number of backslashes, then this delimiter
// does not end the sequence.

View File

@@ -644,11 +644,12 @@ return Leave current function or event handler
# Comment
[one_sided_delimiter .8, .3, .15]
// Comment:Non-functional commentary or disabled code
# for now two_sided_delimiter spans from the token to the token, reversed. (eg: /* to */)
[two_sided_delimiter .8, .3, .15]
/* */ Comment:Non-functional commentary or disabled code
/* Comment:Non-functional commentary or disabled code
# String literals
[two_sided_delimiter_esc 0, .2, 0]
" " String literal
" String literal
#functions are supplied by the program now.

View File

@@ -603,11 +603,12 @@ return Leave current function or event handler
# Comment
[one_sided_delimiter .86, .69, .50]
// Comment:Non-functional commentary or disabled code
# for now two_sided_delimiter spans from the token to the token, reversed. (eg: /* to */)
[two_sided_delimiter .86, .69, .50]
/* */ Comment:Non-functional commentary or disabled code
/* Comment:Non-functional commentary or disabled code
# String literals
[two_sided_delimiter_esc .57, .83, .52]
" " String literal
" String literal
#functions are supplied by the program now.