Changeset 16591 for util

Show
Ignore:
Timestamp:
06/01/07 09:16:39 (18 months ago)
Author:
renormalist
Message:

- cperl-mode: token/regex (indenting+highlighting)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/cperl-mode.el

    r16577 r16591  
    14701470;;; 
    14711471;;;  Highlighting new keywords/builtins: 
    1472 ;;;    class, role, grammar, rule,  
     1472;;;    class, role, grammar, rule, token, regex,  
    14731473;;;    has, state, does, 
    14741474;;;    say, 
     
    20982098   (save-excursion 
    20992099     (beginning-of-buffer) 
    2100      (search-forward-regexp "^[\t ]*\\(use v6\\|\\(class\\|role\\|grammar\\|rule\\)[\t ]+.*;\\)" 320 t)))) 
     2100     (search-forward-regexp "^[\t ]*\\(use v6\\|\\(class\\|role\\|grammar\\|rule\\|token\\|regex\\)[\t ]+.*;\\)" 320 t)))) 
    21012101 
    21022102(if cperl-can-font-lock 
     
    69716971                    (forward-sexp -1) 
    69726972                    ;; else {}     but not    else::func {} 
    6973                     (or (and (looking-at "\\(else\\|class\\|role\\|grammar\\|rule\\|continue\\|grep\\|map\\|gather\\|async\\|atomically\\|given\\|when\\|default\\|loop\\|for\\|BEGIN\\|END\\|CHECK\\|INIT\\|START\\|FIRST\\|ENTER\\|LEAVE\\|KEEP\\|UNDO\\|NEXT\\|LAST\\|PRE\\|POST\\|CATCH\\|CONTROL\\|\\(\\(multi\\|proto\\)[ \t]*\\)?\\(coro\\|sub\\|method\\|submethod\\)?\\)\\>") 
     6973                    (or (and (looking-at "\\(else\\|class\\|role\\|grammar\\|rule\\|token\\|regex\\|continue\\|grep\\|map\\|gather\\|async\\|atomically\\|given\\|when\\|default\\|loop\\|for\\|BEGIN\\|END\\|CHECK\\|INIT\\|START\\|FIRST\\|ENTER\\|LEAVE\\|KEEP\\|UNDO\\|NEXT\\|LAST\\|PRE\\|POST\\|CATCH\\|CONTROL\\|\\(\\(multi\\|proto\\)[ \t]*\\)?\\(coro\\|sub\\|method\\|submethod\\)?\\)\\>") 
    69746974                             (not (looking-at "\\(\\sw\\|_\\)+::"))) 
    69756975                        ;; sub f {} 
     
    69886988                ;; perl6: todo: correct in P5? Then use-v6'ify! 
    69896989                (beginning-of-line) 
    6990                 (looking-at "\\s *}?\\s *\\(\\(els\\(e\\s +\\|\\)\\)?if\\|un\\(less\\|til\\)\\|class\\|role\\|grammar\\|rule\\|gather\\|async\\|atomically\\|given\\|wh\\(ile\\|en\\)\\|loop\\|for\\|\\(\\(multi\\|proto\\)[ \t]*\\)?\\(coro\\|sub\\|method\\|submethod\\)?\\)\\>")))) 
     6990                (looking-at "\\s *}?\\s *\\(\\(els\\(e\\s +\\|\\)\\)?if\\|un\\(less\\|til\\)\\|class\\|role\\|grammar\\|rule\\|token\\|regex\\|gather\\|async\\|atomically\\|given\\|wh\\(ile\\|en\\)\\|loop\\|for\\|\\(\\(multi\\|proto\\)[ \t]*\\)?\\(coro\\|sub\\|method\\|submethod\\)?\\)\\>")))) 
    69916991      (error nil)))) 
    69926992 
     
    78957895              ;; "grep" "has" "if" "keys" "kv" "last" "local" "loop" "map" "my" "next" 
    78967896              ;; "no" "our" "pairs" "package" "pop" "pos" "pick" "print" "printf" "push" 
    7897               ;; "q" "qq" "qw" "qx" "redo" "rx" "reduce" "return" "role" "rule" "say" "scalar" "shift" 
    7898               ;; "sort" "splice" "split" "study" "state" "sum" "take" "type" "sub" "tie" "tr" 
     7897              ;; "q" "qq" "qw" "qx" "redo" "rx" "reduce" "regex" "return" "role" "rule" "say" "scalar" "shift" 
     7898              ;; "sort" "splice" "split" "study" "state" "sum" "take" "taken" "type" "token" "sub" "tie" "tr" 
    78997899              ;; "undef" "uniq" "unless" "unshift" "untie" "until" "uniq" "use" 
    79007900              ;; "while" "y" "zip" 
     
    79047904              "l\\(ast\\|o\\(cal\\|op\\)\\)\\|m\\(a\\(p\\|x\\)\\|in\\|y\\)\\|n\\(ext\\|o\\)\\|our\\|" 
    79057905              "p\\(a\\(ckage\\|irs\\)\\|ick\\|rint\\(\\|f\\)\\|ush\\|o\\(p\\|s\\)\\)\\|" 
    7906               "q\\(\\|q\\|w\\|x\\|r\\)\\|rx\\|re\\(turn\\|d\\(o\\|uce\\)\\)\\|r\\(o\\|u\\)le\\|s\\(ay\\|pli\\(ce\\|t\\)\\|" 
    7907               "calar\\|t\\(udy\\|ate\\)\\|u\\(b\\|m\\)\\|hift\\|ort\\)\\|t\\(r\\|ie\\|ype\\|aken?\\)\\|" 
     7906              "q\\(\\|q\\|w\\|x\\|r\\)\\|rx\\|re\\(gex\\|turn\\|d\\(o\\|uce\\)\\)\\|r\\(o\\|u\\)le\\|s\\(ay\\|pli\\(ce\\|t\\)\\|" 
     7907              "calar\\|t\\(udy\\|ate\\)\\|u\\(b\\|m\\)\\|hift\\|ort\\)\\|t\\(r\\|ie\\|ype\\|oken\\|aken?\\)\\|" 
    79087908              "u\\(se\\|n\\(iq\\|shift\\|ti\\(l\\|e\\)\\|def\\|less\\)\\)\\|" 
    79097909              "while\\|y\\|zip\\|__\\(END\\|DATA\\)__" ;__DATA__ added manually 
     
    79437943                             'font-lock-function-name-face 
    79447944                           'font-lock-variable-name-face)))) 
    7945             '("\\<\\(package\\|class\\|role\\|grammar\\|rule\\|require\\|use\\|import\\|no\\|bootstrap\\)[ \t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t;]" ; require A if B; 
     7945            '("\\<\\(package\\|class\\|role\\|grammar\\|rule\\|token\\|regex\\|require\\|use\\|import\\|no\\|bootstrap\\)[ \t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t;]" ; require A if B; 
    79467946              2 font-lock-function-name-face) 
    79477947            '("^[ \t]*format[ \t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t]*=[ \t]*$" 
     
    87788778                "/\\<sub[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\(([^()]*)[ \t]*\\)?\\([ \t]*:[^#{;]*\\)?\\([{#]\\|$\\)/\\3/" 
    87798779                "-r" 
    8780                 "/\\<\\(package\\|class\\|role\\|grammar\\|rule\\)[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\([#;]\\|$\\)/\\2/"; perl6 
     8780                "/\\<\\(package\\|class\\|role\\|grammar\\|rule\\|token\\|regex\\)[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\([#;]\\|$\\)/\\2/"; perl6 
    87818781                "-r" 
    8782                 "/\\<\\(package\\|class\\|role\\|grammar\\|rule\\)[ \\t]*;/\\1;/")) 
     8782                "/\\<\\(package\\|class\\|role\\|grammar\\|rule\\|token\\|regex\\)[ \\t]*;/\\1;/")) 
    87838783        res) 
    87848784    (if add (setq args (cons "-a" args))) 
     
    89918991                (insert (elt elt 3) 
    89928992                        127 
    8993                         (if (string-match "^\\(package\\|class\\|role\\|grammar\\|rule\\) " (car elt)) ; perl6 
     8993                        (if (string-match "^\\(package\\|class\\|role\\|grammar\\|rule\\|token\\|regex\\) " (car elt)) ; perl6 
    89948994                            (substring (car elt) 8) 
    89958995                          (car elt) ) 
     
    91289128  (concat 
    91299129   "^\\(" 
    9130       "\\(package\\|class\\|role\\|grammar\\|rule\\)\\>" 
     9130      "\\(package\\|class\\|role\\|grammar\\|rule\\|token\\|regex\\)\\>" 
    91319131     "\\|" 
    91329132      "sub\\>[^\n]+::"