diff options
author | nyamatongwe <devnull@localhost> | 2011-03-27 12:11:51 +1100 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2011-03-27 12:11:51 +1100 |
commit | 2570c57829a3577db3aa7323096fb14780b9147c (patch) | |
tree | d430a0fef282e796feecebf1626b076a560e54b7 /lexers/LexHTML.cxx | |
parent | 2abb669eac49043bf8916cc9c596c4ffc5bdd76e (diff) | |
download | scintilla-mirror-2570c57829a3577db3aa7323096fb14780b9147c.tar.gz |
Fix for bug with wrong recognition of number after regex literal. Bug #3209108.
Added test for this case.
Diffstat (limited to 'lexers/LexHTML.cxx')
-rw-r--r-- | lexers/LexHTML.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx index 546f5ad96..8e6b37434 100644 --- a/lexers/LexHTML.cxx +++ b/lexers/LexHTML.cxx @@ -318,19 +318,19 @@ static int classifyTagHTML(unsigned int start, unsigned int end, static void classifyWordHTJS(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) { + char s[30 + 1]; + unsigned int i = 0; + for (; i < end - start + 1 && i < 30; i++) { + s[i] = styler[start + i]; + } + s[i] = '\0'; + char chAttr = SCE_HJ_WORD; - bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); - if (wordIsNumber) + bool wordIsNumber = IsADigit(s[0]) || ((s[0] == '.') && IsADigit(s[1])); + if (wordIsNumber) { chAttr = SCE_HJ_NUMBER; - else { - char s[30 + 1]; - unsigned int i = 0; - for (; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - } - s[i] = '\0'; - if (keywords.InList(s)) - chAttr = SCE_HJ_KEYWORD; + } else if (keywords.InList(s)) { + chAttr = SCE_HJ_KEYWORD; } styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); } |