aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexHTML.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2013-03-11 19:47:24 +1100
committernyamatongwe <unknown>2013-03-11 19:47:24 +1100
commit3c07d1254ae04ee172997c1698d511d7af38002e (patch)
treecb3561f3108633059ab2de1c3377bab378ceebde /lexers/LexHTML.cxx
parent57c20df010f9442adad955cd4813f935c14d84c8 (diff)
downloadscintilla-mirror-3c07d1254ae04ee172997c1698d511d7af38002e.tar.gz
Bug [#1412]. Recognise a JavaScript RegExp literal in more situations.
Diffstat (limited to 'lexers/LexHTML.cxx')
-rw-r--r--lexers/LexHTML.cxx8
1 files changed, 3 insertions, 5 deletions
diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx
index 3793b1185..ebfd7302e 100644
--- a/lexers/LexHTML.cxx
+++ b/lexers/LexHTML.cxx
@@ -479,10 +479,6 @@ static bool isLineEnd(int ch) {
return ch == '\r' || ch == '\n';
}
-static bool isOKBeforeRE(int ch) {
- return (ch == '(') || (ch == '=') || (ch == ',');
-}
-
static bool isMakoBlockEnd(const int ch, const int chNext, const char *blockType) {
if (strlen(blockType) == 0) {
return ((ch == '%') && (chNext == '>'));
@@ -686,6 +682,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true);
const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true);
const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", 0x80, true);
+ // TODO: also handle + and - (except if they're part of ++ or --) and return keywords
+ const CharacterSet setOKBeforeJSRE(CharacterSet::setNone, "([{=,:;!%^&*|?~");
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
@@ -1587,7 +1585,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
} else if (ch == '/' && chNext == '/') {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HJ_COMMENTLINE;
- } else if (ch == '/' && isOKBeforeRE(chPrevNonWhite)) {
+ } else if (ch == '/' && setOKBeforeJSRE.Contains(chPrevNonWhite)) {
styler.ColourTo(i - 1, StateToPrint);
state = SCE_HJ_REGEX;
} else if (ch == '\"') {