fennec.vim 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. " Vim syntax file
  2. " Language: FenneC
  3. " Filenames: *.fc *.fh
  4. " Maintainer: Koen Koning <koen.koning@vu.nl>
  5. " Last Change: 2017 Nov 24
  6. "
  7. " Based on the Vim 8.0 C syntax file
  8. " Quit when a (custom) syntax file was already loaded
  9. if exists("b:current_syntax")
  10. finish
  11. endif
  12. " Keywords for control flow
  13. syn keyword fcStatement break return continue
  14. syn keyword fcConditional if else
  15. syn keyword fcRepeat while for do to
  16. " Comments
  17. syn keyword fcTodo contained TODO FIXME XXX
  18. syn cluster fcCommentGroup contains=fcTodo
  19. syn region fcCommentL start="//" skip="\\$" end="$" keepend contains=@fcCommentGroup,Spell
  20. syn region fcComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@fcCommentGroup,fcCommentStartError,Spell extend
  21. syn match fcCommentError display "\*/"
  22. syn match fcCommentStartError display "/\*"me=e-1 contained
  23. " String and char constants
  24. syn match fcSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
  25. syn match fcFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
  26. syn match fcFormat display "%%" contained
  27. syn region fcString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=fcSpecial,fcFormat,@Spell extend
  28. syn match fcCharacter "'[^\\]'"
  29. " Number constants
  30. syn case ignore
  31. syn match fcNumbers display transparent "\<\d\|\.\d" contains=fcNumber,fcFloat
  32. syn match fcNumbersCom display contained transparent "\<\d\|\.\d" contains=fcNumber,fcFloat
  33. syn match fcNumber display contained "\d\+\>"
  34. syn match fcNumber display contained "0x\x\+\>"
  35. syn match fcFloat display contained "\d\+\.\d*"
  36. syn match fcFloat display contained "\.\d\+\>"
  37. syn case match
  38. " Bool constants
  39. syn keyword fcBool true false
  40. " Blocks
  41. syn region fcBlock start="{" end="}" transparent fold
  42. " Types
  43. syn keyword fcType bool char int float void
  44. " Modifiers for globals
  45. syn keyword fcStorageClass extern static
  46. " Includes
  47. syn region fcIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
  48. syn match fcIncluded display contained "<[^>]*>"
  49. syn match fcInclude display "^\s*\zs#\s*include\>\s*["<]" contains=fcIncluded
  50. " Define the default highlighting.
  51. " Only used when an item doesn't have highlighting yet
  52. hi def link fcFormat fcSpecial
  53. hi def link fcCommentL fcComment
  54. hi def link fcCommentStart fcComment
  55. hi def link fcConditional Conditional
  56. hi def link fcRepeat Repeat
  57. hi def link fcCharacter Character
  58. hi def link fcNumber Number
  59. hi def link fcFloat Float
  60. hi def link fcCommentError fcError
  61. hi def link fcCommentStartError fcError
  62. hi def link fcStorageClass StorageClass
  63. hi def link fcInclude Include
  64. hi def link fcIncluded fcString
  65. hi def link fcError Error
  66. hi def link fcStatement Statement
  67. hi def link fcType Type
  68. hi def link fcBool Constant
  69. hi def link fcString String
  70. hi def link fcComment Comment
  71. hi def link fcSpecial SpecialChar
  72. hi def link fcTodo Todo
  73. let b:current_syntax = "fennec"
  74. " vim: ts=8