diff options
author | nyamatongwe <unknown> | 2006-02-23 01:43:35 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2006-02-23 01:43:35 +0000 |
commit | f29a50577d971cdb6b0bcef075d56906f51599a3 (patch) | |
tree | 79205dddfb000ca7e033b398d3dd68618f541033 | |
parent | 5dbfa4944ba875261e90ce7dca74eb486ffe357f (diff) | |
download | scintilla-mirror-f29a50577d971cdb6b0bcef075d56906f51599a3.tar.gz |
Recognise more scripting states as strings or comments that do not allow
termination of server side scripts with "?>" or "%>".
-rw-r--r-- | src/LexHTML.cxx | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index d830a4643..95b78476b 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -149,7 +149,13 @@ static inline bool isStringState(int state) { case SCE_HB_STRING: case SCE_HBA_STRING: case SCE_HP_STRING: + case SCE_HP_CHARACTER: + case SCE_HP_TRIPLE: + case SCE_HP_TRIPLEDOUBLE: case SCE_HPA_STRING: + case SCE_HPA_CHARACTER: + case SCE_HPA_TRIPLE: + case SCE_HPA_TRIPLEDOUBLE: case SCE_HPHP_HSTRING: case SCE_HPHP_SIMPLESTRING: case SCE_HPHP_HSTRING_VARIABLE: @@ -163,6 +169,19 @@ static inline bool isStringState(int state) { return bResult; } +static inline bool stateAllowsTermination(int state) { + bool allowTermination = !isStringState(state); + if (allowTermination) { + switch (state) { + case SCE_HPHP_COMMENT: + case SCE_HP_COMMENTLINE: + case SCE_HPA_COMMENTLINE: + allowTermination = false; + } + } + return allowTermination; +} + // not really well done, since it's only comments that should lex the %> and <% static inline bool isCommentASPState(int state) { bool bResult; @@ -763,9 +782,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty else if (( ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && ( - ((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) || - ((scriptLanguage != eScriptNone) && !isStringState(state) && - ((ch == '%') || (ch == '?'))) + ((scriptLanguage != eScriptNone) && stateAllowsTermination(state) && ((ch == '%') || (ch == '?'))) ) && (chNext == '>')) || ((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) { if (state == SCE_H_ASPAT) { |