diff options
| author | nyamatongwe <devnull@localhost> | 2013-03-11 19:47:24 +1100 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2013-03-11 19:47:24 +1100 | 
| commit | aca495f73c79306c1b53c1ecd91a5d6e6e6ec861 (patch) | |
| tree | 48c49803ee41b74abe98a4509788d1864714329d /lexers/LexHTML.cxx | |
| parent | de6171e4aeba60d57ed7bdc289907371b0e0e08b (diff) | |
| download | scintilla-mirror-aca495f73c79306c1b53c1ecd91a5d6e6e6ec861.tar.gz | |
Bug [#1412]. Recognise a JavaScript RegExp literal in more situations.
Diffstat (limited to 'lexers/LexHTML.cxx')
| -rw-r--r-- | lexers/LexHTML.cxx | 8 | 
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 == '\"') { | 
