OSDN Git Service

Fix PHP syntax highlighting. (#802)
authorJun Tajima <56220423+tjmprm77@users.noreply.github.com>
Sat, 22 May 2021 13:15:09 +0000 (22:15 +0900)
committerGitHub <noreply@github.com>
Sat, 22 May 2021 13:15:09 +0000 (22:15 +0900)
- Fixed an issue where the text after the closing tag "?>" in a comment or string is not highlighted correctly.

Externals/crystaledit/editlib/parsers/html.cpp

index c2bd8d0..4434c22 100644 (file)
@@ -150,6 +150,21 @@ out:
               nActualItems += nActualItemsEmbedded;
               if (!pszEnd)
                 dwCookie |= COOKIE_EXT_USER1;
+              else if ((nEmbeddedLanguage == SRC_PHP) && (dwCookie & (COOKIE_EXT_COMMENT | COOKIE_STRING | COOKIE_CHAR)))
+                {
+                  // A closing tag in a comment or string.
+                  if (dwCookie & COOKIE_EXT_COMMENT)
+                    {
+                      DEFINE_BLOCK(I, COLORINDEX_COMMENT);
+                    }
+                  else if (dwCookie & (COOKIE_STRING | COOKIE_CHAR))
+                    {
+                      DEFINE_BLOCK(I, COLORINDEX_STRING);
+                    }
+                  nextI += 2;    // Length of "?>"
+                  dwCookie |= COOKIE_EXT_USER1;
+                  bRedefineBlock = true;
+                }
               else
                 {
                   dwCookie = 0;