emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/perl-mode.el,v


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/perl-mode.el,v
Date: Tue, 03 Jun 2008 07:18:55 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        08/06/03 07:18:54

Index: progmodes/perl-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/perl-mode.el,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -b -r1.78 -r1.79
--- progmodes/perl-mode.el      6 May 2008 07:18:35 -0000       1.78
+++ progmodes/perl-mode.el      3 Jun 2008 07:18:54 -0000       1.79
@@ -252,7 +252,7 @@
 ;; <file*glob>
 (defvar perl-font-lock-syntactic-keywords
   ;; TODO: here-documents ("<<\\(\\sw\\|['\"]\\)")
-  '(;; Turn POD into b-style comments
+  `(;; Turn POD into b-style comments
     ("^\\(=\\)\\sw" (1 "< b"))
     ("^=cut[ \t]*\\(\n\\)" (1 "> b"))
     ;; Catch ${ so that ${var} doesn't screw up indentation.
@@ -267,12 +267,27 @@
     ;; Be careful not to match "sub { (...) ... }".
     
("\\<sub\\(?:[[:space:]]+[^{}[:punct:][:space:]]+\\)?[[:space:]]*(\\([^)]+\\))"
      1 '(1))
-    ;; Regexp and funny quotes.
-    ("\\(?:[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)"
+    ;; Regexp and funny quotes.  Distinguishing a / that starts a regexp
+    ;; match from the division operator is ...interesting.
+    ;; Basically, / is a regexp match if it's preceded by an infix operator
+    ;; (or some similar separator), or by one of the special keywords
+    ;; corresponding to builtin functions that can take their first arg
+    ;; without parentheses.  Of course, that presume we're looking at the
+    ;; *opening* slash.  We can mis-match the closing ones, because they are
+    ;; treated separately later in
+    ;; perl-font-lock-special-syntactic-constructs.
+    (,(concat "\\(?:\\(?:\\(?:^\\|[^$@&%[:word:]]\\)"
+              (regexp-opt '("split" "if" "unless" "until" "while" "split"
+                            "grep" "map" "not" "or" "and"))
+              "\\)\\|[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)")
      (2 (if (and (match-end 1)
                  (save-excursion
                    (goto-char (match-end 1))
-                   (skip-chars-backward " \t\n")
+                   ;; Not 100% correct since we haven't finished setting up
+                   ;; the syntax-table before point, but better than nothing.
+                   (forward-comment (- (point-max)))
+                   (put-text-property (point) (match-end 2)
+                                      'jit-lock-multiline t)
                    (not (memq (char-before)
                               '(?? ?: ?. ?, ?\; ?= ?! ?~ ?\( ?\[)))))
             nil ;; A division sign instead of a regexp-match.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]