1 " settings & syntax hilighting for FRR codebase
2 " 2019 by David Lamparter, placed in public domain
8 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbiuoxXDOUfFeEgGcCsSn]\|[pd]\([A-Z][A-Z0-9]*[a-z]*\|\)\|\[\^\=.[^]]*\]\)" contained
9 syn match cFormat display "%%" contained
11 syn keyword cIterator frr_each frr_each_safe frr_each_from
12 syn keyword cMacroOp offsetof container_of container_of_null array_size
14 syn keyword cStorageClass atomic
15 syn keyword cFormatConst PRId64 PRIu64 PRIx64
16 syn keyword cFormatConst PRId32 PRIu32 PRIx32
17 syn keyword cFormatConst PRId16 PRIu16 PRIx16
18 syn keyword cFormatConst PRId8 PRIu8 PRIx8
20 " you can unlink these by just giving them their own hilighting / color
21 hi link cFormatConst cFormat
22 hi link cIterator cRepeat
23 hi link cMacroOp cOperator
27 setlocal cinoptions=:0,(0,u4,w1,W8
29 setlocal softtabstop=0
35 " auto-apply the above based on path rules
36 "autocmd BufRead,BufNewFile /home/.../frr/*.[ch] call CStyleFRR()