diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx
index 0bff582d..6ed2d46f 100644
--- a/lexers/LexHTML.cxx
+++ b/lexers/LexHTML.cxx
@@ -675,6 +675,29 @@ constexpr bool isPHPStringState(int state) noexcept {
(state == SCE_HPHP_COMPLEX_VARIABLE);
}
+constexpr bool IsPHPEntryState(int state) noexcept {
+ return !(isPHPStringState(state) || IsScriptCommentState(state) || AnyOf(state, SCE_H_ASPAT, SCE_HPHP_COMMENT, SCE_HPHP_COMMENTLINE));
+}
+
+enum class AllowPHP : int {
+ None,
+ PHP,
+ QuestionOrPHP,
+};
+
+bool IsPHPStart(AllowPHP allowPHP, Accessor &styler, Sci_PositionU start) {
+ if (allowPHP == AllowPHP::None) {
+ return false;
+ }
+ if (allowPHP == AllowPHP::PHP) {
+ // Require {
DefineProperty("lexer.xml.allow.scripts", &OptionsHTML::allowScripts,
"Set to 0 to disable scripts in XML.");
+ DefineProperty("lexer.xml.allow.php", &OptionsHTML::allowPHPinXML,
+ "Set to 0 to disable PHP in XML, 1 to accept