[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode e3bf9e8fed 059/212: SDT rules for some more i
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode e3bf9e8fed 059/212: SDT rules for some more infix operations |
Date: |
Wed, 26 Jan 2022 01:50:43 -0500 (EST) |
branch: externals/phps-mode
commit e3bf9e8fed5c573c09833d8c9bf641a519b46d23
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
SDT rules for some more infix operations
---
phps-mode-ast-bookkeeping.el | 18 +++++++++-
phps-mode-parser-sdt.el | 85 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 102 insertions(+), 1 deletion(-)
diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index 14042c6a54..ab798591aa 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -446,7 +446,14 @@
defined
bookkeeping)))
- ((equal type 'addition-expression)
+ ;; Infix operations
+ ((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))
(when-let ((bs (reverse (plist-get item 'b))))
(dolist (b bs)
(push `(,scope ,b) bookkeeping-stack)))
@@ -560,6 +567,15 @@
((equal type 'increment-variable)
(push `(,scope ,(plist-get item 'variable)) bookkeeping-stack))
+ ((equal type 'negated-expression)
+ (let ((expression (plist-get item 'expression)))
+ ;; TODO Define sub-scope here
+ (when (equal (plist-get expression 'ast-type) 'empty-expression)
+ (let ((not-empty-variables (reverse (plist-get expression
'variables))))
+ ;; TODO Define variable here
+ ))
+ (push `(,scope ,expression) bookkeeping-stack)))
+
((equal type 'try)
(when-let ((children (reverse (plist-get item
'inner-statement-list))))
(dolist (child children)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 0ab528de7d..c1f022d112 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -684,6 +684,71 @@
ast-object))
phps-mode-parser--table-translations)
+;; expr -> (expr T_BOOLEAN_OR expr)
+(puthash
+ 357
+ (lambda(args _terminals)
+ `(
+ ast-type
+ boolean-or-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 T_BOOLEAN_AND expr)
+(puthash
+ 358
+ (lambda(args _terminals)
+ `(
+ ast-type
+ boolean-and-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 T_LOGICAL_OR expr)
+(puthash
+ 359
+ (lambda(args _terminals)
+ `(
+ ast-type
+ logical-or-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 T_LOGICAL_AND expr)
+(puthash
+ 360
+ (lambda(args _terminals)
+ `(
+ ast-type
+ logical-and-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 T_LOGICAL_XOR expr)
+(puthash
+ 361
+ (lambda(args _terminals)
+ `(
+ ast-type
+ logical-xor-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
@@ -699,6 +764,19 @@
ast-object))
phps-mode-parser--table-translations)
+;; expr -> ("!" expr)
+(puthash
+ 376
+ (lambda(args _terminals)
+ (let ((ast-object
+ (list
+ 'ast-type
+ 'negated-expression
+ 'expression
+ (nth 1 args))))
+ ast-object))
+ phps-mode-parser--table-translations)
+
;; expr -> (T_STATIC inline_function)
(puthash
413
@@ -836,6 +914,13 @@
(string-to-number args))
phps-mode-parser--table-translations)
+;; scalar -> (T_T_DNUMBER)
+(puthash
+ 452
+ (lambda(args _terminals)
+ (string-to-number args))
+ phps-mode-parser--table-translations)
+
;; callable_variable -> (array_object_dereferencable "[" optional_expr "]")
(puthash
483
- [elpa] externals/phps-mode cc3bf03786 123/212: Improved indentation after ending assignment expression, (continued)
- [elpa] externals/phps-mode cc3bf03786 123/212: Improved indentation after ending assignment expression, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 3162dca5c4 159/212: Added two more failing indentation tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1e44021653 163/212: Added more failing indent tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e7aff3f69d 157/212: Passed more indentation tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode db7121941c 156/212: Passing indention on line after not equals condition, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d072fe5315 136/212: Improved indentation around array elements, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f880ba2d62 164/212: Improved indentation on lines after assignment that ends with closing bracket, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode db019887af 170/212: Passed new indentation tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 781356557c 194/212: More adjustments to indent helper to find previous command, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0735959c08 209/212: Using silent cache write, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e3bf9e8fed 059/212: SDT rules for some more infix operations,
Christian Johansson <=
- [elpa] externals/phps-mode 2bc31a0f83 065/212: Added TODO items, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d802a669c0 061/212: Bookkeeping via AST working with isset() and !empty() scoped variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d9115ec583 069/212: Cleaned up AST bookkeeping tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f4d2164f8b 067/212: Bookkeeping via parser SDT passing static variables in function, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e66abd00e5 064/212: Bookkeeping via AST passing nested isset() !empty() expressions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 8b5ce22d87 072/212: Fixed issue with SDT for return statement, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 491c82a2a1 071/212: Added TODO item for bookkeeping via AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5ec32f5f5a 076/212: Bookkeeping via AST passing all tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 228f212127 080/212: Starting on removing the old process tokens in string function, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5b1f5b4774 079/212: Improved format of SDT, Christian Johansson, 2022/01/26