Skip to content

Commit 7da776b

Browse files
committed
Add php-indent.el, a CC Mode-free indentation engine ported from js.el
Extracted from the cc-mode independent php-mode work (#812) so that it can be reviewed and land independently of the Emacs 28.1 requirement that blocks that branch until the August release (#811). The engine is ported from the syntax-ppss based indenter of js.el in GNU Emacs (attributed in the file header); the JavaScript specific handling (JSX, C preprocessor macros, array comprehensions and regexp literals) is removed, and PHP specifics are added: -> / ?-> / :: method and property chains, the . concatenation operator aligned to the assignment, statement continuations, switch/case, the alternative syntax (endif and friends) and heredoc/nowdoc bodies. Its entry points are php-indent-line and php-indent-region. The file is self-contained: it only requires php.el for the php customization group, and defines no symbol that collides with the current php-mode. This is purely additive: nothing sets php-indent-line as indent-line-function yet, so the engine is inert -- the current CC Mode based php-mode keeps indenting through cc-engine. Registering both new files in Eask so they are byte-compiled by CI.
1 parent fca743a commit 7da776b

2 files changed

Lines changed: 713 additions & 0 deletions

File tree

Eask

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"lisp/php.el"
1313
"lisp/php-complete.el"
1414
"lisp/php-defs.el"
15+
"lisp/php-indent.el"
16+
"lisp/php-keywords.el"
1517
"lisp/php-face.el"
1618
"lisp/php-format.el"
1719
"lisp/php-project.el"

0 commit comments

Comments
 (0)