Changeset 16551 for util

Show
Ignore:
Timestamp:
05/28/07 22:16:04 (18 months ago)
Author:
renormalist
Message:

* cperl-mode: long time bug fixed:

distinguish between blocks and hashes now works.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/cperl-mode.el

    r16549 r16551  
    69146914  ;; Positions is before ?\{.  Checks whether it starts a block. 
    69156915  ;; No save-excursion!  This is more a distinguisher of a block/hash ref... 
    6916   (cperl-backward-to-noncomment (point-min)) 
    6917   (or (memq (preceding-char) (append ";){}$@&%\C-@" nil)) ; Or label!  \C-@ at bobp 
    6918                                         ; Label may be mixed up with `$blah :' 
    6919       (save-excursion (cperl-after-label)) 
    6920       (get-text-property (cperl-1- (point)) 'attrib-group) 
    6921       (and (memq (char-syntax (preceding-char)) '(?w ?_)) 
    6922            (progn 
    6923              (backward-sexp) 
    6924              ;; sub {BLK}, print {BLK} $data, but NOT `bless', `return', `tr' 
    6925              (or (and (looking-at "[a-zA-Z0-9_:]+[ \t\n\f]*[{#]") ; Method call syntax 
    6926                       (not (looking-at "\\(bless\\|return\\|\\(\\(rx\\|[msy]\\|tr\\)\\s *\\(:\\([igcpw]\\|ignorecase\\|global\\|continue\\|pos\\|once\\|words\\|bytes\\|codes\\|graphs\\|langs\\|\\|[0-9]+\\(st\\|nd\\|rd\\|th\\|x\\)\\|ov\\|overlap\\|ex\\|exhaustive\\|rw\\|P5\\|perl5\\|Perl5\\(<[a-zA-Z]+>\\)?\\|nth\\(([0-9]+)\\)?\\|x\\(([0-9]+)\\)?\\)\\s *\\)*\\):?\\)")) ;; perl6 23.06.2006 
    6927                       (not (looking-at "\\$[a-zA-Z0-9_]+"))) ; perl6: todo: why? (topics before blockstart?); even better [$@%]? 
    6928                  ;; sub bless::foo {} 
    6929                  (progn 
    6930                    (cperl-backward-to-noncomment (point-min)) 
    6931                    (and (eq (preceding-char) ?b) 
    6932                         (progn 
    6933                           (forward-sexp -1) 
    6934                           (looking-at "\\(coro\\|sub\\|method\\|submethod\\)[ \t\n\f#]"))))))) ; perl6 
    6935       (if cperl-use-v6 
    6936           (progn ; perl6: "if/elsif/unless/while/until/given/when/for/loop" without parens; just look at beginning of line 
    6937             (beginning-of-line) 
    6938             (looking-at "\\s *}?\\s *\\(\\(els\\(e\\s +\\|\\)\\)?if\\|un\\(less\\|til\\)\\|given\\|wh\\(ile\\|en\\)\\|for\\|loop\\)\\>"))))) 
     6916  (or 
     6917   (and ; perl6: it's never a hash if whitespace before brace 
     6918    (cond (cperl-use-v6)) 
     6919    (memq (preceding-char) (append " \t" nil))) 
     6920   (progn 
     6921     (cperl-backward-to-noncomment (point-min)) 
     6922     (or (memq (preceding-char) (append ";){}$@&%\C-@" nil)) ; Or label!  \C-@ at bobp 
     6923                                        ; Label may be mixed up with `$blah :' 
     6924         (save-excursion (cperl-after-label)) 
     6925         (get-text-property (cperl-1- (point)) 'attrib-group) 
     6926         (and (memq (char-syntax (preceding-char)) '(?w ?_)) 
     6927              (progn 
     6928                (backward-sexp) 
     6929                ;; sub {BLK}, print {BLK} $data, but NOT `bless', `return', `tr' 
     6930                (or (and (looking-at "[a-zA-Z0-9_:]+[ \t\n\f]*[{#]") ; Method call syntax 
     6931                         (not (looking-at "\\(bless\\|return\\|\\(\\(rx\\|[msy]\\|tr\\)\\s *\\(:\\([igcpw]\\|ignorecase\\|global\\|continue\\|pos\\|once\\|words\\|bytes\\|codes\\|graphs\\|langs\\|\\|[0-9]+\\(st\\|nd\\|rd\\|th\\|x\\)\\|ov\\|overlap\\|ex\\|exhaustive\\|rw\\|P5\\|perl5\\|Perl5\\(<[a-zA-Z]+>\\)?\\|nth\\(([0-9]+)\\)?\\|x\\(([0-9]+)\\)?\\)\\s *\\)*\\):?\\)")) ;; perl6 23.06.2006 
     6932                         (not (looking-at "\\$[a-zA-Z0-9_]+"))) ; perl6: todo: why? (topics before blockstart?); even better [$@%]? 
     6933                    ;; sub bless::foo {} 
     6934                    (progn 
     6935                      (cperl-backward-to-noncomment (point-min)) 
     6936                      (and (eq (preceding-char) ?b) 
     6937                           (progn 
     6938                             (forward-sexp -1) 
     6939                             (looking-at "\\(coro\\|sub\\|method\\|submethod\\)[ \t\n\f#]"))))))) ; perl6 
     6940         (if cperl-use-v6 
     6941             (progn ; perl6: "if/elsif/unless/while/until/given/when/for/loop" without parens; just look at beginning of line 
     6942               (beginning-of-line) 
     6943               (looking-at "\\s *}?\\s *\\(\\(els\\(e\\s +\\|\\)\\)?if\\|un\\(less\\|til\\)\\|given\\|wh\\(ile\\|en\\)\\|for\\|loop\\)\\>"))))))) 
    69396944 
    69406945;;; What is the difference of (cperl-after-block-p lim t) and (cperl-block-p)?