blob: b9f3c7e7c8f58099172942df06cefba8176b296e [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" 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
11if version < 600
12 syntax clear
13elseif exists("b:current_syntax")
14 finish
15endif
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
20if version >= 600
21 command -nargs=1 SetIsk setlocal iskeyword=<args>
22else
23 command -nargs=1 SetIsk set iskeyword=<args>
24endif
25SetIsk 48-57,65-90,97-122,-,_
26delcommand SetIsk
27
28" errors
29syn match indentError "\S\+"
30
31" todo
32syn keyword indentTodo contained TODO FIXME XXX NOTE
33
34" comments
35syn region indentComment matchgroup=indentComment start="/\*" end="\*/" contains=indentTodo
36
37" keywords (command-line switches)
38syn match indentOptions "\<--\(no-\)\=blank-\(before-sizeof\|Bill-Shannon\|lines-\(after-\(commas\|declarations\|procedures\)\|before-block-comments\)\)\>"
39syn match indentOptions "\<--brace-indent\s*\d\+\>"
40syn match indentOptions "\<--braces-\(after\|on\)-\(if\|struct-decl\)-line\>"
41syn match indentOptions "\<--break-\(\(after\|before\)-boolean-operator\|function-decl-args\)\>"
42syn match indentOptions "\<--\(case\(-brace\)\=\|comment\|continuation\|declaration\|line-comments\|parameter\|paren\|struct-brace\)-indentation\s*\d\+\>"
43syn match indentOptions "\<--\(no-\)\=comment-delimiters-on-blank-lines\>"
44syn match indentOptions "\<--\(dont-\)\=cuddle-\(do-while\|else\)\>"
45syn match indentOptions "\<--\(declaration-comment\|else-endif\)-column\s*\d\+\>"
46syn match indentOptions "\<--dont-break-\(function-decl-args\|procedure-type\)\>"
47syn match indentOptions "\<--\(dont-\)\=\(format\(-first-column\)\=\|star\)-comments\>"
48syn match indentOptions "\<--\(honour\|ignore\)-newlines\>"
49syn match indentOptions "\<--\(indent-level\|\(comment-\)\=line-length\)\s*\d\+\>"
50syn match indentOptions "\<--\(leave\|remove\)-preprocessor-space\>"
51"not 100%, since casts\= should always be cast if no- isn't given
52syn match indentOptions "\<--\(no-\)\=space-after-\(parentheses\|casts\=\|for\|if\|while\)\>"
53syn match indentOptions "\<--\(dont-\)\=space-special-semicolon\>"
54syn match indentOptions "\<--\(leave\|swallow\)-optional-blank-lines\>"
55syn match indentOptions "\<--tab-size\s*\d\+\>"
56syn match indentOptions "\<--\(no\|use\)-tabs\>"
57syn keyword indentOptions --gnu-style --ignore-profile --k-and-r-style --original
58syn keyword indentOptions --preserve-mtime --no-verbosity --verbose --output-file
59syn keyword indentOptions --no-parameter-indentation --procnames-start-lines
60syn keyword indentOptions --standard-output --start-left-side-of-comments
61syn 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)
64syn match indentOptions "\<-\(bli\|cbi\|cd\|ci\|cli\|c\|cp\|di\|d\|i\|ip\|l\|lc\|pi\|sbi\|ts\)\s*\d\+\>"
65syn match indentOptions "\<-T\s\+\w\+\>"
66syn keyword indentOptions --format-all-comments --continue-at-parentheses --dont-line-up-parentheses
67syn keyword indentOptions --no-space-after-function-call-names
68syn keyword indentOptions -bad -bap -bbb -bbo -bc -bfda -bl -br -bs -nbs -cdb -cdw -ce -cs -dce -fc1 -fca
69syn keyword indentOptions -gnu -hnl -kr -lp -lps -nbad -nbap -nbbb -nbbo -nbc -nbfda -ncdb -ncdw -nprs
70syn keyword indentOptions -nce -ncs -nfc1 -nfca -nhnl -nip -nlp -nlps -npcs -npmt -npro -npsl -nsaf -nsai
71syn keyword indentOptions -nsaw -nsc -nsob -nss -nv -o -orig -pcs -pmt -prs -psl -saf -sai -saw -sc
72syn keyword indentOptions -sob -ss -st -v -version -bls -brs -ut -nut
73
74if exists("indent_minlines")
75 let b:indent_minlines = indent_minlines
76else
77 let b:indent_minlines = 50
78endif
79exec "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
84if 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
97endif
98
99let b:current_syntax = "indent"
100
101" vim: set sts=2 sw=2: