blob: 8d67334aaef12594e2d8eb8f93e9275b2a19ddbf [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>
4" Last change: 2001 Sep 25
5
6" For version 5.x: Clear all syntax items
7" For version 6.x: Quit when a syntax file was already loaded
8if version < 600
9 syntax clear
10elseif exists("b:current_syntax")
11 finish
12endif
13
14" 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
144" when wanted, highlighting lhs members or erros in asignments (may lag the editing)
145if version >= 600 && exists("csc_asignment")
146 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.
158" For version 5.7 and earlier: only when not done already
159" For version 5.8 and later: only when an item doesn't have highlighting yet
160if version >= 508 || !exists("did_csc_syntax_inits")
161 if version < 508
162 let did_csc_syntax_inits = 1
163 command -nargs=+ HiLink hi link <args>
164 else
165 command -nargs=+ HiLink hi def link <args>
166 endif
167
168 hi cscVarName term=bold ctermfg=9 gui=bold guifg=blue
169
170 HiLink cscNumber Number
171 HiLink cscOctal Number
172 HiLink cscFloat Float
173 HiLink cscParenE Error
174 HiLink cscCommentE Error
175 HiLink cscSpaceE Error
176 HiLink cscError Error
177 HiLink cscString String
178 HiLink cscComment Comment
179 HiLink cscTodo Todo
180 HiLink cscStatement Statement
181 HiLink cscIfError Error
182 HiLink cscEqError Error
183 HiLink cscFunction Statement
184 HiLink cscCondition Statement
185 HiLink cscWarn WarningMsg
186
187 HiLink cscComE Error
188 HiLink cscCom Statement
189 HiLink cscComW WarningMsg
190
191 HiLink cscBPMacro Identifier
192 HiLink cscBPW WarningMsg
193
194 delcommand HiLink
195endif
196
197let b:current_syntax = "csc"
198
199" vim: ts=8