[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 7cfa35c 81/96: Improved error-reporting for p
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 7cfa35c 81/96: Improved error-reporting for parser errors |
Date: |
Fri, 29 Oct 2021 11:15:01 -0400 (EDT) |
branch: externals/phps-mode
commit 7cfa35c8452f5175be475a72ad0f637be35d71e0
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Improved error-reporting for parser errors
---
phps-mode-lex-analyzer.el | 6 ++++--
test/phps-mode-test-lexer.el | 32 +++++++++++++++-----------------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index ce6a3b5..4de830c 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -456,13 +456,14 @@
;; Display parser error (if any)
(when phps-mode-lex-analyzer--parse-error
+ (setq phps-mode-serial--status 'error)
(phps-mode-lex-analyzer--set-region-syntax-color
(nth 4 phps-mode-lex-analyzer--parse-error)
(point-max)
(list 'font-lock-face 'font-lock-warning-face))
(display-warning
'phps-mode
- (nth 2 phps-mode-lex-analyzer--parse-error)
+ (nth 1 phps-mode-lex-analyzer--parse-error)
:warning
"*PHPs Parser Errors*"))))))
@@ -623,13 +624,14 @@
;; Display parser error (if any)
(when phps-mode-lex-analyzer--parse-error
+ (setq phps-mode-serial--status 'error)
(phps-mode-lex-analyzer--set-region-syntax-color
(nth 4 phps-mode-lex-analyzer--parse-error)
(point-max)
(list 'font-lock-face 'font-lock-warning-face))
(display-warning
'phps-mode
- (nth 2 phps-mode-lex-analyzer--parse-error)
+ (nth 1 phps-mode-lex-analyzer--parse-error)
:warning
"*PHPs Parser Errors*"))))))
diff --git a/test/phps-mode-test-lexer.el b/test/phps-mode-test-lexer.el
index 9a48959..385d44e 100644
--- a/test/phps-mode-test-lexer.el
+++ b/test/phps-mode-test-lexer.el
@@ -72,14 +72,13 @@
phps-mode-lex-analyzer--tokens
'((T_INLINE_HTML 1 . 39) (T_OPEN_TAG 39 . 45) (T_EXIT 47 . 51) (";" 51 .
52) (T_CLOSE_TAG 53 . 55) (T_INLINE_HTML 55 . 80) (T_OPEN_TAG 80 . 86) (T_EXIT
86 . 90) (";" 90 . 91) (T_CLOSE_TAG 92 . 94)))))
- ;; TODO Make parser handle this
- ;; (phps-mode-test--with-buffer
- ;; "<?php\n\n$k = 'key';\n\necho \"\\$a['{$k}']\";"
- ;; "A tricky case where variable inside double quote is escaped"
- ;; ;; (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
- ;; (should (equal
- ;; phps-mode-lex-analyzer--tokens
- ;; '((T_OPEN_TAG 1 . 7) (T_VARIABLE 8 . 10) ("=" 11 . 12)
(T_CONSTANT_ENCAPSED_STRING 13 . 18) (";" 18 . 19) (T_ECHO 21 . 25) ("\"" 26 .
27) (T_CONSTANT_ENCAPSED_STRING 27 . 32) (T_CURLY_OPEN 32 . 33) (T_VARIABLE 33
. 35) ("}" 35 . 36) (T_CONSTANT_ENCAPSED_STRING 36 . 38) ("\"" 38 . 39) (";" 39
. 40)))))
+ (phps-mode-test--with-buffer
+ "<?php\n\n$k = 'key';\n\necho \"\\$a['{$k}']\";"
+ "A tricky case where variable inside double quote is escaped"
+ ;; (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
+ (should (equal
+ phps-mode-lex-analyzer--tokens
+ '((T_OPEN_TAG 1 . 7) (T_VARIABLE 8 . 10) ("=" 11 . 12)
(T_CONSTANT_ENCAPSED_STRING 13 . 18) (";" 18 . 19) (T_ECHO 21 . 25) ("\"" 26 .
27) (T_CONSTANT_ENCAPSED_STRING 27 . 32) (T_CURLY_OPEN 32 . 33) (T_VARIABLE 33
. 35) ("}" 35 . 36) (T_CONSTANT_ENCAPSED_STRING 36 . 38) ("\"" 38 . 39) (";" 39
. 40)))))
)
@@ -209,15 +208,14 @@
phps-mode-lex-analyzer--tokens
'((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 16) ("=" 17 . 18) (T_VARIABLE 19 .
24) ("[" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 31) ("]" 31 . 32)
(T_COALESCE 33 . 35) (T_CONSTANT_ENCAPSED_STRING 36 . 44) (";" 44 . 45)
(T_VARIABLE 46 . 51) (T_OBJECT_OPERATOR 51 . 53) (T_STRING 53 . 60)
(T_OBJECT_OPERATOR 60 . 62) (T_STRING 62 . 66) ("[" 66 . 67)
(T_CONSTANT_ENCAPSED_STRING 67 . 77) ("]" 77 . 78) ("[" 78 . 79)
(T_CONSTANT_ENCAPSED_STRING 79 . 88) ("]" 88 . 89) (T_COALESCE_EQUAL 90 . 93)
(T [...]
- ;; TODO Uncomment when parser handles this
- ;; (phps-mode-test--with-buffer
- ;; "<?php\necho $array['abc'];\necho \"My $array[12] random statement\";\n"
- ;; "Long inside array offset"
- ;; ;; (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
- ;; (should
- ;; (equal
- ;; phps-mode-lex-analyzer--tokens
- ;; '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 18) ("[" 18 .
19) (T_CONSTANT_ENCAPSED_STRING 19 . 24) ("]" 24 . 25) (";" 25 . 26) (T_ECHO 27
. 31) ("\"" 32 . 33) (T_CONSTANT_ENCAPSED_STRING 33 . 36) (T_VARIABLE 36 . 42)
("[" 42 . 43) (T_NUM_STRING 43 . 45) ("]" 45 . 46) (T_CONSTANT_ENCAPSED_STRING
46 . 63) ("\"" 63 . 64) (";" 64 . 65)))))
+ (phps-mode-test--with-buffer
+ "<?php\necho $array['abc'];\necho \"My $array[12] random statement\";\n"
+ "Long inside array offset"
+ ;; (message "Tokens: %s" phps-mode-lex-analyzer--tokens)
+ (should
+ (equal
+ phps-mode-lex-analyzer--tokens
+ '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 18) ("[" 18 . 19)
(T_CONSTANT_ENCAPSED_STRING 19 . 24) ("]" 24 . 25) (";" 25 . 26) (T_ECHO 27 .
31) ("\"" 32 . 33) (T_CONSTANT_ENCAPSED_STRING 33 . 36) (T_VARIABLE 36 . 42)
("[" 42 . 43) (T_NUM_STRING 43 . 45) ("]" 45 . 46) (T_CONSTANT_ENCAPSED_STRING
46 . 63) ("\"" 63 . 64) (";" 64 . 65)))))
(phps-mode-test--with-buffer
"<?php\n/*my comment */\n/** my doc comment */"
- [elpa] externals/phps-mode 37fdd2e 78/96: Passing all tests with parser integrated somewhat, (continued)
- [elpa] externals/phps-mode 37fdd2e 78/96: Passing all tests with parser integrated somewhat, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode e3b9403 69/96: Removed garbage collection modification, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 1789d15 60/96: Fixed bug in gramamr automation, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 08e1325 74/96: Test of parser not dependent on buffer name, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode eced7be 77/96: Parser now not dependent on lex-analyzer variables, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 4f7126b 70/96: Fixed automation grammar setting of lex-analyzer functions, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode ce5e28e 72/96: Added generated grammar in output of automation, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode e698a2e 64/96: Re-generated parser with automated grammar, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 128868c 75/96: Added another parse test, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode f44577a 79/96: More testing integrating parser and lex-analyzer, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 7cfa35c 81/96: Improved error-reporting for parser errors,
Christian Johansson <=
- [elpa] externals/phps-mode 91b425f 73/96: Update of parsers lex-analyzer function to not depend on lexer buffer, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 0f11914 83/96: Fixed lexer issue with wrong token for expressions inside double quoted strings, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 50c9b31 84/96: Added 2 TODO items, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode c9f6fdb 82/96: Mode-line status now signals parser errors, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode e007ea7 88/96: Fixed parser-mode issue with parser and lex-analyzer integration, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode bc8306f 71/96: Fix in automation grammar to support exporting, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 238f967 76/96: Cleaned up lex function, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 5e375e3 80/96: Parser is not blocking lexer anymore, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 7b62779 86/96: Added another TODO item, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode c5058c5 87/96: Fixed issue with async.el support for parser, Christian Johansson, 2021/10/29