[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode e007ea7 88/96: Fixed parser-mode issue with p
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode e007ea7 88/96: Fixed parser-mode issue with parser and lex-analyzer integration |
Date: |
Fri, 29 Oct 2021 11:15:04 -0400 (EDT) |
branch: externals/phps-mode
commit e007ea74ef243031abbd184a21a17ddf3b59c989
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Fixed parser-mode issue with parser and lex-analyzer integration
---
phps-mode-automation-grammar.el | 10 +++++++++-
phps-mode-parser.el | 17 ++++++++++++-----
test/phps-mode-test-parser.el | 17 ++++++++---------
3 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/phps-mode-automation-grammar.el b/phps-mode-automation-grammar.el
index 5a1cc34..8f40aa4 100644
--- a/phps-mode-automation-grammar.el
+++ b/phps-mode-automation-grammar.el
@@ -135,6 +135,8 @@
(car (cdr token))
temp-token-list-index)
phps-mode-parser-position)
+
+ ;; Compatibility with parser
(unless (or
(equal token-type 'T_OPEN_TAG)
(equal token-type 'T_CLOSE_TAG)
@@ -151,17 +153,23 @@
temp-token-list-index
(1+ temp-token-list-index))
)))))
-
(when
token-list-index
(let ((token
(nth
token-list-index
phps-mode-parser-tokens)))
+
+ ;; Compatibility with parser
(when (equal (car token) 'T_OPEN_TAG_WITH_ECHO)
(setf
(car token)
'T_ECHO))
+ (when (equal (car token) 'T_CLOSE_TAG)
+ (setf
+ (car token)
+ ";"))
+
token))))
"The custom lex-analyzer.")
diff --git a/phps-mode-parser.el b/phps-mode-parser.el
index fee65b1..63fe9b9 100644
--- a/phps-mode-parser.el
+++ b/phps-mode-parser.el
@@ -178,9 +178,10 @@
(car (cdr token))
temp-token-list-index)
phps-mode-parser-position)
+
+ ;; Compatibility with parser
(unless (or
(equal token-type 'T_OPEN_TAG)
- (equal token-type 'T_CLOSE_TAG)
(equal token-type 'T_DOC_COMMENT)
(equal token-type 'T_COMMENT))
(setq-local
@@ -194,17 +195,23 @@
temp-token-list-index
(1+ temp-token-list-index))
)))))
-
(when
token-list-index
(let ((token
(nth
token-list-index
phps-mode-parser-tokens)))
+
+ ;; Compatibility with parser
(when (equal (car token) 'T_OPEN_TAG_WITH_ECHO)
- (setf
- (car token)
- 'T_ECHO))
+ (setq
+ token
+ `(T_ECHO ,(car (cdr token)) . ,(cdr (cdr token)))))
+ (when (equal (car token) 'T_CLOSE_TAG)
+ (setq
+ token
+ `(";" ,(car (cdr token)) . ,(cdr (cdr token)))))
+
token))))
"The lex-analyzer function.")
diff --git a/test/phps-mode-test-parser.el b/test/phps-mode-test-parser.el
index 301defd..a852a63 100644
--- a/test/phps-mode-test-parser.el
+++ b/test/phps-mode-test-parser.el
@@ -111,7 +111,7 @@
(lambda()
(should
(equal
- '(80 449 456 403 325 324 152 102 79)
+ '(80 449 456 403 325 324 152 102 79 159 102 79)
(phps-mode-parser-parse)))))
(phps-mode-test-parser--buffer-contents
@@ -132,7 +132,7 @@
(phps-mode-test-parser--buffer-contents
"<?php\necho 'blaha'"
- "Basic echo test 5 with invalid code"
+ "Basic echo test 5 with valid code in parser mode only"
(lambda()
(should-error
(phps-mode-parser-parse))))
@@ -155,7 +155,7 @@
(message "\n")
(should
(equal
- '(80 449 456 403 325 324 152 102 79 153 102 79 449 456 403 325 324
152 102 79 153 102 79)
+ '(80 449 456 403 325 324 152 102 79 159 102 79 153 102 79 449 456 403
325 324 152 102 79 159 102 79 153 102 79)
parse)))))
(phps-mode-test-parser--buffer-contents
@@ -278,12 +278,11 @@
(lambda()
(phps-mode-parser-parse)))
- ;; TODO Make this work
- ;; (phps-mode-test-parser--buffer-contents
- ;; "<?php echo 'here' ?>"
- ;; "Expression without trailing semi-colon but with close tag"
- ;; (lambda()
- ;; (phps-mode-parser-parse)))
+ (phps-mode-test-parser--buffer-contents
+ "<?php echo 'here' ?>"
+ "Expression without trailing semi-colon but with close tag"
+ (lambda()
+ (phps-mode-parser-parse)))
;; TODO Make this work
;; (phps-mode-test-parser--buffer-contents
- [elpa] externals/phps-mode 4f7126b 70/96: Fixed automation grammar setting of lex-analyzer functions, (continued)
- [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, 2021/10/29
- [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 <=
- [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
- [elpa] externals/phps-mode 8e263fe 85/96: Removed T_DIE as token as it's replaced by T_EXIT, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 3489f9d 90/96: Parser parse function now ignores creating a SDT, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 620ec6e 91/96: Optimization of parser speed, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode ff25e3d 92/96: Removed obsolete files, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode aa691a8 89/96: Added parser and lexer integraction-fix to automation, Christian Johansson, 2021/10/29