From 657cfd8c64d012cb10e663f7a828ee64186fef4e Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 17 Jul 2001 07:47:11 +0000 Subject: Patch to not bounce out PHP mode when a is seen within a PHP string. Half by Steve and half by me. --- src/LexHTML.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/LexHTML.cxx') 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 == '>')) { -- cgit v1.2.3