chill.vim 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. " Vim syntax file
  2. " Language: CHILL
  3. " Maintainer: YoungSang Yoon <image@lgic.co.kr>
  4. " Last change: 2004 Jan 21
  5. "
  6. " first created by image@lgic.co.kr & modified by paris@lgic.co.kr
  7. " CHILL (CCITT High Level Programming Language) is used for
  8. " developing software of ATM switch at LGIC (LG Information
  9. " & Communications LTd.)
  10. " quit when a syntax file was already loaded
  11. if exists("b:current_syntax")
  12. finish
  13. endif
  14. " A bunch of useful CHILL keywords
  15. syn keyword chillStatement goto GOTO return RETURN returns RETURNS
  16. syn keyword chillLabel CASE case ESAC esac
  17. syn keyword chillConditional if IF else ELSE elsif ELSIF switch SWITCH THEN then FI fi
  18. syn keyword chillLogical NOT not
  19. syn keyword chillRepeat while WHILE for FOR do DO od OD TO to
  20. syn keyword chillProcess START start STACKSIZE stacksize PRIORITY priority THIS this STOP stop
  21. syn keyword chillBlock PROC proc PROCESS process
  22. syn keyword chillSignal RECEIVE receive SEND send NONPERSISTENT nonpersistent PERSISTENT persistent SET set EVER ever
  23. syn keyword chillTodo contained TODO FIXME XXX
  24. " String and Character constants
  25. " Highlight special characters (those which have a backslash) differently
  26. syn match chillSpecial contained "\\x\x\+\|\\\o\{1,3\}\|\\.\|\\$"
  27. syn region chillString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=chillSpecial
  28. syn match chillCharacter "'[^\\]'"
  29. syn match chillSpecialCharacter "'\\.'"
  30. syn match chillSpecialCharacter "'\\\o\{1,3\}'"
  31. "when wanted, highlight trailing white space
  32. if exists("chill_space_errors")
  33. syn match chillSpaceError "\s*$"
  34. syn match chillSpaceError " \+\t"me=e-1
  35. endif
  36. "catch errors caused by wrong parenthesis
  37. syn cluster chillParenGroup contains=chillParenError,chillIncluded,chillSpecial,chillTodo,chillUserCont,chillUserLabel,chillBitField
  38. syn region chillParen transparent start='(' end=')' contains=ALLBUT,@chillParenGroup
  39. syn match chillParenError ")"
  40. syn match chillInParen contained "[{}]"
  41. "integer number, or floating point number without a dot and with "f".
  42. syn case ignore
  43. syn match chillNumber "\<\d\+\(u\=l\=\|lu\|f\)\>"
  44. "floating point number, with dot, optional exponent
  45. syn match chillFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>"
  46. "floating point number, starting with a dot, optional exponent
  47. syn match chillFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
  48. "floating point number, without dot, with exponent
  49. syn match chillFloat "\<\d\+e[-+]\=\d\+[fl]\=\>"
  50. "hex number
  51. syn match chillNumber "\<0x\x\+\(u\=l\=\|lu\)\>"
  52. "syn match chillIdentifier "\<[a-z_][a-z0-9_]*\>"
  53. syn case match
  54. " flag an octal number with wrong digits
  55. syn match chillOctalError "\<0\o*[89]"
  56. if exists("chill_comment_strings")
  57. " A comment can contain chillString, chillCharacter and chillNumber.
  58. " But a "*/" inside a chillString in a chillComment DOES end the comment! So we
  59. " need to use a special type of chillString: chillCommentString, which also ends on
  60. " "*/", and sees a "*" at the start of the line as comment again.
  61. " Unfortunately this doesn't very well work for // type of comments :-(
  62. syntax match chillCommentSkip contained "^\s*\*\($\|\s\+\)"
  63. syntax region chillCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=chillSpecial,chillCommentSkip
  64. syntax region chillComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=chillSpecial
  65. syntax region chillComment start="/\*" end="\*/" contains=chillTodo,chillCommentString,chillCharacter,chillNumber,chillFloat,chillSpaceError
  66. syntax match chillComment "//.*" contains=chillTodo,chillComment2String,chillCharacter,chillNumber,chillSpaceError
  67. else
  68. syn region chillComment start="/\*" end="\*/" contains=chillTodo,chillSpaceError
  69. syn match chillComment "//.*" contains=chillTodo,chillSpaceError
  70. endif
  71. syntax match chillCommentError "\*/"
  72. syn keyword chillOperator SIZE size
  73. syn keyword chillType dcl DCL int INT char CHAR bool BOOL REF ref LOC loc INSTANCE instance
  74. syn keyword chillStructure struct STRUCT enum ENUM newmode NEWMODE synmode SYNMODE
  75. "syn keyword chillStorageClass
  76. syn keyword chillBlock PROC proc END end
  77. syn keyword chillScope GRANT grant SEIZE seize
  78. syn keyword chillEDML select SELECT delete DELETE update UPDATE in IN seq SEQ WHERE where INSERT insert include INCLUDE exclude EXCLUDE
  79. syn keyword chillBoolConst true TRUE false FALSE
  80. syn region chillPreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=chillComment,chillString,chillCharacter,chillNumber,chillCommentError,chillSpaceError
  81. syn region chillIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+
  82. syn match chillIncluded contained "<[^>]*>"
  83. syn match chillInclude "^\s*#\s*include\>\s*["<]" contains=chillIncluded
  84. "syn match chillLineSkip "\\$"
  85. syn cluster chillPreProcGroup contains=chillPreCondit,chillIncluded,chillInclude,chillDefine,chillInParen,chillUserLabel
  86. syn region chillDefine start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,@chillPreProcGroup
  87. syn region chillPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,@chillPreProcGroup
  88. " Highlight User Labels
  89. syn cluster chillMultiGroup contains=chillIncluded,chillSpecial,chillTodo,chillUserCont,chillUserLabel,chillBitField
  90. syn region chillMulti transparent start='?' end=':' contains=ALLBUT,@chillMultiGroup
  91. " Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
  92. syn match chillUserCont "^\s*\I\i*\s*:$" contains=chillUserLabel
  93. syn match chillUserCont ";\s*\I\i*\s*:$" contains=chillUserLabel
  94. syn match chillUserCont "^\s*\I\i*\s*:[^:]"me=e-1 contains=chillUserLabel
  95. syn match chillUserCont ";\s*\I\i*\s*:[^:]"me=e-1 contains=chillUserLabel
  96. syn match chillUserLabel "\I\i*" contained
  97. " Avoid recognizing most bitfields as labels
  98. syn match chillBitField "^\s*\I\i*\s*:\s*[1-9]"me=e-1
  99. syn match chillBitField ";\s*\I\i*\s*:\s*[1-9]"me=e-1
  100. syn match chillBracket contained "[<>]"
  101. if !exists("chill_minlines")
  102. let chill_minlines = 15
  103. endif
  104. exec "syn sync ccomment chillComment minlines=" . chill_minlines
  105. " Define the default highlighting.
  106. " Only when an item doesn't have highlighting yet
  107. hi def link chillLabel Label
  108. hi def link chillUserLabel Label
  109. hi def link chillConditional Conditional
  110. " hi def link chillConditional term=bold ctermfg=red guifg=red gui=bold
  111. hi def link chillRepeat Repeat
  112. hi def link chillProcess Repeat
  113. hi def link chillSignal Repeat
  114. hi def link chillCharacter Character
  115. hi def link chillSpecialCharacter chillSpecial
  116. hi def link chillNumber Number
  117. hi def link chillFloat Float
  118. hi def link chillOctalError chillError
  119. hi def link chillParenError chillError
  120. hi def link chillInParen chillError
  121. hi def link chillCommentError chillError
  122. hi def link chillSpaceError chillError
  123. hi def link chillOperator Operator
  124. hi def link chillStructure Structure
  125. hi def link chillBlock Operator
  126. hi def link chillScope Operator
  127. "hi def link chillEDML term=underline ctermfg=DarkRed guifg=Red
  128. hi def link chillEDML PreProc
  129. "hi def link chillBoolConst term=bold ctermfg=brown guifg=brown
  130. hi def link chillBoolConst Constant
  131. "hi def link chillLogical term=bold ctermfg=brown guifg=brown
  132. hi def link chillLogical Constant
  133. hi def link chillStorageClass StorageClass
  134. hi def link chillInclude Include
  135. hi def link chillPreProc PreProc
  136. hi def link chillDefine Macro
  137. hi def link chillIncluded chillString
  138. hi def link chillError Error
  139. hi def link chillStatement Statement
  140. hi def link chillPreCondit PreCondit
  141. hi def link chillType Type
  142. hi def link chillCommentError chillError
  143. hi def link chillCommentString chillString
  144. hi def link chillComment2String chillString
  145. hi def link chillCommentSkip chillComment
  146. hi def link chillString String
  147. hi def link chillComment Comment
  148. " hi def link chillComment term=None ctermfg=lightblue guifg=lightblue
  149. hi def link chillSpecial SpecialChar
  150. hi def link chillTodo Todo
  151. hi def link chillBlock Statement
  152. "hi def link chillIdentifier Identifier
  153. hi def link chillBracket Delimiter
  154. let b:current_syntax = "chill"
  155. " vim: ts=8