csc.vim 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. " Vim syntax file
  2. " Language: Essbase script
  3. " Maintainer: Raul Segura Acevedo <raulseguraaceved@netscape.net>
  4. " Last change: 2011 Dec 25 by Thilo Six
  5. " quit when a syntax file was already loaded
  6. if exists("b:current_syntax")
  7. finish
  8. endif
  9. let s:cpo_save = &cpo
  10. set cpo&vim
  11. " folds: fix/endfix and comments
  12. sy region EssFold start="\<Fix" end="EndFix" transparent fold
  13. sy keyword cscTodo contained TODO FIXME XXX
  14. " cscCommentGroup allows adding matches for special things in comments
  15. sy cluster cscCommentGroup contains=cscTodo
  16. " Strings in quotes
  17. sy match cscError '"'
  18. sy match cscString '"[^"]*"'
  19. "when wanted, highlight trailing white space
  20. if exists("csc_space_errors")
  21. if !exists("csc_no_trail_space_error")
  22. sy match cscSpaceE "\s\+$"
  23. endif
  24. if !exists("csc_no_tab_space_error")
  25. sy match cscSpaceE " \+\t"me=e-1
  26. endif
  27. endif
  28. "catch errors caused by wrong parenthesis and brackets
  29. sy cluster cscParenGroup contains=cscParenE,@cscCommentGroup,cscUserCont,cscBitField,cscFormat,cscNumber,cscFloat,cscOctal,cscNumbers,cscIfError,cscComW,cscCom,cscFormula,cscBPMacro
  30. sy region cscParen transparent start='(' end=')' contains=ALLBUT,@cscParenGroup
  31. sy match cscParenE ")"
  32. "integer number, or floating point number without a dot and with "f".
  33. sy case ignore
  34. sy match cscNumbers transparent "\<\d\|\.\d" contains=cscNumber,cscFloat,cscOctal
  35. sy match cscNumber contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
  36. "hex number
  37. sy match cscNumber contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
  38. " Flag the first zero of an octal number as something special
  39. sy match cscOctal contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>"
  40. sy match cscFloat contained "\d\+f"
  41. "floating point number, with dot, optional exponent
  42. sy match cscFloat contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
  43. "floating point number, starting with a dot, optional exponent
  44. sy match cscFloat contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
  45. "floating point number, without dot, with exponent
  46. sy match cscFloat contained "\d\+e[-+]\=\d\+[fl]\=\>"
  47. sy region cscComment start="/\*" end="\*/" contains=@cscCommentGroup,cscSpaceE fold
  48. sy match cscCommentE "\*/"
  49. sy keyword cscIfError IF ELSE ENDIF ELSEIF
  50. sy keyword cscCondition contained IF ELSE ENDIF ELSEIF
  51. sy keyword cscFunction contained VARPER VAR UDA TRUNCATE SYD SUMRANGE SUM
  52. sy keyword cscFunction contained STDDEVRANGE STDDEV SPARENTVAL SLN SIBLINGS SHIFT
  53. sy keyword cscFunction contained SANCESTVAL RSIBLINGS ROUND REMAINDER RELATIVE PTD
  54. sy keyword cscFunction contained PRIOR POWER PARENTVAL NPV NEXT MOD MINRANGE MIN
  55. sy keyword cscFunction contained MDSHIFT MDPARENTVAL MDANCESTVAL MAXRANGE MAX MATCH
  56. sy keyword cscFunction contained LSIBLINGS LEVMBRS LEV
  57. sy keyword cscFunction contained ISUDA ISSIBLING ISSAMELEV ISSAMEGEN ISPARENT ISMBR
  58. sy keyword cscFunction contained ISLEV ISISIBLING ISIPARENT ISIDESC ISICHILD ISIBLINGS
  59. sy keyword cscFunction contained ISIANCEST ISGEN ISDESC ISCHILD ISANCEST ISACCTYPE
  60. sy keyword cscFunction contained IRSIBLINGS IRR INTEREST INT ILSIBLINGS IDESCENDANTS
  61. sy keyword cscFunction contained ICHILDREN IANCESTORS IALLANCESTORS
  62. sy keyword cscFunction contained GROWTH GENMBRS GEN FACTORIAL DISCOUNT DESCENDANTS
  63. sy keyword cscFunction contained DECLINE CHILDREN CURRMBRRANGE CURLEV CURGEN
  64. sy keyword cscFunction contained COMPOUNDGROWTH COMPOUND AVGRANGE AVG ANCESTVAL
  65. sy keyword cscFunction contained ANCESTORS ALLANCESTORS ACCUM ABS
  66. sy keyword cscFunction contained @VARPER @VAR @UDA @TRUNCATE @SYD @SUMRANGE @SUM
  67. sy keyword cscFunction contained @STDDEVRANGE @STDDEV @SPARENTVAL @SLN @SIBLINGS @SHIFT
  68. sy keyword cscFunction contained @SANCESTVAL @RSIBLINGS @ROUND @REMAINDER @RELATIVE @PTD
  69. sy keyword cscFunction contained @PRIOR @POWER @PARENTVAL @NPV @NEXT @MOD @MINRANGE @MIN
  70. sy keyword cscFunction contained @MDSHIFT @MDPARENTVAL @MDANCESTVAL @MAXRANGE @MAX @MATCH
  71. sy keyword cscFunction contained @LSIBLINGS @LEVMBRS @LEV
  72. sy keyword cscFunction contained @ISUDA @ISSIBLING @ISSAMELEV @ISSAMEGEN @ISPARENT @ISMBR
  73. sy keyword cscFunction contained @ISLEV @ISISIBLING @ISIPARENT @ISIDESC @ISICHILD @ISIBLINGS
  74. sy keyword cscFunction contained @ISIANCEST @ISGEN @ISDESC @ISCHILD @ISANCEST @ISACCTYPE
  75. sy keyword cscFunction contained @IRSIBLINGS @IRR @INTEREST @INT @ILSIBLINGS @IDESCENDANTS
  76. sy keyword cscFunction contained @ICHILDREN @IANCESTORS @IALLANCESTORS
  77. sy keyword cscFunction contained @GROWTH @GENMBRS @GEN @FACTORIAL @DISCOUNT @DESCENDANTS
  78. sy keyword cscFunction contained @DECLINE @CHILDREN @CURRMBRRANGE @CURLEV @CURGEN
  79. sy keyword cscFunction contained @COMPOUNDGROWTH @COMPOUND @AVGRANGE @AVG @ANCESTVAL
  80. sy keyword cscFunction contained @ANCESTORS @ALLANCESTORS @ACCUM @ABS
  81. sy match cscFunction contained "@"
  82. sy match cscError "@\s*\a*" contains=cscFunction
  83. sy match cscStatement "&"
  84. sy keyword cscStatement AGG ARRAY VAR CCONV CLEARDATA DATACOPY
  85. sy match cscComE contained "^\s*CALC.*"
  86. sy match cscComE contained "^\s*CLEARBLOCK.*"
  87. sy match cscComE contained "^\s*SET.*"
  88. sy match cscComE contained "^\s*FIX"
  89. sy match cscComE contained "^\s*ENDFIX"
  90. sy match cscComE contained "^\s*ENDLOOP"
  91. sy match cscComE contained "^\s*LOOP"
  92. " sy keyword cscCom FIX ENDFIX LOOP ENDLOOP
  93. sy match cscComW "^\s*CALC.*"
  94. sy match cscCom "^\s*CALC\s*ALL"
  95. sy match cscCom "^\s*CALC\s*AVERAGE"
  96. sy match cscCom "^\s*CALC\s*DIM"
  97. sy match cscCom "^\s*CALC\s*FIRST"
  98. sy match cscCom "^\s*CALC\s*LAST"
  99. sy match cscCom "^\s*CALC\s*TWOPASS"
  100. sy match cscComW "^\s*CLEARBLOCK.*"
  101. sy match cscCom "^\s*CLEARBLOCK\s\+ALL"
  102. sy match cscCom "^\s*CLEARBLOCK\s\+UPPER"
  103. sy match cscCom "^\s*CLEARBLOCK\s\+NONINPUT"
  104. sy match cscComW "^\s*\<SET.*"
  105. sy match cscCom "^\s*\<SET\s\+Commands"
  106. sy match cscCom "^\s*\<SET\s\+AGGMISSG"
  107. sy match cscCom "^\s*\<SET\s\+CACHE"
  108. sy match cscCom "^\s*\<SET\s\+CALCHASHTBL"
  109. sy match cscCom "^\s*\<SET\s\+CLEARUPDATESTATUS"
  110. sy match cscCom "^\s*\<SET\s\+FRMLBOTTOMUP"
  111. sy match cscCom "^\s*\<SET\s\+LOCKBLOCK"
  112. sy match cscCom "^\s*\<SET\s\+MSG"
  113. sy match cscCom "^\s*\<SET\s\+NOTICE"
  114. sy match cscCom "^\s*\<SET\s\+UPDATECALC"
  115. sy match cscCom "^\s*\<SET\s\+UPTOLOCAL"
  116. sy keyword cscBPMacro contained !LoopOnAll !LoopOnLevel !LoopOnSelected
  117. sy keyword cscBPMacro contained !CurrentMember !LoopOnDimensions !CurrentDimension
  118. sy keyword cscBPMacro contained !CurrentOtherLoopDimension !LoopOnOtherLoopDimensions
  119. sy keyword cscBPMacro contained !EndLoop !AllMembers !SelectedMembers !If !Else !EndIf
  120. sy keyword cscBPMacro contained LoopOnAll LoopOnLevel LoopOnSelected
  121. sy keyword cscBPMacro contained CurrentMember LoopOnDimensions CurrentDimension
  122. sy keyword cscBPMacro contained CurrentOtherLoopDimension LoopOnOtherLoopDimensions
  123. sy keyword cscBPMacro contained EndLoop AllMembers SelectedMembers If Else EndIf
  124. sy match cscBPMacro contained "!"
  125. sy match cscBPW "!\s*\a*" contains=cscBPmacro
  126. " when wanted, highlighting lhs members or erros in asignments (may lag the editing)
  127. if exists("csc_asignment")
  128. sy match cscEqError '\("[^"]*"\s*\|[^][\t !%()*+,--/:;<=>{}~]\+\s*\|->\s*\)*=\([^=]\@=\|$\)'
  129. sy region cscFormula transparent matchgroup=cscVarName start='\("[^"]*"\|[^][\t !%()*+,--/:;<=>{}~]\+\)\s*=\([^=]\@=\|\n\)' skip='"[^"]*"' end=';' contains=ALLBUT,cscFormula,cscFormulaIn,cscBPMacro,cscCondition
  130. sy region cscFormulaIn matchgroup=cscVarName transparent start='\("[^"]*"\|[^][\t !%()*+,--/:;<=>{}~]\+\)\(->\("[^"]*"\|[^][\t !%()*+,--/:;<=>{}~]\+\)\)*\s*=\([^=]\@=\|$\)' skip='"[^"]*"' end=';' contains=ALLBUT,cscFormula,cscFormulaIn,cscBPMacro,cscCondition contained
  131. sy match cscEq "=="
  132. endif
  133. if !exists("csc_minlines")
  134. let csc_minlines = 50 " mostly for () constructs
  135. endif
  136. exec "sy sync ccomment cscComment minlines=" . csc_minlines
  137. " Define the default highlighting.
  138. " Only when an item doesn't have highlighting yet
  139. hi cscVarName term=bold ctermfg=9 gui=bold guifg=blue
  140. hi def link cscNumber Number
  141. hi def link cscOctal Number
  142. hi def link cscFloat Float
  143. hi def link cscParenE Error
  144. hi def link cscCommentE Error
  145. hi def link cscSpaceE Error
  146. hi def link cscError Error
  147. hi def link cscString String
  148. hi def link cscComment Comment
  149. hi def link cscTodo Todo
  150. hi def link cscStatement Statement
  151. hi def link cscIfError Error
  152. hi def link cscEqError Error
  153. hi def link cscFunction Statement
  154. hi def link cscCondition Statement
  155. hi def link cscWarn WarningMsg
  156. hi def link cscComE Error
  157. hi def link cscCom Statement
  158. hi def link cscComW WarningMsg
  159. hi def link cscBPMacro Identifier
  160. hi def link cscBPW WarningMsg
  161. let b:current_syntax = "csc"
  162. let &cpo = s:cpo_save
  163. unlet s:cpo_save
  164. " vim: ts=8