[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 74ab2a7 294/405: Work on incremental lexer an
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 74ab2a7 294/405: Work on incremental lexer and failing test for indent |
Date: |
Sat, 13 Jul 2019 10:00:35 -0400 (EDT) |
branch: externals/phps-mode
commit 74ab2a71b62df8b1d742a510d63afeb58c344953
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Work on incremental lexer and failing test for indent
---
phps-mode-lexer.el | 11 +++++++----
phps-mode-test-functions.el | 13 ++++++++++---
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index 95ce874..87a824e 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -399,8 +399,7 @@
;; Push token start, end, lexer state and state stack to variable
(push (list start end phps-mode-lexer-STATE phps-mode-lexer-state_stack)
phps-mode-lexer-states)
- (semantic-lex-push-token
- (semantic-lex-token token start end)))
+ (semantic-lex-push-token (semantic-lex-token token start end)))
;; TODO Figure out what this does
(defun phps-mode-lexer-SKIP_TOKEN (_token _start _end)
@@ -1691,9 +1690,12 @@
;; Build new list of tokens before point of change
(catch 'stop-iteration
(dolist (token tokens)
- (let ((start (car (cdr token))))
+ (let ((start (car (cdr token)))
+ (end (cdr (cdr token))))
(if (< start previous-token-end)
- (push token old-tokens)
+ (progn
+ (semantic-lex-push-token (semantic-lex-token token
start end))
+ (push token old-tokens))
(throw 'stop-iteration nil)))))
(setq old-tokens (nreverse old-tokens))
@@ -1731,6 +1733,7 @@
(when (boundp 'semantic-lex-analyzer)
(setq semantic-lex-analyzer 'phps-mode-lexer-lex))
(add-hook 'semantic-lex-reset-functions #'phps-mode-lexer-setup)
+ (set (make-local-variable 'phps-mode-lexer-tokens) nil)
(phps-mode-lexer-run))
(provide 'phps-mode-lexer)
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 792ab9f..7f18ae7 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -164,13 +164,22 @@
;; TODO Fix below
-
+ (phps-mode-test-with-buffer
+ "<?php\n$myVar = 'blaha'\n . 'ijeije' . __(\n 'okeoke'\n ) .
'okeoke';\n?>"
+ "Concatenated assignment string with function call"
+ (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (0
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+
(phps-mode-test-with-buffer
"<?php\n$myVar = 'blaha'\n . 'ijeije' . __(\n 'okeoke'\n )\n
. 'okeoke';\n?>"
"Concatenated assignment string with function call"
(should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (1
0)) (7 (0 0))) (phps-mode-test-hash-to-list
(phps-mode-functions-get-lines-indent)))))
(phps-mode-test-with-buffer
+ "<?php\necho 'blaha'\n . 'ijeije' . __(\n 'okeoke'\n ) .
'okeoke';\n?>"
+ "Concatenated echo string with function call"
+ (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (0
0))) (phps-mode-test-hash-to-list (phps-mode-functions-get-lines-indent)))))
+
+ (phps-mode-test-with-buffer
"<?php\necho 'blaha'\n . 'ijeije' . __(\n 'okeoke'\n )\n .
'okeoke';\n?>"
"Concatenated echo string with function call"
(should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (1
0)) (7 (0 0))) (phps-mode-test-hash-to-list
(phps-mode-functions-get-lines-indent)))))
@@ -222,8 +231,6 @@
;; (message "Indent: %s" (phps-mode-test-hash-to-list
(phps-mode-functions-get-lines-indent)))
(should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (1
0)) (7 (1 0)) (8 (2 0)) (9 (1 0)) (10 (0 0))) (phps-mode-test-hash-to-list
(phps-mode-functions-get-lines-indent)))))
- ;; TODO Fix this below
-
(phps-mode-test-with-buffer
"<?php\nnamespace Vendor\\Package;\n\nclass ClassName\n{\n public
function aVeryLongMethodName(\n ClassTypeHint $arg1,\n &$arg2,\n
array $arg3 = []\n ) {\n // method body\n }\n}"
"PSR-2 : 4.4. Method Arguments : Example 2"
- [elpa] externals/phps-mode 81c7179 293/405: Fixed indentation bug with assignment of square array in function argument, (continued)
- [elpa] externals/phps-mode 81c7179 293/405: Fixed indentation bug with assignment of square array in function argument, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 419a812 298/405: More work on debugging indentation with assignment, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ed36115 288/405: Added TODO item for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 52cfc78 281/405: Added failing indent test, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 46147f4 287/405: Fixed bug with undefined token-end-line-number in new buffers, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 66edaca 286/405: Improved lexing of comment version doc comment, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 55f61b0 296/405: New algorithm for concatenation indentation passes tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9069d0a 300/405: Concatenation indentation now uses stack, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e639ea3 299/405: Indent passing new concatenation tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 5be3560 291/405: Adding more indent examples from PSR-2, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 74ab2a7 294/405: Work on incremental lexer and failing test for indent,
Stefan Monnier <=
- [elpa] externals/phps-mode b31f817 292/405: Added all examples from PSR-2 as tests for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2087abd 282/405: Added two failing tests for switch indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 43c13b4 295/405: Started on new algorithm for concatenation indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode b2ff76e 283/405: Started on debugging switch indentation bug, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 1aadb1b 285/405: Added failing lexer test for comment vs doc-comment, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 95de04b 274/405: New layout for lexer grammar passes unit tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 00d3568 290/405: Added indentation examples from official PSR-2, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ec3fd41 289/405: Added failing indent test for mixed concatenation and function call, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode cc77604 284/405: Fixed bug with indentation after switch case statements, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode eeffdb2 315/405: Fixed trailing white-space, Stefan Monnier, 2019/07/13