diff --git a/php-mode-test.el b/php-mode-test.el index adf7d42b..5d37d8c5 100644 --- a/php-mode-test.el +++ b/php-mode-test.el @@ -945,7 +945,3 @@ style from Drupal." (php-project-get-root-dir)))) ;;; php-mode-test.el ends here - -;; Local Variables: -;; firestarter: ert-run-tests-interactively -;; End: diff --git a/php-mode.el b/php-mode.el index 364937f0..64ea2aca 100644 --- a/php-mode.el +++ b/php-mode.el @@ -675,6 +675,10 @@ might be to handle switch and goto labels differently." (c-lang-const c-constant-kwds)) :test 'string-equal)))) +(c-lang-defconst c-basic-matchers-before + php (cl-remove-if (lambda (elm) (and (listp elm) (equal (car elm) "\\s|"))) + (c-lang-const c-basic-matchers-before php))) + (defun php-lineup-cascaded-calls (langelem) "Line up chained methods using `c-lineup-cascaded-calls', but only if the setting is enabled" @@ -984,7 +988,7 @@ this ^ lineup" "Build a regular expression for the end of a heredoc started by the string HEREDOC-START." ;; Extract just the identifier without <<< and quotes. (string-match "\\_<.+?\\_>" heredoc-start) - (concat "^\\(" (match-string 0 heredoc-start) "\\)\\W")) + (concat "^\\s-*\\(" (match-string 0 heredoc-start) "\\)\\W")) (defun php-syntax-propertize-function (start end) "Apply propertize rules from START to END." @@ -996,12 +1000,7 @@ this ^ lineup" (while (re-search-forward "['\"]" end t) (when (php-in-comment-p) (c-put-char-property (match-beginning 0) - 'syntax-table (string-to-syntax "_")))) - (funcall - (syntax-propertize-rules - ("\\(\"\\)\\(\\\\.\\|[^\"\n\\]\\)*\\(\"\\)" (1 "\"") (3 "\"")) - ("\\('\\)\\(\\\\.\\|[^'\n\\]\\)*\\('\\)" (1 "\"") (3 "\""))) - start end)) + 'syntax-table (string-to-syntax "_"))))) (defun php-heredoc-syntax () "Mark the boundaries of searched heredoc." diff --git a/tests/issue-439.php b/tests/issue-439.php index 6d5a92d8..2280d7ac 100644 --- a/tests/issue-439.php +++ b/tests/issue-439.php @@ -31,3 +31,13 @@ $g = <<<"いろは" Let'go Justin いろは; + +var_dump(<<<"ABC" +Let'go Justin +ABC); + +if (1 === 1) { + var_dump(<<<"ABC" + Let'go Justin + ABC); +} diff --git a/tests/issue-439.php.faces b/tests/issue-439.php.faces index 91377cef..cc06b621 100644 --- a/tests/issue-439.php.faces +++ b/tests/issue-439.php.faces @@ -39,4 +39,11 @@ ("g" . php-variable-name) (" = ") ("<<<\"いろは\"\nLet'go Justin\nいろは" . php-string) - (";\n")) + (";\n\nvar_dump(") + ("<<<\"ABC\"\nLet'go Justin\nABC" . php-string) + (");\n\n") + ("if" . php-keyword) + (" (1 === 1) {\n var_dump(") + ("<<<\"ABC\"\n Let'go Justin\n ABC" . php-string) + (");\n}\n") + )