[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode e3eedd7 167/405: Assignment indentation passe
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode e3eedd7 167/405: Assignment indentation passes tests, class declaration remains |
Date: |
Sat, 13 Jul 2019 10:00:06 -0400 (EDT) |
branch: externals/phps-mode
commit e3eedd732488f321cd5658dbbfa99bd964e27147
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Assignment indentation passes tests, class declaration remains
---
phps-mode-functions.el | 64 +++++++++++++++++++++++++-------------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index db474e3..2e19838 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -121,7 +121,7 @@
(when first-token-is-nesting-increase
(setq column-level (1+ column-level))))
- (message "new line at %s, %s %s.%s (%s - %s) = %s %s %s %s
%s [%s %s] %s %s %s" token last-token column-level tuning-level nesting-start
nesting-end round-bracket-level square-bracket-level curly-bracket-level
alternative-control-structure-level inline-control-structure-level
first-token-is-nesting-decrease first-token-is-nesting-increase
in-assignment-level in-assignment-level in-class-declaration-level)
+ (message "new line %s or last token at %s, %s %s.%s (%s -
%s) = %s %s %s %s %s [%s %s] %s %s %s" token-start-line-number token last-token
column-level tuning-level nesting-start nesting-end round-bracket-level
square-bracket-level curly-bracket-level alternative-control-structure-level
inline-control-structure-level first-token-is-nesting-decrease
first-token-is-nesting-increase in-assignment-level in-assignment-level
in-class-declaration-level)
;; Put indent-level to hash-table
(when (> last-line-number 0)
@@ -159,10 +159,12 @@
(setq nesting-start (+ round-bracket-level
square-bracket-level curly-bracket-level alternative-control-structure-level
inline-control-structure-level in-assignment-level in-class-declaration-level))
;; Set initial values for tracking first token
- (setq first-token-on-line t)
- (setq first-token-is-nesting-increase nil)
- (setq first-token-is-nesting-decrease nil)
- (setq in-assignment-level 0))
+ (when (> token-start-line-number last-line-number)
+ (setq first-token-on-line t)
+ (setq first-token-is-nesting-increase nil)
+ (setq first-token-is-nesting-decrease nil)
+ (setq in-assignment-level 0)
+ (setq in-class-declaration-level 0)))
(setq first-token-on-line nil))
;; Keep track of round bracket level
@@ -295,22 +297,22 @@
(setq after-special-control-structure-token token))
;; Keep track of assignments
- (when in-assignment
- (if (string= token ";")
- (progn
- (setq in-assignment nil)
- ;; (message "Assignment ended at semi-colon")
- )
- (when first-token-on-line
- (setq in-assignment-level 1)
- (message "In assignment on new-line at %s" token)
- )))
- (when (and (not after-special-control-structure)
- (not in-assignment)
- (string= token "="))
- ;; (message "Started assignment")
- (setq in-assignment t)
- (setq in-assignment-level 1))
+ (if in-assignment
+ (if (string= token ";")
+ (progn
+ (setq in-assignment nil)
+ ;; (message "Assignment ended at semi-colon")
+ )
+ (when (and first-token-on-line
+ (not in-heredoc))
+ (setq in-assignment-level 1)
+ (message "In assignment on new-line at %s" token)
+ ))
+ (when (and (not after-special-control-structure)
+ (string= token "="))
+ ;; (message "Started assignment")
+ (setq in-assignment t)
+ (setq in-assignment-level 1)))
;; Did we encounter a token that supports extra special
alternative control structures?
(when (equal token 'T_CASE)
@@ -331,17 +333,15 @@
(setq in-heredoc nil))
;; Keep track of when we are inside a class definition
- (when (and in-class-declaration
- first-token-on-line)
- (if (not (string= token "{"))
- (setq in-class-declaration-level 1)
- (setq in-class-declaration-level 0)))
- (when (equal token 'T_CLASS)
- (setq in-class-declaration t)
- (setq in-class-declaration-level 0))
- (when (and in-class-declaration
- (string= token "{"))
- (setq in-class-declaration nil))
+ (if in-class-declaration
+ (if (string= token "{")
+ (progn
+ (setq in-class-declaration nil))
+ (when first-token-on-line
+ (setq in-class-declaration-level 1)))
+ (when (equal token 'T_CLASS)
+ (setq in-class-declaration t)
+ (setq in-class-declaration-level 1)))
;; Are we on a new line?
(when (> token-start-line-number last-line-number)
- [elpa] externals/phps-mode b852f5f 160/405: All tests for indentation passes, (continued)
- [elpa] externals/phps-mode b852f5f 160/405: All tests for indentation passes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode dfb0427 151/405: Added unit test for round and square bracket expressions, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7b8cea3 163/405: Added failing indentation test for class multiple implements, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a61ff64 134/405: Renamed function get-point-data to get-current-line-data for better semantics, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b99da6b 153/405: Starting using new indentation calculation for indentations, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 6559760 166/405: Work on assignments and class declaration indentations, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2720be8 165/405: Indentation calculation for heredoc and nowdoc assignments passes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 13c4c78 164/405: More work on heredoc, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 47ffc37 179/405: More work on refactored indentation calculation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a5ced61 158/405: New indentation function passes all original unit tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e3eedd7 167/405: Assignment indentation passes tests, class declaration remains,
Stefan Monnier <=
- [elpa] externals/phps-mode e37c1cf 150/405: New indention calculation works with doc-comments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f789468 172/405: Took notes of new indentation tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 20e77aa 181/405: Removed debug output, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 321803a 182/405: Line indents are now cleaning on buffer changes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 38bcabb 176/405: Improved detection of assignment ends in function optional arguments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode f1236e2 169/405: Unit tests for indentation calculation for multi-line strings passes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 105fece 149/405: New indent calculation for inline syntax passes test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 0a32b17 161/405: Improved calculation for indentation for multi-line assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b2eac4d 154/405: More work on switch case default, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 6b5a5c3 155/405: More work on calculating indentations, Stefan Monnier, 2019/07/13