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