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