aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexHTML.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2011-03-27 12:11:51 +1100
committernyamatongwe <unknown>2011-03-27 12:11:51 +1100
commit97359fb4230a10582c01f309ccfd1ac399ec0fcd (patch)
tree0aacb25658c934d34249b2d4a4e2ea9e257378a6 /lexers/LexHTML.cxx
parent790d04e00e42a613c132444def2faa432534d366 (diff)
downloadscintilla-mirror-97359fb4230a10582c01f309ccfd1ac399ec0fcd.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.cxx22
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));
}