[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode baab77a 121/405: Unit tests for inline contro
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode baab77a 121/405: Unit tests for inline control structures working |
Date: |
Sat, 13 Jul 2019 09:59:56 -0400 (EDT) |
branch: externals/phps-mode
commit baab77ae322c60e9a14e8471374c3c07fb09081b
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Unit tests for inline control structures working
---
phps-mode-functions.el | 18 ++++++++++--------
phps-mode-test-functions.el | 6 +++---
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index a443b10..d23d06d 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -226,7 +226,8 @@
(found-line-tokens nil)
(after-special-control-structure nil)
(round-brace-level 0)
- (expecting-semi-colon nil)
+ (start-expecting-semi-colon nil)
+ (end-expecting-semi-colon nil)
(first-token-on-line nil))
(catch 'stop-iteration
(dolist (item phps-mode-lexer-tokens)
@@ -277,10 +278,10 @@
(setq start-alternative-control-structure-level (-
start-alternative-control-structure-level 1)))
;; Reduce inline control structure level when we encounter a
semi-colon after it's opening
- (when (and expecting-semi-colon
+ (when (and start-expecting-semi-colon
(string= token ";"))
(setq start-inline-control-structure-level (-
start-inline-control-structure-level 1))
- (setq expecting-semi-colon nil))
+ (setq start-expecting-semi-colon nil))
)
@@ -321,10 +322,10 @@
(setq end-alternative-control-structure-level (-
end-alternative-control-structure-level 1)))
;; Reduce inline control structure level when we encounter a
semi-colon after it's opening
- (when (and expecting-semi-colon
+ (when (and end-expecting-semi-colon
(string= token ";"))
(setq end-inline-control-structure-level (-
end-inline-control-structure-level 1))
- (setq expecting-semi-colon nil))
+ (setq end-expecting-semi-colon nil))
)
@@ -367,12 +368,13 @@
(when (or (<= token-end line-beginning)
(= first-token-on-line end-token-number))
- (setq start-inline-control-structure-level (+
start-inline-control-structure-level 1)))
+ (setq start-inline-control-structure-level (+
start-inline-control-structure-level 1))
+ (setq start-expecting-semi-colon t))
(when (<= token-start line-end)
- (setq end-inline-control-structure-level (+
end-inline-control-structure-level 1)))
+ (setq end-inline-control-structure-level (+
end-inline-control-structure-level 1))
+ (setq end-expecting-semi-colon t))
- (setq expecting-semi-colon t)
(message "Was not colon")))
(setq after-special-control-structure nil))
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 453462e..3902c5e 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -343,17 +343,17 @@
(phps-mode-test-with-buffer
"<?php\nif ($myCondition)\n echo 'was here';\necho 'was here 2';\n"
(goto-char 60)
- (should (equal (list (list t 0 0 0 0 0 4 nil) (list t 0 0 0 0 0 7 nil))
(phps-mode-functions-get-point-data))))
+ (should (equal (list (list t 0 0 0 0 0 7 nil) (list t 0 0 0 0 0 10 nil))
(phps-mode-functions-get-point-data))))
(phps-mode-test-with-buffer
"<?php\nif ($myCondition) echo 'was here'; echo 'was here 2';\n"
(goto-char 32)
- (should (equal (list (list t 0 0 0 0 0 4 nil) (list t 0 0 0 0 0 8 nil))
(phps-mode-functions-get-point-data))))
+ (should (equal (list (list t 0 0 0 0 0 0 nil) (list t 0 0 0 0 0 10 nil))
(phps-mode-functions-get-point-data))))
(phps-mode-test-with-buffer
"<?php\nif ($myCondition) echo 'was here'; echo 'was here 2';\n"
(goto-char 55)
- (should (equal (list (list t 0 0 0 0 0 4 nil) (list t 0 0 0 0 0 8 nil))
(phps-mode-functions-get-point-data))))
+ (should (equal (list (list t 0 0 0 0 0 0 nil) (list t 0 0 0 0 0 10 nil))
(phps-mode-functions-get-point-data))))
;; TODO ALTERNATIVE SYNTAX
- [elpa] externals/phps-mode 7688cd7 111/405: Got incremental lexer working after renaming again, (continued)
- [elpa] externals/phps-mode 7688cd7 111/405: Got incremental lexer working after renaming again, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9c4a3ba 117/405: More work on alternative control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 3272991 110/405: Merge branch 'master' of https://github.com/cjohansson/emacs-phps-mode, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7c6ee3e 107/405: More work on renaming, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 46a8256 116/405: Starting implementation of tracking alternative control structure level, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9ac21f1 120/405: More work on inline and alternative control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 41ef691 112/405: Fixed lint warning of unused variables, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 12c22ee 119/405: More work on alternative and inline meta information, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7e2e902 126/405: Fixed a unit test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 80da137 114/405: Preparations for adding alternative and inline syntax, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode baab77a 121/405: Unit tests for inline control structures working,
Stefan Monnier <=
- [elpa] externals/phps-mode f0dc652 143/405: More work on new indentation function, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7dca537 105/405: Started work on renaming files, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e11a1fc 123/405: Fine-tuning of logic collecting data about inline and alternative control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e206605 115/405: Adding failing unit tests for inline and alternative syntax, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode c6aa633 118/405: More work on keeping track of alternative control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 60c7431 122/405: Unit tests for gather data about inline and alternative control structure syntax passes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 897f249 124/405: Work on alternative and inline indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode be35ed6 127/405: Added sample files for inline and alternative control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 7279913 113/405: Improved TODOs, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a8eadfa 130/405: Improved sample files inline and alternative control structures, Stefan Monnier, 2019/07/13