Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: indent RC File |
| 3 | " Maintainer: Nikolai Weibull <source@pcppopper.org> |
| 4 | " URL: http://www.pcppopper.org/vim/syntax/pcp/indent/ |
| 5 | " Latest Revision: 2004-05-22 |
| 6 | " arch-tag: 23c11190-79fa-4493-9fc5-36435402a20d |
| 7 | " TODO: is the deny-all (a la lilo.vim nice or no?)... |
| 8 | " irritating to be wrong to the last char... |
| 9 | " would be sweet if right until one char fails |
| 10 | |
| 11 | if version < 600 |
| 12 | syntax clear |
| 13 | elseif exists("b:current_syntax") |
| 14 | finish |
| 15 | endif |
| 16 | |
| 17 | " Set iskeyword since we need `-' (and potentially others) in keywords. |
| 18 | " For version 5.x: Set it globally |
| 19 | " For version 6.x: Set it locally |
| 20 | if version >= 600 |
| 21 | command -nargs=1 SetIsk setlocal iskeyword=<args> |
| 22 | else |
| 23 | command -nargs=1 SetIsk set iskeyword=<args> |
| 24 | endif |
| 25 | SetIsk 48-57,65-90,97-122,-,_ |
| 26 | delcommand SetIsk |
| 27 | |
| 28 | " errors |
| 29 | syn match indentError "\S\+" |
| 30 | |
| 31 | " todo |
| 32 | syn keyword indentTodo contained TODO FIXME XXX NOTE |
| 33 | |
| 34 | " comments |
| 35 | syn region indentComment matchgroup=indentComment start="/\*" end="\*/" contains=indentTodo |
| 36 | |
| 37 | " keywords (command-line switches) |
| 38 | syn match indentOptions "\<--\(no-\)\=blank-\(before-sizeof\|Bill-Shannon\|lines-\(after-\(commas\|declarations\|procedures\)\|before-block-comments\)\)\>" |
| 39 | syn match indentOptions "\<--brace-indent\s*\d\+\>" |
| 40 | syn match indentOptions "\<--braces-\(after\|on\)-\(if\|struct-decl\)-line\>" |
| 41 | syn match indentOptions "\<--break-\(\(after\|before\)-boolean-operator\|function-decl-args\)\>" |
| 42 | syn match indentOptions "\<--\(case\(-brace\)\=\|comment\|continuation\|declaration\|line-comments\|parameter\|paren\|struct-brace\)-indentation\s*\d\+\>" |
| 43 | syn match indentOptions "\<--\(no-\)\=comment-delimiters-on-blank-lines\>" |
| 44 | syn match indentOptions "\<--\(dont-\)\=cuddle-\(do-while\|else\)\>" |
| 45 | syn match indentOptions "\<--\(declaration-comment\|else-endif\)-column\s*\d\+\>" |
| 46 | syn match indentOptions "\<--dont-break-\(function-decl-args\|procedure-type\)\>" |
| 47 | syn match indentOptions "\<--\(dont-\)\=\(format\(-first-column\)\=\|star\)-comments\>" |
| 48 | syn match indentOptions "\<--\(honour\|ignore\)-newlines\>" |
| 49 | syn match indentOptions "\<--\(indent-level\|\(comment-\)\=line-length\)\s*\d\+\>" |
| 50 | syn match indentOptions "\<--\(leave\|remove\)-preprocessor-space\>" |
| 51 | "not 100%, since casts\= should always be cast if no- isn't given |
| 52 | syn match indentOptions "\<--\(no-\)\=space-after-\(parentheses\|casts\=\|for\|if\|while\)\>" |
| 53 | syn match indentOptions "\<--\(dont-\)\=space-special-semicolon\>" |
| 54 | syn match indentOptions "\<--\(leave\|swallow\)-optional-blank-lines\>" |
| 55 | syn match indentOptions "\<--tab-size\s*\d\+\>" |
| 56 | syn match indentOptions "\<--\(no\|use\)-tabs\>" |
| 57 | syn keyword indentOptions --gnu-style --ignore-profile --k-and-r-style --original |
| 58 | syn keyword indentOptions --preserve-mtime --no-verbosity --verbose --output-file |
| 59 | syn keyword indentOptions --no-parameter-indentation --procnames-start-lines |
| 60 | syn keyword indentOptions --standard-output --start-left-side-of-comments |
| 61 | syn keyword indentOptions --space-after-procedure-calls |
| 62 | " this also here since the gnu indent fellas aren't consistent. (ever read |
| 63 | " the code to `indent'? you'll know what i mean if you have) |
| 64 | syn match indentOptions "\<-\(bli\|cbi\|cd\|ci\|cli\|c\|cp\|di\|d\|i\|ip\|l\|lc\|pi\|sbi\|ts\)\s*\d\+\>" |
| 65 | syn match indentOptions "\<-T\s\+\w\+\>" |
| 66 | syn keyword indentOptions --format-all-comments --continue-at-parentheses --dont-line-up-parentheses |
| 67 | syn keyword indentOptions --no-space-after-function-call-names |
| 68 | syn keyword indentOptions -bad -bap -bbb -bbo -bc -bfda -bl -br -bs -nbs -cdb -cdw -ce -cs -dce -fc1 -fca |
| 69 | syn keyword indentOptions -gnu -hnl -kr -lp -lps -nbad -nbap -nbbb -nbbo -nbc -nbfda -ncdb -ncdw -nprs |
| 70 | syn keyword indentOptions -nce -ncs -nfc1 -nfca -nhnl -nip -nlp -nlps -npcs -npmt -npro -npsl -nsaf -nsai |
| 71 | syn keyword indentOptions -nsaw -nsc -nsob -nss -nv -o -orig -pcs -pmt -prs -psl -saf -sai -saw -sc |
| 72 | syn keyword indentOptions -sob -ss -st -v -version -bls -brs -ut -nut |
| 73 | |
| 74 | if exists("indent_minlines") |
| 75 | let b:indent_minlines = indent_minlines |
| 76 | else |
| 77 | let b:indent_minlines = 50 |
| 78 | endif |
| 79 | exec "syn sync minlines=" . b:indent_minlines |
| 80 | |
| 81 | " Define the default highlighting. |
| 82 | " For version 5.7 and earlier: only when not done already |
| 83 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 84 | if version >= 508 || !exists("did_indent_syn_inits") |
| 85 | if version < 508 |
| 86 | let did_indent_syn_inits = 1 |
| 87 | command -nargs=+ HiLink hi link <args> |
| 88 | else |
| 89 | command -nargs=+ HiLink hi def link <args> |
| 90 | endif |
| 91 | |
| 92 | HiLink indentError Error |
| 93 | HiLink indentComment Comment |
| 94 | HiLink indentTodo Todo |
| 95 | HiLink indentOptions Keyword |
| 96 | delcommand HiLink |
| 97 | endif |
| 98 | |
| 99 | let b:current_syntax = "indent" |
| 100 | |
| 101 | " vim: set sts=2 sw=2: |