[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 0919855a31 073/212: Added SDT for concat oper
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 0919855a31 073/212: Added SDT for concat operation |
Date: |
Wed, 26 Jan 2022 01:50:53 -0500 (EST) |
branch: externals/phps-mode
commit 0919855a3117c7a384a564ff38f2e1ba66cb7682
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Added SDT for concat operation
---
phps-mode-ast-bookkeeping.el | 11 ++++++-----
phps-mode-parser-sdt.el | 15 ++++++++++++++-
test/phps-mode-test-ast.el | 26 +++++++++++++-------------
3 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index 4bdbf8fa9b..a5b2d6953e 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -601,14 +601,15 @@
defined
bookkeeping)))
- ;; Infix operations
+ ;; Infix expressions
((or
(equal type 'addition-expression)
(equal type 'boolean-and-expression)
(equal type 'boolean-or-expression)
(equal type 'logical-and-expression)
(equal type 'logical-or-expression)
- (equal type 'logical-xor-expression))
+ (equal type 'logical-xor-expression)
+ (equal type 'concat-expression))
(when-let ((bs (reverse (plist-get item 'b))))
(dolist (b bs)
(push `(,scope ,b) bookkeeping-stack)))
@@ -888,9 +889,9 @@
(let ((sub-scope scope))
(setq arrow-function-count (1+ arrow-function-count))
(push `(type arrow-function name ,arrow-function-count)
sub-scope)
- (when-let ((inner-statement-list (reverse (plist-get item
'inner-statement-list))))
- (dolist (inner-statement inner-statement-list)
- (push `(,sub-scope ,inner-statement) bookkeeping-stack)))
+ (when-let ((expr (reverse (plist-get item 'expr))))
+ (dolist (e expr)
+ (push `(,sub-scope ,e) bookkeeping-stack)))
(when-let ((parameter-list (plist-get item 'parameter-list)))
(dolist (parameter parameter-list)
(let ((ids
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 60dab6ff4c..1ecb0b778c 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -835,6 +835,19 @@
,(phps-mode-parser-sdt--get-list-of-object (nth 2 args))))
phps-mode-parser--table-translations)
+;; expr -> (expr "." expr)
+(puthash
+ 365
+ (lambda(args _terminals)
+ `(
+ ast-type
+ concat-expression
+ a
+ (phps-mode-parser-sdt--get-list-of-object ,(nth 0 args))
+ b
+ ,(phps-mode-parser-sdt--get-list-of-object (nth 2 args))))
+ phps-mode-parser--table-translations)
+
;; expr -> (expr "+" expr)
(puthash
366
@@ -929,7 +942,7 @@
(nth 8 args)
'backup-lex-pos
(nth 9 args)
- 'inner-statement-list
+ 'expr
(phps-mode-parser-sdt--get-list-of-object (nth 10 args))
'backup-fn-flags-2
(nth 11 args))))
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index ebf832e029..e5b07e2737 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -37,17 +37,17 @@
buffer-contents
name
(lambda()
- ;; (let ((parse (phps-mode-parser-parse)))
- ;; (message "Left-to-right with right-most derivation:\n%S\n" parse)
- ;; (dolist (production-number (reverse parse))
- ;; (let ((production
- ;; (phps-mode-parser--get-grammar-production-by-number
- ;; production-number)))
- ;; (message
- ;; "%d: %S -> %S"
- ;; production-number
- ;; (car (car production))
- ;; (car (cdr production))))))
+ (let ((parse (phps-mode-parser-parse)))
+ (message "Left-to-right with right-most derivation:\n%S\n" parse)
+ (dolist (production-number (reverse parse))
+ (let ((production
+ (phps-mode-parser--get-grammar-production-by-number
+ production-number)))
+ (message
+ "%d: %S -> %S"
+ production-number
+ (car (car production))
+ (car (cdr production))))))
(phps-mode-ast--generate)
(phps-mode-ast-bookkeeping--generate)
(should
@@ -404,11 +404,11 @@
"Bookkeeping of $this not available inside static method"
'(((68 73) 0) (" class MyClass function there id $this" 1) ((153 158) 1)))
- ;; TODO Make this test work and pass
+ ;; TODO Make this test pass
(phps-mode-test-ast--should-bookkeep
"<?php\n\nclass myClass\n{\n private $test = 'abc';\n public function
test($d)\n {\n return fn($e) => $this->test . $d . $e;\n
}\n}\n\n$a = new myClass();\necho $a->test('def')('ghi');"
"Bookkeeping of $this reference inside arrow function inside of method"
- '(0 1 2))
+ '((" class myClass id $test" 1) ((36 41) 1) (" class myClass function test
id $this" 1) (" class myClass function test id $d" 1) ((76 78) 1) (" class
myClass function test arrow function 1 id $e" 1) ((104 106) 1) ((111 116) 1)
((118 122) 1) ((125 127) 1) ((130 132) 1) (" id $a" 1) ((143 145) 1)))
(message "\n-- Ran tests for bookkeeping generation. --"))
- [elpa] externals/phps-mode 3de8eff9f1 114/212: More wrestling with indentation, (continued)
- [elpa] externals/phps-mode 3de8eff9f1 114/212: More wrestling with indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d3b5a85b70 001/212: Using property list as basis for AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a80c12ef14 005/212: Passing imenu-generation for file with multiple namespaces, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0071b40aae 007/212: Syntax coloring is now in separate file, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1cc4aed616 016/212: Passing first bookkeeping test via generation via parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode b3b27951bd 015/212: More work on bookkeeping, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 395a4ed045 036/212: Started on bookkeeping via parser SDT for properties, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 69341c9709 039/212: More working on bookkeeping of class properties via parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode cefab36fa8 054/212: More work on bookkeeping arrow function variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d9cbe630b3 068/212: Passing bookkeeping of variables inside echo statements, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0919855a31 073/212: Added SDT for concat operation,
Christian Johansson <=
- [elpa] externals/phps-mode 5df554fc47 070/212: Bookkeeping via AST properly handles $this reference in only non-static methods, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 2432928a86 096/212: Indentation passing more tests for alternative control structures, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode cef879268b 103/212: Added two new tests for failing indentation for multi-line concatenated strings, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 40ce934c11 116/212: Indent support for string-doc in assignment, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode fbe600500f 135/212: More work on array and argument element indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 6cb18913e4 152/212: Improved indentation for lines ending with closing bracket and comma, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 26d7b64086 144/212: Added TODO item for indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0e7eb04800 149/212: Passing indentation test for multiple function arguments with default values, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 2e16122284 153/212: Improved indentation on line after closing bracket and comma, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1825ee499b 151/212: More wrestling with indentation, Christian Johansson, 2022/01/26