[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 6944154fd3 125/135: Imenu via SDT passing som
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 6944154fd3 125/135: Imenu via SDT passing some more tests |
Date: |
Sun, 29 Jan 2023 03:11:11 -0500 (EST) |
branch: externals/phps-mode
commit 6944154fd3ffb5da503bf6a0a427d9dbda4d3ed5
Author: christian <christian@cvj.se>
Commit: christian <christian@cvj.se>
Imenu via SDT passing some more tests
---
phps-mode-ast.el | 6 +++---
test/phps-mode-test-ast.el | 42 +++++++++++++++++++++---------------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index fb60a01009..8ade386522 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -116,7 +116,7 @@
(< (cdr a) (cdr (car (car (cdr b))))))
(t
(< (cdr a) (cdr b)))))))
- (push `(declaration . ,v3-index) v3-list)
+ (push `("declaration" . ,v3-index) v3-list)
(push `(,k3 ,v3-list) v2-list))
(if (symbolp k3)
(setq v2-index v3))
@@ -140,7 +140,7 @@
(< (cdr a) (cdr (car (car (cdr b))))))
(t
(< (cdr a) (cdr b)))))))
- (push `(declaration . ,v2-index) v2-list)
+ (push `("declaration" . ,v2-index) v2-list)
(push `(,k2 ,v2-list) v-list))
(if (symbolp k2)
(setq v-index v2)
@@ -164,7 +164,7 @@
(< (cdr a) (cdr (car (car (cdr b))))))
(t
(< (cdr a) (cdr b)))))))
- (push `(declaration . ,v-index) v-list)
+ (push `("declaration" . ,v-index) v-list)
(push `(,k ,v-list) imenu-index))
(push `(,k . ,v) imenu-index)))
phps-mode-parser-sdt-symbol-imenu--table)
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 45c23bf027..c1fbc64588 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -151,7 +151,7 @@
"<?php\n\n$var2 = 4;\n\nfunction myFunction($var)\n{\n $var3 = 3;\n
if ($var) {\n echo 'Hit';\n }\n if ($var2) {\n echo
'Miss';\n }\n if ($var3) {\n echo 'Hit';\n }\n}\n\nfunction
myFunction2($abc)\n{\n if ($var) {\n echo 'Miss';\n }\n if
($abc) {\n echo 'Hit';\n }\n}\n\nif ($var) {\n echo 'Miss';\n}\nif
($var2) {\n echo 'Hit';\n}"
"Bookkeeping in function level with variable assignments"
'(((8 13) 1) ((40 44) 3) ((52 57) 2) ((71 75) 3) ((113 118) 0) ((157 162)
2) ((216 220) 4) ((232 236) 0) ((275 279) 4) ((316 320) 0) ((347 352) 1))
- '(("$var2" . 8) ("function myFunction" ((declaration . 29) ("$var" . 40)
("$var3" . 52))) ("function myFunction2" ((declaration . 204) ("$abc" . 216)))))
+ '(("$var2" . 8) ("function myFunction" (("declaration" . 29) ("$var" . 40)
("$var3" . 52))) ("function myFunction2" (("declaration" . 204) ("$abc" .
216)))))
(phps-mode-test-ast--should-bookkeep
"<?php\n\n// Super-globals\n\nif ($_GET) {\n echo 'Hit';\n}\nif ($_POST)
{\n echo 'Hit';\n}\nif ($_COOKIE) {\n echo 'Hit';\n}\nif ($_SESSION) {\n
echo 'Hit';\n}\nif ($_REQUEST) {\n echo 'Hit';\n}\nif ($GLOBALS) {\n
echo 'Hit';\n}\nif ($_SERVER) {\n echo 'Hit';\n}\nif ($_FILES) {\n echo
'Hit';\n}\nif ($_ENV) {\n echo 'Hit';\n}\nif ($argc) {\n echo
'Hit';\n}\nif ($argv) {\n echo 'Hit';\n}\nif ($http_​response_​header) {\n
echo 'Hit';\n}"
@@ -162,7 +162,7 @@
"<?php\n\nnamespace myNamespaceA {\n $var = 123;\n class myClassA {\n
private $var2 = 123;\n public static function myFunctionA($var3)
{\n $var4 = 123;\n if ($var) {\n echo
'Miss';\n }\n if ($var2) {\n echo
'Miss';\n }\n if ($var3) {\n echo 'Hit';\n
}\n if ($var4) {\n echo 'Hit';\n
}\n }\n\n fun [...]
"Bookkeeping in maximum level with namespaces, classes and functions."
'(((37 41) 1) ((86 91) 2) ((142 147) 4) ((163 168) 3) ((192 196) 0) ((259
264) 0) ((327 332) 4) ((394 399) 3) ((485 490) 7) ((514 519) 5) ((543 547) 0)
((610 615) 0) ((678 683) 0) ((746 751) 0) ((814 819) 7) ((881 886) 5) ((957
961) 1) ((999 1004) 0) ((1043 1048) 0) ((1087 1092) 0) ((1131 1136) 0) ((1175
1180) 0) ((1243 1248) 8) ((1293 1298) 9) ((1335 1341) 12) ((1357 1362) 10)
((1386 1390) 0) ((1453 1458) 0) ((1521 1526) 0) ((1589 1594) 0) ((1657 1662) 0)
((1725 1730) 0) ((1793 1798) [...]
- '(("namespace myNamespaceA" ((declaration . 18) ("$var" . 37) ("class
myClassA" ((declaration . 59) (declaration . 59) ("$var2" . 86) ("function
myFunctionA" ((declaration . 149) ("$var3" . 142) ("$var4" . 163))) ("function
myFunctionB" ((declaration . 500) ("$var5" . 485) ("$this" . 500) ("$var6" .
514))))))) ("namespace myNamespaceB" ((declaration . 1224) ("$var7" . 1243)
("class myClassB" ((declaration . 1266) (declaration . 1266) ("$var8" . 1293)
("function myFunctionA" ((declarat [...]
+ '(("namespace myNamespaceA" (("declaration" . 18) ("$var" . 37) ("class
myClassA" (("declaration" . 59) (declaration . 59) ("$var2" . 86) ("function
myFunctionA" (("declaration" . 149) ("$var3" . 142) ("$var4" . 163)))
("function myFunctionB" (("declaration" . 500) ("$var5" . 485) ("$this" . 500)
("$var6" . 514))))))) ("namespace myNamespaceB" (("declaration" . 1224)
("$var7" . 1243) ("class myClassB" (("declaration" . 1266) (declaration . 1266)
("$var8" . 1293) ("function myFunctionA [...]
(phps-mode-test-ast--should-bookkeep
"<?php\n\n// Conditional assignments\n\n$items = array(1, 2, 3);\nforeach
($items as $item) {\n if ($item) {\n echo 'Hit';\n }\n}\nforeach
($items as $key => $value) {\n if ($key || $value) {\n echo 'Hit';\n
}\n}\nfor ($i = 0; $i < count($items); $i++) {\n if ($i) {\n echo
'Hit';\n }\n}\nif ($a = 123) {\n if ($a) {\n echo 'Hit';\n
}\n}\nwhile ($b = 123) {\n if ($a) {\n echo 'Hit';\n }\n}\ndo {\n
echo 'Hit';\n} while ( [...]
@@ -174,49 +174,49 @@
"<?php\n\n// Class properties\n\nclass myParent {}\n\nclass myClass extends
myParent {\n private $var1 = 123;\n protected static $var2;\n public
$var3;\n var $var4;\n function __construct() {\n if ($this) {\n
echo 'Hit';\n }\n if ($this->var1) {\n echo
'Hit';\n }\n if (self::$var1) {\n echo 'Miss';\n
}\n if (self::$var2) {\n echo 'Hit';\n }\n if
(static::$var2) {\n [...]
"Bookkeeping of class properties"
'(((93 98) 1) ((127 132) 2) ((145 150) 3) ((160 165) 4) ((208 213) 5) ((263
268) 5) ((270 274) 1) ((330 335) 0) ((392 397) 2) ((455 460) 2) ((510 515) 5)
((517 521) 3) ((571 576) 5) ((578 582) 4) ((632 637) 5) ((639 643) 0) ((751
756) 0))
- '(("class myClass" . 54) ("class myClass function __construct" . 194)
("class myClass function __construct id $this" . 194) ("class myClass id $var4"
. 160) ("class myClass id $var3" . 145) ("class myClass static id $var2" . 127)
("class myClass id $var1" . 93)))
+ '(("class myParent" (("declaration" . 35))) ("class myClass"
(("declaration" . 54) ("$var1" . 93) ("$var2" . 127) ("$var3" . 145) ("$var4" .
160) ("function __construct" (("declaration" . 194) ("$this" . 194)
(declaration . 194)))))))
(phps-mode-test-ast--should-bookkeep
"<?php\n\ntry {\n \n} catch (\\Exception $e) {\n if ($e) {\n
echo 'Hit';\n }\n}\n\nif ($e) {\n echo 'Miss';\n}\n"
"Bookkeeping of try catch variable assignment"
'(((39 41) 1) ((53 55) 1) ((92 94) 1))
- '(("id $e" . 39)))
+ '(("$e" . 39)))
(phps-mode-test-ast--should-bookkeep
"<?php\n\n$example = function ($test) {\n if ($test) {\n echo
'Hit';\n }\n if ($example) {\n echo 'Miss';\n }\n};\n$example2
= function ($test2) use ($example) {\n if ($test2) {\n echo 'Hit';\n
}\n if ($example) {\n echo 'Hit';\n }\n if ($example2) {\n
echo 'Miss';\n }\n if ($example3) {\n echo 'Miss';\n
}\n};\n$example3 = function ($test3) use ($example4) {\n if ($test3) {\n
echo 'Hit';\n }\n [...]
"Bookkeeping of anonymous function variable assignments and lexical vars"
- '(((29 34) 2) ((89 97) 0) ((46 51) 2) ((8 16) 1) ((166 174) 1) ((153 159)
5) ((324 333) 0) ((276 285) 0) ((230 238) 4) ((186 192) 5) ((131 140) 3) ((402
411) 0) ((389 395) 8) ((467 476) 7) ((423 429) 8) ((367 376) 6) ((513 518) 0)
((545 551) 0))
- '(("id $example" . 8) ("anonymous 1 id $test" . 29) ("id $example2" . 131)
("anonymous 2 id $example" . 166) ("anonymous 2 id $test2" . 153) ("id
$example3" . 367) ("anonymous 3 id $example4" . 402) ("anonymous 3 id $test3" .
389)))
+ '(((8 16) 2) ((29 34) 1) ((46 51) 1) ((89 97) 0) ((131 140) 5) ((153 159)
3) ((166 174) 2) ((186 192) 3) ((230 238) 4) ((276 285) 0) ((324 333) 0) ((367
376) 8) ((389 395) 6) ((402 411) 0) ((423 429) 6) ((467 476) 7) ((513 518) 0)
((545 551) 0))
+ '(("$example" . 8) ("$test" . 29) ("$example2" . 131) ("$test2" . 153)
("$example3" . 367) ("$test3" . 389) ("$example4" . 402)))
(phps-mode-test-ast--should-bookkeep
- "<?php\nclass myClass {\n function random() {}\n function
__construct()\n {\n $this->random();\n $this->random['abc'] =
123;\n }\n}"
+ "<?php\nfinal class myClass {\n function random() {}\n function
__construct()\n {\n $this->random();\n $this->random['abc'] =
123;\n }\n}"
"Method calls should be avoided in bookkeeping"
- '(((121 127) 0) ((114 119) 3) ((89 94) 3))
- '(("class myClass" . 13) ("class myClass function __construct" . 79)
("class myClass function __construct id $this" . 79)))
+ '(((95 100) 1) ((120 125) 1) ((127 133) 0))
+ '(("class myClass" (("declaration" . 19) ("function __construct"
(("declaration" . 85) ("$this" . 85) (declaration . 85)))))))
(phps-mode-test-ast--should-bookkeep
"<?php\n$items = array(1, 2, 3);\nforeach ($items as &$item) {\n if
($item) {\n echo 'Hit';\n }\n}\nforeach ($items as $key => &$item2)
{\n if ($item) {\n echo 'Hit';\n }\n}"
"Bookkeeping of foreach reference variable declaration"
- '(((7 13) 1) ((69 74) 2) ((52 57) 2) ((41 47) 1) ((152 157) 2) ((134 140)
3) ((125 129) 4) ((115 121) 1))
- '(("id $items" . 7) ("id $item" . 52) ("id $item2" . 134) ("id $key" .
125)))
+ '(((7 13) 1) ((41 47) 1) ((52 57) 2) ((69 74) 2) ((115 121) 1) ((125 129)
3) ((134 140) 4) ((152 157) 2))
+ '(("$items" . 7) ("$item" . 52) ("$key" . 125) ("$item2" . 134)))
(phps-mode-test-ast--should-bookkeep
"<?php\n\n[$random, $bandom] = myValues();\nif ($random) {\n echo
'Hit';\n}\nif ($bandom) {\n echo 'Hit';\n}\n"
"Bookkeeping of variable declarations in array"
- '(((18 25) 1) ((9 16) 2) ((45 52) 2) ((78 85) 1))
- '(("id $bandom" . 18) ("id $random" . 9)))
+ '(((9 16) 1) ((18 25) 2) ((45 52) 1) ((78 85) 2))
+ '(("$random" . 9) ("$bandom" . 18)))
(phps-mode-test-ast--should-bookkeep
"<?php\n\n$var = 123;\n\nfunction test($abc) {\n global $var, $var2;\n
if ($var) {\n echo 'Hit';\n }\n if ($var2) {\n echo
'Hit';\n }\n}"
"Bookkeeping of global variable declaration in function"
- '(((8 12) 1) ((35 39) 3) ((117 122) 4) ((75 79) 5) ((60 65) 0) ((54 58) 1))
- '(("id $var" . 8) ("function test" . 30) ("function test id $abc" . 35)
("function test id $var2" . 60) ("function test id $var" . 54)))
+ '(((8 12) 1) ((35 39) 4) ((54 58) 1) ((60 65) 0) ((75 79) 2) ((117 122) 3))
+ '(("$var" . 8) ("function test" (("declaration" . 30) ("$abc" . 35) ("$var"
. 54) ("$var2" . 60)))))
(phps-mode-test-ast--should-bookkeep
"<?php\n$y = 1;\n$fn1 = fn($x) => $x + $y;\n$z = 1;\n$fn = fn($x2) =>
fn($y2) => $x2 * $y2 + $z;\nfn(array $x3) => $x3;\n$x4 = 4;\nstatic fn(): int
=> $x4;\nfn($x5 = 42) => $x5;\nfn(&$x6) => $x6;\nfn&($x7) => $x7;\nfn($x8,
...$rest) => $rest;"
"Bookkeeping in arrow functions"
- '(((7 9) 1) ((25 27) 3) ((37 39) 1) ((32 34) 3) ((15 19) 2) ((41 43) 4)
((58 61) 6) ((69 72) 7) ((89 91) 4) ((83 86) 7) ((77 80) 6) ((49 52) 5) ((102
105) 8) ((110 113) 8) ((115 118) 9) ((144 147) 9) ((152 155) 10) ((165 168) 10)
((174 177) 11) ((182 185) 11) ((191 194) 12) ((199 202) 12) ((215 220) 13)
((207 210) 14) ((225 230) 13))
- '(("id $y" . 7) ("id $fn1" . 15) ("arrow 1 id $x" . 25) ("id $z" . 41) ("id
$fn" . 49) ("arrow 3 id $x2" . 58) ("arrow 2 id $y2" . 69) ("arrow 4 id $x3" .
102) ("id $x4" . 115) ("arrow 6 id $x5" . 152) ("arrow 7 id $x6" . 174) ("arrow
8 id $x7" . 191) ("arrow 9 id $rest" . 215) ("arrow 9 id $x8" . 207)))
+ '(((7 9) 1) ((15 19) 3) ((25 27) 2) ((32 34) 2) ((37 39) 1) ((41 43) 4)
((49 52) 7) ((58 61) 6) ((69 72) 5) ((77 80) 6) ((83 86) 5) ((89 91) 4) ((102
105) 8) ((110 113) 8) ((115 118) 9) ((144 147) 9) ((152 155) 10) ((165 168) 10)
((174 177) 11) ((182 185) 11) ((191 194) 12) ((199 202) 12) ((207 210) 13)
((215 220) 14) ((225 230) 14))
+ '(("$y" . 7) ("$fn1" . 15) ("$x" . 25) ("$z" . 41) ("$fn" . 49) ("$x2" .
58) ("$y2" . 69) ("$x3" . 102) ("$x4" . 115) ("$x5" . 152) ("$x6" . 174) ("$x7"
. 191) ("$x8" . 207) ("$rest" . 215)))
;; (phps-mode-test-ast--should-bookkeep
;; "<?php\n$z = (object) array('name' => 'random');\nif ($z->name) {\n
echo 'Hit';\n}"
@@ -227,13 +227,13 @@
"<?php\nif (!$var = false) {\n echo 'Hit';\n}\n"
"Bookkeeping negative conditional assignment"
'(((12 16) 1))
- '(("id $var" . 12)))
+ '(("$var" . 12)))
(phps-mode-test-ast--should-bookkeep
"<?php\n\nif (isset($x)) {\n if ($x) {\n echo 'Hit';\n if
(isset($i, $u)) {\n if ($i) {\n echo 'Hit';\n
}\n if ($u) {\n echo 'Hit';\n }\n
if ($x) {\n echo 'Hit';\n }\n }\n
if ($i) {\n echo 'Miss';\n }\n if ($u) {\n
echo 'Miss';\n }\n }\n}\nif ($x) {\n echo 'Miss';\n}\n\nif
(!empty($y)) {\n if ( [...]
"Bookkeeping of isset() and !empty() scoped variables"
- '(((355 357) 2) ((302 304) 1) ((232 234) 3) ((168 170) 2) ((104 106) 1)
((81 83) 2) ((77 79) 1) ((33 35) 3) ((18 20) 3) ((408 410) 3) ((793 795) 4)
((740 742) 5) ((670 672) 6) ((606 608) 4) ((542 544) 5) ((519 521) 4) ((505
507) 5) ((460 462) 6) ((445 447) 6) ((846 848) 6))
- '(("id $i" . 77) ("id $u" . 81) ("id $x" . 18) ("id $L" . 519) ("id $k" .
505) ("id $y" . 445)))
+ '(((18 20) 1) ((33 35) 1) ((77 79) 3) ((81 83) 2) ((104 106) 3) ((168 170)
2) ((232 234) 1) ((302 304) 3) ((355 357) 2) ((408 410) 1) ((445 447) 4) ((460
462) 4) ((505 507) 5) ((519 521) 6) ((542 544) 5) ((606 608) 6) ((670 672) 4)
((740 742) 5) ((793 795) 6) ((846 848) 4))
+ '(("$x" . 18) ("$i" . 77) ("$u" . 81) ("$y" . 445) ("$k" . 505) ("$L" .
519)))
(phps-mode-test-ast--should-bookkeep
"<?php\ninterface myInterface\n{\n function myFunction1();\n function
myFunction2($x);\n}\n"
@@ -275,7 +275,7 @@
"<?php\n\n$var = 123;\n\nfunction test($abc) {\n static $var;\n if
($var) {\n echo 'Hit';\n }\n}"
"Bookkeeping of static variable declaration in function"
'(((8 12) 1) ((35 39) 3) ((68 72) 4) ((54 58) 4))
- '(("id $var" . 8) ("function test" . 30) ("function test id $abc" . 35)
("function test id $var" . 54)))
+ '(("$var" . 8) ("function test" (("declaration" . 30) ("$abc" . 35) ("$var"
. 54) ("$var2" . 60)))))
(phps-mode-test-ast--should-bookkeep
"<?php\n\nglobal $a, $b;\n\nif ($a) {\n echo 'Hit';\n}\n\nfunction
myFunction($c)\n{\n global $a;\n if ($a) {\n echo 'Hit';\n }\n
if ($b) {\n echo 'Miss';\n }\n}\n"
- [elpa] externals/phps-mode 7bb676dc8b 076/135: Bookkeeping for anonymous function passing, (continued)
- [elpa] externals/phps-mode 7bb676dc8b 076/135: Bookkeeping for anonymous function passing, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode f86d8dc6ac 078/135: More work on arrow function variable uri, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 787aaa2bb4 081/135: Passing another bookkeeping test, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 66c02b9be1 083/135: Passing test for bookkeeping of interface variables, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 1afe6aaec7 086/135: Passing more tests for static variables, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode d456658676 089/135: Passing bookkeeping test for $this inside arrow function, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode f4be94ccfc 094/135: Passing bookkeeping test for class properties inside conditional expression, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 18f1f12fc6 096/135: Added new bookkeeping test for class parameters in constructor method, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 6d3cadbdf0 104/135: More integration of new imenu and bookkeeping via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 171e96b043 123/135: Fixes for some tests, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 6944154fd3 125/135: Imenu via SDT passing some more tests,
Christian Johansson <=
- [elpa] externals/phps-mode d1b1fd0a19 071/135: Started bookkeeping of arrow function variables, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode ae68e19c0a 080/135: Passing bookkeeping arrow function, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode f053587ff6 091/135: Passing another bookkeeping test, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 9c43bc30c4 103/135: Removed old bookkeeping and imenu and integrated new via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode a447ae69ba 106/135: Starting on generating imenu index for namespaces, classes, methods, traits, interfaces via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 16a63da318 113/135: More TODO items for bookkeeping, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 807c834649 116/135: More work on imenu generation, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode a84bfdccd3 120/135: More fighting the AST, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 23ba458f20 133/135: Updated version and date for 0.4.31, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode d5bdadc6fc 135/135: Improved installation documentation, Christian Johansson, 2023/01/29