branch: externals/phps-mode
commit 7a4b98ef62d99bae45daa1fb77c7e045cc966556
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
More work on algorithm description
---
docs/indentation-algorithm.md | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/docs/indentation-algorithm.md b/docs/indentation-algorithm.md
index 9d41b0c..4913064 100644
--- a/docs/indentation-algorithm.md
+++ b/docs/indentation-algorithm.md
@@ -47,6 +47,12 @@ foreach token in buffer:
indent-start = indent;
+ if new-token-line-start is more than one line after
last-token-line-start AND token is not T_CLOSE_TAG:
+ foreach line between last-token-line-start and
new-token-line-start:
+ save line indent-start
+ endforeach;
+ endforeach;
+
if temp-pre-indent: // #temp-pre-indent
indent-start = temp-pre-indent;
endif;
@@ -70,8 +76,29 @@ foreach token in buffer:
indent++;
endif;
+ indent-end = indent;
+ if token-end-line-number > token-start-line-number:
+ if (in-heredoc AND !in-heredoc-started-this-line) OR
in-heredoc-ended-this-line:
+ indent-end = 0;
+ endif;
+
+ if token = T_DOC_COMMENT:
+ tuning-level = 1;
+ endif;
+
+ foreach line between token-start-line-number to
token-end-line-number:
+ save line indent-end tuning-level;
+ endforeach;
+ endif;
+
in-heredoc-started-this-line = false;
in-heredoc-ended-this-line = false;
+ first-token-on-line = true;
+
+ else:
+ if token != T_OPEN_TAG AND token != T_OPEN_TAG_WITH_ECHO:
+ first-token-on-line = false;
+ endif;
endif;
endforeach;