| Summary: | perl syntax highlighting wrong for hash key like $hash{s} | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | Toralf Förster <toralf.foerster> |
| Component: | syntax | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
I can not confirm for kde 4.1.3, as it works perfect here.
I know that my test.pl file contains a lot of tests, like
$hash{element}; # with various amounts of space around the atoms of the statement, and that those all works. There is no example of a single letter unquoted key though.
Could you test if it is broken for keys with more letters, and if so, please attach a file to test against?
It is only broken for the single character {s}, however {sfoo} or sth. else works. That's why I argue that is might be misinterpreted with the s/// operator ?
Yes, that is likely right, as the search for a hash key is running the full code analysis, and there is be a mistake: I can confirm that a key 's' leads to errors as described.
In your perl.xml, look for the lines 365 - 368, they should look like this:
<RegExpr attribute="Operator" context="find_quoted" String="\bq(?=[qwx]?\s*[^\w\s])" />
<RegExpr attribute="Operator" context="find_subst" String="\bs(?=\s*[^\w\s])" />
<RegExpr attribute="Operator" context="tr" String="\b(?:tr|y)\s*(?=[^\w\s\]})])" />
The 2nd line, leading to context find_subst should contain a check for braces in the lookahead test at the end of the pattern, I think it should look like the one below: (?=[^\w\s\]})]). This should mean that the s followed by letters, numbers or closing braces is not matched.
If you care to, could you try this?
Right, that solved this issue :
n22 /usr/kde/3.5/share/apps/katepart/syntax # diff -u perl.xml.orig perl.xml
--- perl.xml.orig 2008-11-20 21:40:23.000000000 +0100
+++ perl.xml 2008-11-20 21:41:41.000000000 +0100
@@ -363,7 +363,7 @@
<RegExpr attribute="Normal Text" context="#stay" String="\w+[=]" />
<RegExpr attribute="Operator" context="find_quoted" String="\bq(?=[qwx]?\s*[^\w\s])" />
- <RegExpr attribute="Operator" context="find_subst" String="\bs(?=\s*[^\w\s])" />
+ <RegExpr attribute="Operator" context="find_subst" String="\bs(?=[^\w\s\]})])" />
<RegExpr attribute="Operator" context="tr" String="\b(?:tr|y)\s*(?=[^\w\s\]})])" />
<RegExpr attribute="Operator" context="find_pattern" String="\b(?:m|qr)(?=\s*[^\w\s\]})])" />
SVN commit 896727 by alund: Do not start a substitution pattern on closing braces. BUG: 175571 M +2 -2 perl.xml WebSVN link: http://websvn.kde.org/?view=rev&revision=896727 |
Version: 2.5.10 (using 3.5.10, Gentoo) Compiler: Target: i686-pc-linux-gnu OS: Linux (i686) release 2.6.26.8 For the following perl snippet: #!/usr/bin/perl # print $h{s}; print $h{f}; exit (0); the line "print $h{s};" change the syntax highlighting for all subsequent lines into sth. which looks wrong. Quoting {'s'} however is a workaround.