You are here: PSPad forum > English discussion forum > Re: perl brackets match

Re: perl brackets match

#1 perl brackets match

Posted by: massimobalestra | Date: 12/09/2015 02:08 | IP: IP Logged

Hi,
sometimes the matching bracket (ctrl+M) does not work as expected in perl syntax highlighting, when the bracket is inside a regular expression and it is escaped.

This is the example

if ($condition) {
if ($userData =~ /^\{/) {
$some_code_here;
}
}

(Basically I want to check if in the variable $userData there is a json data structure so I check if it starts with { ; I could do in other ways but this example shows this little bug in psPad ).
The curly bracket inside the regular expression is escaped but psPad matches it with the last one inthe 5th row.
The opened curly bracket after if ($condition) does not find any match (it is shown in red).
Probably it does something similar also with other brackets but I don't have an example ready right now.

Is there anything you can do?

Thanks
Massimo

Options: Reply | Quote | Up ^


#2 Re: perl brackets match

Posted by: massimobalestra | Date: 12/13/2015 15:06 | IP: IP Logged

Jan,
Did you have any time to take a look at this problem?

Thanks

Options: Reply | Quote | Up ^


#3 Re: perl brackets match

Posted by: massimobalestra | Date: 12/02/2016 19:20 | IP: IP Logged

Do you have time to look also at this bug?
Thanks

Options: Reply | Quote | Up ^


#4 Re: perl brackets match

Posted by: arogl | Date: 07/29/2017 12:07 | IP: IP Logged

The bracket match also does not work for this MSDOS Batch code snippet

if /I "%1" EQU "all" (
for %%c in ( ___ ) do (
cd /d %%c
for %%b in ( _____ ) do (
for /R %%a in ( "*.%%b" ) do (
copy "%%a" "%%~pna.mp4" && del "%%a"
)
)
)
)

I have tried this with the 4.6.2(2750) release and 5.0.0(235) beta.

Edited 1 time(s). Last edit at 07/29/2017 12:14 by pspad.

Options: Reply | Quote | Up ^


#5 Re: perl brackets match

Posted by: pspad | Date: 07/29/2017 12:14 | IP: IP Logged

Thank you for report

Options: Reply | Quote | Up ^


#6 Re: perl brackets match

Posted by: pspad | Date: 08/10/2017 10:38 | IP: IP Logged

Problem with Batch highlight was fixed

Options: Reply | Quote | Up ^


#7 Re: perl brackets match

Posted by: arogl | Date: 08/12/2017 01:51 | IP: IP Logged

Tested in 5.0.0 (241) and worked.

Thanks for your hard work on pspad.

Options: Reply | Quote | Up ^


#8 Re: perl brackets match

Posted by: massimobalestra | Date: 10/30/2017 15:54 | IP: IP Logged

I just tested in PsPad 5.0.0 (251) and the problem is still there.
Note: the syntax highlight I am using is perl

Options: Reply | Quote | Up ^


#9 Re: perl brackets match

Posted by: massimobalestra | Date: 11/06/2017 19:02 | IP: IP Logged

I have another example of braces matching malfunctioning.
It is always in perl:

if ($needSpecialCharacters) {
print
"You Need special characters.\n" .
"Special Characters are:\n" .
q {` ~ ! @ # $ % ^ & * ( ) _ - + = \ | [ ] { } ' " ; : / ? . < > , } .
"Please enter at least one of them\n\n";
}

The Curly braces at the end of the if, in psPad, matches with the one after the q.
the q{} in perl means quote so everything inside is be considered a text as it is without interpretation.

It is still not working.
I have PsPad 5.0.0 (251)

Thanks

Options: Reply | Quote | Up ^


#10 Re: perl brackets match

Posted by: pspad | Date: 11/06/2017 19:50 | IP: IP Logged

Thank you for the example

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2017 Jan Fiala
Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák