aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2001-07-17 07:47:11 +0000
committernyamatongwe <unknown>2001-07-17 07:47:11 +0000
commit657cfd8c64d012cb10e663f7a828ee64186fef4e (patch)
tree4c0165b1a8193a800e41f0f408905c96e3d10b42 /src
parent833d5f6f814ec90dde39c6a0e14c3051ace86483 (diff)
downloadscintilla-mirror-657cfd8c64d012cb10e663f7a828ee64186fef4e.tar.gz
Patch to not bounce out PHP mode when a <? or ?> is seen within a
PHP string. Half by Steve and half by me.
Diffstat (limited to 'src')
-rw-r--r--src/LexHTML.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx
index ac4f85c0d..a79aa4c8d 100644
--- a/src/LexHTML.cxx
+++ b/src/LexHTML.cxx
@@ -345,6 +345,13 @@ static bool isOKBeforeRE(char ch) {
return (ch == '(') || (ch == '=') || (ch == ',');
}
+static bool isPHPStringState(int state) {
+ return
+ (state == SCE_HPHP_HSTRING) ||
+ (state == SCE_HPHP_SIMPLESTRING) ||
+ (state == SCE_HPHP_HSTRING_VARIABLE);
+}
+
static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
@@ -519,7 +526,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
/////////////////////////////////////
// handle the start of PHP pre-processor = Non-HTML
- else if ((state != SCE_H_ASPAT) && (ch == '<') && (chNext == '?')) {
+ else if ((state != SCE_H_ASPAT) &&
+ !isPHPStringState(state) &&
+ (ch == '<') && (chNext == '?')) {
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
@@ -582,7 +591,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
else if (
((inScriptType == eNonHtmlPreProc)
|| (inScriptType == eNonHtmlScriptPreProc)) && (
- ((scriptLanguage == eScriptPHP) && (ch == '?')) ||
+ ((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state)) ||
((scriptLanguage != eScriptNone) && !isStringState(state) &&
(ch == '%'))
) && (chNext == '>')) {