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