[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode faa4e00 201/405: Started on conceptually desc
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode faa4e00 201/405: Started on conceptually describing algorithm for multi-line assignment indentation |
Date: |
Sat, 13 Jul 2019 10:00:13 -0400 (EDT) |
branch: externals/phps-mode
commit faa4e003f9c21d490f4d822232b73e162e518379
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Started on conceptually describing algorithm for multi-line assignment
indentation
---
docs/indentation-algorithm.md | 35 +++++++++++++++++++++++------------
phps-mode-functions.el | 3 ---
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/docs/indentation-algorithm.md b/docs/indentation-algorithm.md
index df58b26..fd8a877 100644
--- a/docs/indentation-algorithm.md
+++ b/docs/indentation-algorithm.md
@@ -50,7 +50,9 @@ endforeach;
## Examples
-```php
+PHP examples using algorithms defined above, explained each line.
+
+```php // #save indent: 0
if (function( // #save indent: 0, #increase push (0 2) indent: 1
false) // #save indent: 1
) { // #decrease pop (0 2) indent: 0, #save indent:
0, #increase push (0 1) indent: 1
@@ -60,7 +62,7 @@ if (function( // #save indent: 0, #increase push (0
2) indent: 1
## Inline control structure for if-else
-```php
+```php // #save indent: 0
if (true) // #save indent: 0
echo true; // #temp-pre-indent: 1, #save indent: 1
else // #save indent: 0
@@ -69,15 +71,24 @@ else // #save indent: 0
## Alternative control structure for if-else 2
+```php // #save indent: 0
+if (true && // #save indent: 0, #increase push (0 1)
indent: 1
+ true // #save indent: 1
+): // #decrease pop (0 1) indent:
0, #save indent: 0, #increase push (0 1) indent: 1
+ echo true; // #save indent_ 1
+elseif (true // #decrease pop (0 1) indent: 0, #save indent:
0, #increase push (0 1) indent: 1
+ || false): // #decrease pop (0 1) indent: 0, #save indent:
0, #increase push (0 1) indent: 1
+ echo 'another'; // #save indent: 1
+else: // #decrease pop (0 1) indent: 0, #save
indent: 0, #increase push (0 1) indent: 1
+ echo false; // #save indent: 1
+endif; // #decrease pop (0 1) indent: 0, #save
indent: 0
+```
+
+## Multi-line assignments 1
+
```php
-if (true && #save indent: 0, #increase push (0 1) indent: 1
- true #save indent: 1
-): #decrease pop (0 1) indent: 0,
#save indent: 0, #increase push (0 1) indent: 1
- echo true; #save indent 1
-elseif (true #decrease pop (0 1) indent: 0, #save indent: 0,
#increase push (0 1) indent: 1
- || false): #decrease pop (0 1) indent: 0, #save indent: 0,
#increase push (0 1) indent: 1
- echo 'another';
-else:
- echo false;
-endif;
+<?php // #save indent: 0
+$var = 'abc' // #save indent: 0, #increase push (0 1) indent: 1
+ . 'def' // #save indent: 1
+ . 'ghj'; // #decrease pop (0 1) indent: 0, #save indent: 0 <!--
ERROR -->
```
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index cfcea9e..ff64e48 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -302,10 +302,7 @@
(< round-bracket-level in-assignment))
(progn
(setq in-assignment nil)
- (when in-assignment-started-this-line
(setq in-assignment-level 0))
- ;; (message "Assignment ended at semi-colon")
- )
(when (and first-token-on-line
(not in-heredoc))
(setq in-assignment-level 1)
- [elpa] externals/phps-mode 2c3239a 187/405: Adding new failing tests for indentation, (continued)
- [elpa] externals/phps-mode 2c3239a 187/405: Adding new failing tests for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d9a0119 183/405: Optimized indentation code by removing unused variables, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a0cbcd1 186/405: More work on indentation of multi-line IF-expressions, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d7c5f67 190/405: More work on nesting-stack, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 253839f 170/405: Added indentation unit tests for concatenated strings outside assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e38794b0 197/405: More conceptual work on algorithm for inline control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9db28d9 185/405: Added verbose flag for unit tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2a1ed52 196/405: Optimized algorithm for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a30c3f6 177/405: More work on indentation tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e8a8d41 204/405: Merged remote changes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode faa4e00 201/405: Started on conceptually describing algorithm for multi-line assignment indentation,
Stefan Monnier <=
- [elpa] externals/phps-mode 874701d 195/405: Work on alternative and inline control structure syntax with new algorithm, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ec69d07 193/405: Added a failing class declaration indentation case, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 164b77e 205/405: Unit test for alternative control syntax passes with new algorithm, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e8658c8 192/405: New indentation algorithm now passes class unit tests, started on indentation document, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ba9d8a0 199/405: More organization of tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 86404c8 207/405: New algorithm now passes tests for alternative control structure, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8b4c188 188/405: Now able to detect indent change of scope with same nesting level, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 91715f6 217/405: Added another test for multi-line function arguments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 75c4af4 214/405: Fixed indentation for lines wrapped in scripting open/close, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d754163 221/405: More work on multi-line token-less lines, Stefan Monnier, 2019/07/13