diff options
| author | Stefan Monnier | 2008-06-03 07:18:54 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-06-03 07:18:54 +0000 |
| commit | a9bc137f5ec9d474b035afdbd0de9b0a5fe73c5e (patch) | |
| tree | 9a716369303cb823a5a785428fee3d351fbec2f1 | |
| parent | acc12ef73e3f7605960b5ba190bf965d4e61eea2 (diff) | |
| download | emacs-a9bc137f5ec9d474b035afdbd0de9b0a5fe73c5e.tar.gz emacs-a9bc137f5ec9d474b035afdbd0de9b0a5fe73c5e.zip | |
(perl-font-lock-syntactic-keywords): Try to be
yet a bit more clever at distinguishing / from /.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/perl-mode.el | 23 |
2 files changed, 24 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index de57acf56b6..a58fc460289 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-06-03 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * progmodes/perl-mode.el (perl-font-lock-syntactic-keywords): Try to be | ||
| 4 | yet a bit more clever at distinguishing / from /. | ||
| 5 | |||
| 1 | 2008-06-03 Kenichi Handa <handa@m17n.org> | 6 | 2008-06-03 Kenichi Handa <handa@m17n.org> |
| 2 | 7 | ||
| 3 | * Makefile.in (ELCFILES): Add $(lisp)/language/hanja-util.elc. | 8 | * Makefile.in (ELCFILES): Add $(lisp)/language/hanja-util.elc. |
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index 22d9b488cc6..c92ac4252da 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el | |||
| @@ -252,7 +252,7 @@ The expansion is entirely correct because it uses the C preprocessor." | |||
| 252 | ;; <file*glob> | 252 | ;; <file*glob> |
| 253 | (defvar perl-font-lock-syntactic-keywords | 253 | (defvar perl-font-lock-syntactic-keywords |
| 254 | ;; TODO: here-documents ("<<\\(\\sw\\|['\"]\\)") | 254 | ;; TODO: here-documents ("<<\\(\\sw\\|['\"]\\)") |
| 255 | '(;; Turn POD into b-style comments | 255 | `(;; Turn POD into b-style comments |
| 256 | ("^\\(=\\)\\sw" (1 "< b")) | 256 | ("^\\(=\\)\\sw" (1 "< b")) |
| 257 | ("^=cut[ \t]*\\(\n\\)" (1 "> b")) | 257 | ("^=cut[ \t]*\\(\n\\)" (1 "> b")) |
| 258 | ;; Catch ${ so that ${var} doesn't screw up indentation. | 258 | ;; Catch ${ so that ${var} doesn't screw up indentation. |
| @@ -267,12 +267,27 @@ The expansion is entirely correct because it uses the C preprocessor." | |||
| 267 | ;; Be careful not to match "sub { (...) ... }". | 267 | ;; Be careful not to match "sub { (...) ... }". |
| 268 | ("\\<sub\\(?:[[:space:]]+[^{}[:punct:][:space:]]+\\)?[[:space:]]*(\\([^)]+\\))" | 268 | ("\\<sub\\(?:[[:space:]]+[^{}[:punct:][:space:]]+\\)?[[:space:]]*(\\([^)]+\\))" |
| 269 | 1 '(1)) | 269 | 1 '(1)) |
| 270 | ;; Regexp and funny quotes. | 270 | ;; Regexp and funny quotes. Distinguishing a / that starts a regexp |
| 271 | ("\\(?:[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)" | 271 | ;; match from the division operator is ...interesting. |
| 272 | ;; Basically, / is a regexp match if it's preceded by an infix operator | ||
| 273 | ;; (or some similar separator), or by one of the special keywords | ||
| 274 | ;; corresponding to builtin functions that can take their first arg | ||
| 275 | ;; without parentheses. Of course, that presume we're looking at the | ||
| 276 | ;; *opening* slash. We can mis-match the closing ones, because they are | ||
| 277 | ;; treated separately later in | ||
| 278 | ;; perl-font-lock-special-syntactic-constructs. | ||
| 279 | (,(concat "\\(?:\\(?:\\(?:^\\|[^$@&%[:word:]]\\)" | ||
| 280 | (regexp-opt '("split" "if" "unless" "until" "while" "split" | ||
| 281 | "grep" "map" "not" "or" "and")) | ||
| 282 | "\\)\\|[?:.,;=!~({[]\\|\\(^\\)\\)[ \t\n]*\\(/\\)") | ||
| 272 | (2 (if (and (match-end 1) | 283 | (2 (if (and (match-end 1) |
| 273 | (save-excursion | 284 | (save-excursion |
| 274 | (goto-char (match-end 1)) | 285 | (goto-char (match-end 1)) |
| 275 | (skip-chars-backward " \t\n") | 286 | ;; Not 100% correct since we haven't finished setting up |
| 287 | ;; the syntax-table before point, but better than nothing. | ||
| 288 | (forward-comment (- (point-max))) | ||
| 289 | (put-text-property (point) (match-end 2) | ||
| 290 | 'jit-lock-multiline t) | ||
| 276 | (not (memq (char-before) | 291 | (not (memq (char-before) |
| 277 | '(?? ?: ?. ?, ?\; ?= ?! ?~ ?\( ?\[))))) | 292 | '(?? ?: ?. ?, ?\; ?= ?! ?~ ?\( ?\[))))) |
| 278 | nil ;; A division sign instead of a regexp-match. | 293 | nil ;; A division sign instead of a regexp-match. |