GNOME Bugzilla – Bug 594501
perl: no highlight for filetest breaks it
Last modified: 2013-03-29 18:33:10 UTC
I'm not good at perd, but a friend of mine told me that this expression is correct but doesn't displays properly : if (-s "text.txt") { print "blabla"; } Good luck!
What you do not like to display this expression?
The trouble is that "-s" interpretation is wrong. In this expression, "(-s "text.txt")" is the test of "if". What follow in a block which should be interpreted as a different block. gedit currently color all the text in pink starting from the "s" of "-s". Gedit does not interpret "-s" as it should be so the color of what follow is wrong. You may look to the interpretation of vim as a example of the good intrepretation.
*** Bug 616749 has been marked as a duplicate of this bug. ***
Hi I can confirm this bug is still present on the trunk version.
Created attachment 187792 [details] [review] bugfix On the duplicated bug #616749 it was suggested (in a very bad english but I think that's what it was said) that the attached patch would fix. It does fix this but I didn't test it extensively and not sure if it will break something else.
Guys the problem is that there is no support of highlighting filetest (see perldoc -f -X) operators at whole. Solution is adding the corresponding pattern into <... id="operator" ...> section. 95a96 > \-[rwxoRWXOezsfdlpSbctugkTBMAC] | Note it's important to add this line before the definition of "-" operator.
Created attachment 222642 [details] [review] Filetest operators highlighting
I can confirm that the bug exists and that Artem S Vybornov's fix works. I use perl on a semi-regular basis and this bug was driving me crazy...
I may have spoken too soon. With the current code: 95a96 > \-[rwxoRWXOezsfdlpSbctugkTBMAC] | things like -exp($foo) are highlighted wrong. A simple fix for this is: 95a96 > \-[rwxoRWXOezsfdlpSbctugkTBMAC]\s |
pbor(irc) and i had a discussion that the space is not part of the syntax so should not be included in highlighting and the \b operator let things like "-e." through so we used a look ahead to check for a space(the space is not included in the syntax highlighting, only the operator) 95a96 > \-[rwxoRWXOezsfdlpSbctugkTBMAC](?=\s) | Patch to come.
*** Bug 655536 has been marked as a duplicate of this bug. ***
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report. Hi signed the commit 67037f1198b9f23fa0f4c045a96464c633fcaf97 with Alex Mayer <magictrick4906@aim.com>