From 97359fb4230a10582c01f309ccfd1ac399ec0fcd Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 27 Mar 2011 12:11:51 +1100 Subject: Fix for bug with wrong recognition of number after regex literal. Bug #3209108. Added test for this case. --- lexers/LexHTML.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'lexers') 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)); } -- cgit v1.2.3