Changeset 16490 for util

Show
Ignore:
Timestamp:
05/22/07 00:41:32 (18 months ago)
Author:
renormalist
Message:

- cperl-mode.el: role handling analogue to class|package

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/cperl-mode.el

    r15237 r16490  
    14701470;;; 
    14711471;;;  Highlighting new keywords/builtins: 
    1472 ;;;    class, 
     1472;;;    class, role,  
    14731473;;;    has, state, does, 
    14741474;;;    say, 
     
    14851485;;;    "Complex" "Exception" "Seq" "Range" "Set" "Junction" "Pair" "Mapping" "Signature" "Capture", 
    14861486;;;    "Bool" "Array" "Hash" "IO" "Code" "Routine" "Sub" "Method" "Submethod", 
    1487 ;;;    "Macro" "Rule" "Block" "Bare" "Parametric" "Package" "Module" "Class", 
     1487;;;    "Macro" "Rule" "Block" "Bare" "Parametric" "Package" "Module" "Class", "Role", 
    14881488;;;    "Object" "Grammar" "List" "Lazy" "Eager", 
    14891489;;;    "Real" "Scalar" "int8" "Socket" 
     
    20982098   (save-excursion 
    20992099     (beginning-of-buffer) 
    2100      (search-forward-regexp "^[\t ]*\\(use v6\\|class[\t ]+.*;\\)" 320 t)))) 
     2100     (search-forward-regexp "^[\t ]*\\(use v6\\|\\(class\\|role\\)[\t ]+.*;\\)" 320 t)))) 
    21012101 
    21022102(if cperl-can-font-lock 
     
    69666966                    (forward-sexp -1) 
    69676967                    ;; else {}     but not    else::func {} 
    6968                     (or (and (looking-at "\\(else\\|class\\|\\|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\\)?\\)\\>") 
     6968                    (or (and (looking-at "\\(else\\|class\\|role\\|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\\)?\\)\\>") 
    69696969                             (not (looking-at "\\(\\sw\\|_\\)+::"))) 
    69706970                        ;; sub f {} 
     
    69836983                ;; perl6: todo: correct in P5? Then use-v6'ify! 
    69846984                (beginning-of-line) 
    6985                 (looking-at "\\s *}?\\s *\\(\\(els\\(e\\s +\\|\\)\\)?if\\|un\\(less\\|til\\)\\|class\\|gather\\|async\\|atomically\\|given\\|wh\\(ile\\|en\\)\\|loop\\|for\\|\\(\\(multi\\|proto\\)[ \t]*\\)?\\(coro\\|sub\\|method\\|submethod\\)?\\)\\>")))) 
     6985                (looking-at "\\s *}?\\s *\\(\\(els\\(e\\s +\\|\\)\\)?if\\|un\\(less\\|til\\)\\|class\\|role\\|gather\\|async\\|atomically\\|given\\|wh\\(ile\\|en\\)\\|loop\\|for\\|\\(\\(multi\\|proto\\)[ \t]*\\)?\\(coro\\|sub\\|method\\|submethod\\)?\\)\\>")))) 
    69866986      (error nil)))) 
    69876987 
     
    77887788             "given" "when" "default" "has" "returns" "of" "is" "does" 
    77897789             "\\(\\(multi\\|proto\\)[ \t]*\\)?\\(coro\\|sub\\|method\\|submethod\\)?" 
    7790              "class" "try") 
     7790             "class" "role" "try") 
    77917791               "\\|")                   ; Flow control 
    77927792              "\\)\\>") 2)              ; was "\\)[ \n\t;():,\|&]" 
     
    78677867              ;; bit" "int" "str" "num" "ref" "bool" "Bit" "Int" "Str" "Num" "Ref" 
    78687868              ;; Bool" "Array" "Hash" "IO" "Code" "Routine" "Sub" "Method" "Submethod" 
    7869               ;; Macro" "Rule" "Block" "Bare" "Parametric" "Package" "Module" "Class" 
     7869              ;; Macro" "Rule" "Block" "Bare" "Parametric" "Package" "Module" "Class" "Role" 
    78707870              ;; Object" "Grammar" "List" "Lazy" "Eager"  
    78717871              ;; Real" "Scalar" "int8" "Socket" 
     
    78737873                  "Complex\\|Exception\\|Seq\\|Range\\|Set\\|Junction\\|Pair\\|Mapping\\|Signature\\|Capture\\|" 
    78747874              "Bool\\|Array\\|Hash\\|IO\\|Code\\|Routine\\|Sub\\|Method\\|Submethod\\|" 
    7875               "Macro\\|Rule\\|Block\\|Bare\\|Parametric\\|Package\\|Module\\|Class\\|" 
     7875              "Macro\\|Rule\\|Block\\|Bare\\|Parametric\\|Package\\|Module\\|Class\\|Role\\|" 
    78767876              "Object\\|Grammar\\|List\\|Lazy\\|Eager\\|" 
    78777877              "Real\\|Scalar\\|int8\\|Socket\\|" 
     
    78907890              ;; "grep" "has" "if" "keys" "kv" "last" "local" "loop" "map" "my" "next" 
    78917891              ;; "no" "our" "pairs" "package" "pop" "pos" "pick" "print" "printf" "push" 
    7892               ;; "q" "qq" "qw" "qx" "redo" "rx" "reduce" "return" "say" "scalar" "shift" 
     7892              ;; "q" "qq" "qw" "qx" "redo" "rx" "reduce" "return" "role" "say" "scalar" "shift" 
    78937893              ;; "sort" "splice" "split" "study" "state" "sum" "take" "type" "sub" "tie" "tr" 
    78947894              ;; "undef" "uniq" "unless" "unshift" "untie" "until" "uniq" "use" 
     
    78997899              "l\\(ast\\|o\\(cal\\|op\\)\\)\\|m\\(a\\(p\\|x\\)\\|in\\|y\\)\\|n\\(ext\\|o\\)\\|our\\|" 
    79007900              "p\\(a\\(ckage\\|irs\\)\\|ick\\|rint\\(\\|f\\)\\|ush\\|o\\(p\\|s\\)\\)\\|" 
    7901               "q\\(\\|q\\|w\\|x\\|r\\)\\|rx\\|re\\(turn\\|d\\(o\\|uce\\)\\)\\|s\\(ay\\|pli\\(ce\\|t\\)\\|" 
     7901              "q\\(\\|q\\|w\\|x\\|r\\)\\|rx\\|re\\(turn\\|d\\(o\\|uce\\)\\)\\|role\\|s\\(ay\\|pli\\(ce\\|t\\)\\|" 
    79027902              "calar\\|t\\(udy\\|ate\\)\\|u\\(b\\|m\\)\\|hift\\|ort\\)\\|t\\(r\\|ie\\|ype\\|aken?\\)\\|" 
    79037903              "u\\(se\\|n\\(iq\\|shift\\|ti\\(l\\|e\\)\\|def\\|less\\)\\)\\|" 
     
    79387938                             'font-lock-function-name-face 
    79397939                           'font-lock-variable-name-face)))) 
    7940             '("\\<\\(package\\|class\\|require\\|use\\|import\\|no\\|bootstrap\\)[ \t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t;]" ; require A if B; 
     7940            '("\\<\\(package\\|class\\|role\\|require\\|use\\|import\\|no\\|bootstrap\\)[ \t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t;]" ; require A if B; 
    79417941              2 font-lock-function-name-face) 
    79427942            '("^[ \t]*format[ \t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t]*=[ \t]*$" 
     
    87738773                "/\\<sub[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\(([^()]*)[ \t]*\\)?\\([ \t]*:[^#{;]*\\)?\\([{#]\\|$\\)/\\3/" 
    87748774                "-r" 
    8775                 "/\\<\\(package\\|class\\)[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\([#;]\\|$\\)/\\2/"; perl6 
     8775                "/\\<\\(package\\|class\\|role\\)[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\([#;]\\|$\\)/\\2/"; perl6 
    87768776                "-r" 
    8777                 "/\\<\\(package\\|class\\)[ \\t]*;/\\1;/")) 
     8777                "/\\<\\(package\\|class\\|role\\)[ \\t]*;/\\1;/")) 
    87788778        res) 
    87798779    (if add (setq args (cons "-a" args))) 
     
    89868986                (insert (elt elt 3) 
    89878987                        127 
    8988                         (if (string-match "^\\(package\\|class\\) " (car elt)) ; perl6 
     8988                        (if (string-match "^\\(package\\|class\\|role\\) " (car elt)) ; perl6 
    89898989                            (substring (car elt) 8) 
    89908990                          (car elt) ) 
     
    91239123  (concat 
    91249124   "^\\(" 
    9125       "\\(package\\|class\\)\\>" 
     9125      "\\(package\\|class\\|role\\)\\>" 
    91269126     "\\|" 
    91279127      "sub\\>[^\n]+::"