diff options
Diffstat (limited to 'src/LexHTML.cxx')
-rw-r--r-- | src/LexHTML.cxx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index e442054b3..e84ff6aa6 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -416,7 +416,8 @@ static bool isPHPStringState(int state) { return (state == SCE_HPHP_HSTRING) || (state == SCE_HPHP_SIMPLESTRING) || - (state == SCE_HPHP_HSTRING_VARIABLE); + (state == SCE_HPHP_HSTRING_VARIABLE) || + (state == SCE_HPHP_COMPLEX_VARIABLE); } static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], @@ -930,7 +931,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty styler.ColourTo(i, StateToPrint); state = SCE_H_DEFAULT; } - if (ch != '#' && !(isascii(ch) && isalnum(ch))) { // Should check that '#' follows '&', but it is unlikely anyway... + if (ch != '#' && !(isascii(ch) && isalnum(ch)) // Should check that '#' follows '&', but it is unlikely anyway... + && ch != '.' && ch != '-' && ch != '_' && ch != ':') { // valid in XML styler.ColourTo(i, SCE_H_TAGUNKNOWN); state = SCE_H_DEFAULT; } @@ -1499,6 +1501,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (ch == '\\') { // skip the next char i++; + } else if (ch == '$' && ((chPrev == '{' && chPrev2 != '\\' && IsPhpWordStart(chNext)) + || (chNext == '{' && IsPhpWordStart(chNext2)))) { + styler.ColourTo(i - (chNext == '{' ? 1 : 2), StateToPrint); + state = SCE_HPHP_COMPLEX_VARIABLE; } else if (ch == '$' && IsPhpWordStart(chNext)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HPHP_HSTRING_VARIABLE; @@ -1523,6 +1529,12 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty state = SCE_HPHP_HSTRING; } break; + case SCE_HPHP_COMPLEX_VARIABLE: + if (ch == '}') { + styler.ColourTo(i, StateToPrint); + state = SCE_HPHP_HSTRING; + } + break; case SCE_HPHP_OPERATOR: case SCE_HPHP_DEFAULT: styler.ColourTo(i - 1, StateToPrint); @@ -1675,7 +1687,8 @@ static void ColouriseHTMLPiece(StyleContext &sc, WordList *keywordlists[]) { } else if (sc.state == SCE_H_ENTITY) { if (sc.ch == ';') { sc.ForwardSetState(SCE_H_DEFAULT); - } else if (sc.ch != '#' && (sc.ch < 0x80) && !isalnum(sc.ch)) { // Should check that '#' follows '&', but it is unlikely anyway... + } else if (sc.ch != '#' && (sc.ch < 0x80) && !isalnum(sc.ch) // Should check that '#' follows '&', but it is unlikely anyway... + && sc.ch != '.' && sc.ch != '-' && sc.ch != '_' && sc.ch != ':') { // valid in XML sc.ChangeState(SCE_H_TAGUNKNOWN); sc.SetState(SCE_H_DEFAULT); } |