Closed choroba closed 4 years ago
Sigh, that magic slash.
I just know I once debugged a similar problem with variables named $y and slashes in a non-regex context but to cperl looking like y/// (the alternative syntax for tr///) -- and lost the battle.
Patches welcome. :-)
I was able to identify the place that changes the behaviour, but I can't find a way to fix it. For example, the following fixes division, but breaks matching:
modified cperl-mode.el
@@ -4126,8 +4126,8 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
(or (memq (preceding-char)
(append (if (memq c '(?\? ?\<))
;; $a++ ? 1 : 2
- "~{(=|&*!,;:["
- "~{(=|&+-*!,;:[") nil))
+ "~{(=|&+-*!,;:["
+ "~{(=|&*!,;:[") nil))
(and (eq (preceding-char) ?\})
(cperl-after-block-p (point-min)))
(and (eq (char-syntax (preceding-char)) ?w)
Fixed by #55
/
is highlighted as a start of a regex instead of division after++
or--
. The rest of the code is highlighted wrongly.