Changeset 16531 for util

Show
Ignore:
Timestamp:
05/26/07 14:46:10 (18 months ago)
Author:
renormalist
Message:

- cperl-mode: better indenting for grammar/rule

(the code inside grammars/rules is still broken though)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/cperl-mode.el

    r16490 r16531  
    14701470;;; 
    14711471;;;  Highlighting new keywords/builtins: 
    1472 ;;;    class, role,  
     1472;;;    class, role, grammar, rule,  
    14731473;;;    has, state, does, 
    14741474;;;    say, 
     
    20982098   (save-excursion 
    20992099     (beginning-of-buffer) 
    2100      (search-forward-regexp "^[\t ]*\\(use v6\\|\\(class\\|role\\)[\t ]+.*;\\)" 320 t)))) 
     2100     (search-forward-regexp "^[\t ]*\\(use v6\\|\\(class\\|role\\|grammar\\|rule\\)[\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\\|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\\)?\\)\\>") 
     6968                    (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\\)?\\)\\>") 
    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\\|role\\|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\\|grammar\\|rule\\|gather\\|async\\|atomically\\|given\\|wh\\(ile\\|en\\)\\|loop\\|for\\|\\(\\(multi\\|proto\\)[ \t]*\\)?\\(coro\\|sub\\|method\\|submethod\\)?\\)\\>")))) 
    69866986      (error nil)))) 
    69876987 
     
    78877887              ;; "AUTOLOAD" "BEGIN" "CHECK" "DESTROY" "END" "INIT" "__END__" "async" "atomically" "chomp" 
    78887888              ;; "chop" "class" "coro" "defined" "delete" "do" "each" "else" "elsif" 
    7889               ;; "eval" "exists" "for" "foreach" "format" "gather" "goto" 
     7889              ;; "eval" "exists" "for" "foreach" "format" "gather" "grammar" "goto" 
    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" "role" "say" "scalar" "shift" 
     7892              ;; "q" "qq" "qw" "qx" "redo" "rx" "reduce" "return" "role" "rule" "say" "scalar" "shift" 
    78937893              ;; "sort" "splice" "split" "study" "state" "sum" "take" "type" "sub" "tie" "tr" 
    78947894              ;; "undef" "uniq" "unless" "unshift" "untie" "until" "uniq" "use" 
     
    78967896              "AUTOLOAD\\|BEGIN\\|CHECK\\|a\\(sync\\|tomically\\)\\|c\\(lass\\|ho\\(p\\|mp\\)\\|oro\\)\\|d\\(e\\(fined\\|lete\\)\\|" 
    78977897              "o\\)\\|DESTROY\\|e\\(ach\\|val\\|xists\\|ls\\(e\\|if\\)\\)\\|" 
    7898               "END\\|for\\(\\|each\\|mat\\)\\|g\\(ather\\|rep\\|oto\\)\\|has\\|INIT\\|if\\|k\\(eys\\|v\\)\\|" 
     7898              "END\\|for\\(\\|each\\|mat\\)\\|g\\(ather\\|r\\(ep\\|ammar\\)\\|oto\\)\\|has\\|INIT\\|if\\|k\\(eys\\|v\\)\\|" 
    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\\)\\)\\|role\\|s\\(ay\\|pli\\(ce\\|t\\)\\|" 
     7901              "q\\(\\|q\\|w\\|x\\|r\\)\\|rx\\|re\\(turn\\|d\\(o\\|uce\\)\\)\\|r\\(o\\|u\\)le\\|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\\|role\\|require\\|use\\|import\\|no\\|bootstrap\\)[ \t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t;]" ; require A if B; 
     7940            '("\\<\\(package\\|class\\|role\\|grammar\\|rule\\|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\\|role\\)[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\([#;]\\|$\\)/\\2/"; perl6 
     8775                "/\\<\\(package\\|class\\|role\\|grammar\\|rule\\)[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\([#;]\\|$\\)/\\2/"; perl6 
    87768776                "-r" 
    8777                 "/\\<\\(package\\|class\\|role\\)[ \\t]*;/\\1;/")) 
     8777                "/\\<\\(package\\|class\\|role\\|grammar\\|rule\\)[ \\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\\|role\\) " (car elt)) ; perl6 
     8988                        (if (string-match "^\\(package\\|class\\|role\\|grammar\\|rule\\) " (car elt)) ; perl6 
    89898989                            (substring (car elt) 8) 
    89908990                          (car elt) ) 
     
    91239123  (concat 
    91249124   "^\\(" 
    9125       "\\(package\\|class\\|role\\)\\>" 
     9125      "\\(package\\|class\\|role\\|grammar\\|rule\\)\\>" 
    91269126     "\\|" 
    91279127      "sub\\>[^\n]+::"