From 8207084111fac4d60ada6dc2aae5e73afecd2baa Mon Sep 17 00:00:00 2001 From: Don HO Date: Wed, 4 Nov 2020 23:49:14 +0100 Subject: [PATCH] Fix several bugs of PHP parser rule for function list 1. Fix the function name gets truncated issue if function starts with reserved words (ie. if, while, for, switch...). 2. Fix abstact function and classes not recognized by parser rule. 3. Fix function detection fails on string containing asterisk issue. Contributed by @MAPJe71 & @TutoInformatik : https://community.notepad-plus-plus.org/topic/15124/php-function-list-and-abstract-functions/18?_=1604532045222 Fix #3321, fix #5045, fix #4627, fix #4606, fix #8855, fix #4208, fix #981, fix #2522, fix #1103, fix #4712, fix #3560, fix #5150, fix #4606, close #9102 --- PowerEditor/Test/FunctionList/php/unitTest | 27 +++ .../FunctionList/php/unitTest.expected.result | 2 +- PowerEditor/installer/functionList/php.xml | 179 ++++++++++++++++-- 3 files changed, 192 insertions(+), 16 deletions(-) diff --git a/PowerEditor/Test/FunctionList/php/unitTest b/PowerEditor/Test/FunctionList/php/unitTest index 6fe49bbc..32a4c600 100644 --- a/PowerEditor/Test/FunctionList/php/unitTest +++ b/PowerEditor/Test/FunctionList/php/unitTest @@ -14,6 +14,32 @@ ************************************************************************ */ require_once "../PagSeguroLibrary/PagSeguroLibrary.php"; + +function for123(){ + alert 'nothing'; +} + +abstract class PageGrille extends PageMotsBleus{ + abstract function GetTypeGrille() ; // blabla blabla + abstract function GetGrilleJSON($p_grilleId); // Retourn JSON + + function CleanStr($pStr){ + return str_replace ( "\\" , "" , $pStr); + } + + function GetJavascriptMajax() { + return "ABC"; + } +} + +function stringContainAsterisk_test1(){ + $target = '/path/to/files/*'; +} + +function stringContainAsterisk_test2(){ + $target = '/path/to/files/*.jpg'; +} + class NotificationListener { public static function main() @@ -86,4 +112,5 @@ class NotificationListener echo LogPagSeguro::getHtml($count); } } + NotificationListener::main(); \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/php/unitTest.expected.result b/PowerEditor/Test/FunctionList/php/unitTest.expected.result index 76a5e174..e062fcd3 100644 --- a/PowerEditor/Test/FunctionList/php/unitTest.expected.result +++ b/PowerEditor/Test/FunctionList/php/unitTest.expected.result @@ -1 +1 @@ -{"nodes":[{"leaves":["main","transactionNotification","authorizationNotification","preApprovalNotification","printLog"],"name":"NotificationListener"}],"root":"unitTest"} \ No newline at end of file +{"leaves":["for123()","stringContainAsterisk_test1()","stringContainAsterisk_test2()"],"nodes":[{"leaves":["GetTypeGrille","GetGrilleJSON","CleanStr","GetJavascriptMajax"],"name":"PageGrille"},{"leaves":["main","transactionNotification","authorizationNotification","preApprovalNotification","printLog"],"name":"NotificationListener"}],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/installer/functionList/php.xml b/PowerEditor/installer/functionList/php.xml index 693df268..76879366 100644 --- a/PowerEditor/installer/functionList/php.xml +++ b/PowerEditor/installer/functionList/php.xml @@ -12,40 +12,189 @@ - - - + - + - + - - + + + - - -