Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " |
| 3 | " Language: NATURAL |
| 4 | " Version: 2.0.26.17 |
| 5 | " Maintainer: Marko Leipert <vim@mleipert.de> |
| 6 | " Last Changed: 2002-02-28 09:50:36 |
| 7 | " Support: http://www.winconsole.de/vim/syntax.html |
| 8 | |
| 9 | " For version 5.x: Clear all syntax items |
| 10 | " For version 6.x: Quit when this syntax file was already loaded |
| 11 | if v:version < 600 |
| 12 | syntax clear |
| 13 | set iskeyword+=-,*,#,+,_,/ |
| 14 | elseif exists("b:current_syntax") |
| 15 | finish |
| 16 | else |
| 17 | setlocal iskeyword+=-,*,#,+,_,/ |
| 18 | endif |
| 19 | |
| 20 | " NATURAL is case insensitive |
| 21 | syntax case ignore |
| 22 | |
| 23 | " preprocessor |
| 24 | syn keyword naturalInclude include nextgroup=naturalObjName skipwhite |
| 25 | |
| 26 | " define data |
| 27 | syn keyword naturalKeyword define data end-define |
| 28 | syn keyword naturalKeyword independent global parameter local redefine view |
| 29 | syn keyword naturalKeyword const[ant] init initial |
| 30 | |
| 31 | " loops |
| 32 | syn keyword naturalLoop read end-read end-work find end-find histogram end-histogram |
| 33 | syn keyword naturalLoop end-all sort end-sort sorted descending ascending |
| 34 | syn keyword naturalRepeat repeat end-repeat while until for step end-for |
| 35 | syn keyword naturalKeyword in file with field starting from ending at thru by isn where |
| 36 | syn keyword naturalError on error end-error |
| 37 | syn keyword naturalKeyword accept reject end-enddata number unique retain as release |
| 38 | syn keyword naturalKeyword start end-start break end-break physical page top sequence |
| 39 | syn keyword naturalKeyword end-toppage end-endpage end-endfile before processing |
| 40 | syn keyword naturalKeyword end-before |
| 41 | |
| 42 | " conditionals |
| 43 | syn keyword naturalConditional if then else end-if end-norec |
| 44 | syn keyword naturalConditional decide end-decide value when condition none any |
| 45 | |
| 46 | " assignment / calculation |
| 47 | syn keyword naturalKeyword reset assign move left right justified compress to into edited |
| 48 | syn keyword naturalKeyword add subtract multiply divide compute name |
| 49 | syn keyword naturalKeyword all giving remainder rounded leaving space |
| 50 | syn keyword naturalKeyword examine full replace giving separate delimiter modified |
| 51 | syn keyword naturalKeyword suspend identical suppress |
| 52 | |
| 53 | " program flow |
| 54 | syn keyword naturalFlow callnat fetch return enter escape bottom top stack formatted |
| 55 | syn keyword naturalFlow command call |
| 56 | syn keyword naturalflow end-subroutine routine |
| 57 | |
| 58 | " file operations |
| 59 | syn keyword naturalKeyword update store get delete end transaction work once close |
| 60 | |
| 61 | " other keywords |
| 62 | syn keyword naturalKeyword first every of no record[s] found ignore immediate |
| 63 | syn keyword naturalKeyword set settime key control stop terminate |
| 64 | |
| 65 | " in-/output |
| 66 | syn keyword naturalKeyword write display input reinput notitle nohdr map newpage mark |
| 67 | syn keyword naturalKeyword alarm text help eject index |
| 68 | syn keyword naturalKeyword format printer skip lines |
| 69 | |
| 70 | " functions |
| 71 | syn keyword naturalKeyword abs atn cos exp frac int log sgn sin sqrt tan val old |
| 72 | |
| 73 | " report mode keywords |
| 74 | syn keyword naturalRMKeyword same loop obtain indexed do doend |
| 75 | |
| 76 | " Subroutine name |
| 77 | syn keyword naturalFlow perform subroutine nextgroup=naturalFunction skipwhite |
| 78 | syn match naturalFunction "\<[a-z][-_a-z0-9]*\>" |
| 79 | |
| 80 | syn keyword naturalFlow using nextgroup=naturalKeyword,naturalObjName skipwhite |
| 81 | syn match naturalObjName "\<[a-z][-_a-z0-9]\{,7}\>" |
| 82 | |
| 83 | " Labels |
| 84 | syn match naturalLabel "\<[+#a-z][-_#a-z0-9]*\." |
| 85 | syn match naturalRef "\<[+#a-z][-_#a-z0-9]*\>\.\<[+#a-z][*]\=[-_#a-z0-9]*\>" |
| 86 | |
| 87 | " System variables |
| 88 | syn match naturalSysVar "\<\*[a-z][-a-z0-9]*\>" |
| 89 | |
| 90 | "integer number, or floating point number without a dot. |
| 91 | syn match naturalNumber "\<-\=\d\+\>" |
| 92 | "floating point number, with dot |
| 93 | syn match naturalNumber "\<-\=\d\+\.\d\+\>" |
| 94 | "floating point number, starting with a dot |
| 95 | syn match naturalNumber "\.\d\+" |
| 96 | |
| 97 | " Formats in write statement |
| 98 | syn match naturalFormat "\<\d\+[TX]\>" |
| 99 | |
| 100 | " String and Character contstants |
| 101 | syn match naturalString "H'\x\+'" |
| 102 | syn region naturalString start=+"+ end=+"+ |
| 103 | syn region naturalString start=+'+ end=+'+ |
| 104 | |
| 105 | " Type definition |
| 106 | syn match naturalAttribute "\<[-a-z][a-z]=[-a-z0-9_\.,]\+\>" |
| 107 | syn match naturalType contained "\<[ABINP]\d\+\(,\d\+\)\=\>" |
| 108 | syn match naturalType contained "\<[CL]\>" |
| 109 | |
| 110 | " "TODO" / other comments |
| 111 | syn keyword naturalTodo contained todo test |
| 112 | syn match naturalCommentMark contained "[a-z][^ \t/:|]*\(\s[^ \t/:'"|]\+\)*:\s"he=e-1 |
| 113 | |
| 114 | " comments |
| 115 | syn region naturalComment start="/\*" end="$" contains=naturalTodo,naturalLineRef,naturalCommentMark |
| 116 | syn region naturalComment start="^\*[\ \*]" end="$" contains=naturalTodo,naturalLineRef,naturalCommentMark |
| 117 | syn region naturalComment start="^\d\{4} \*[\ \*]"lc=5 end="$" contains=naturalTodo,naturalLineRef,naturalCommentMark |
| 118 | syn match naturalComment "^*$" |
| 119 | syn match naturalComment "^\d\{4} \*$"lc=5 |
| 120 | " /* is legal syntax in parentheses e.g. "#ident(label./*)" |
| 121 | syn region naturalPComment contained start="/\*\s*[^),]" end="$" contains=naturalTodo,naturalLineRef,naturalCommentMark |
| 122 | |
| 123 | " operators |
| 124 | syn keyword naturalOperator and or not eq ne gt lt ge le mask scan |
| 125 | |
| 126 | " constants |
| 127 | syn keyword naturalBoolean true false |
| 128 | |
| 129 | syn match naturalLineNo "^\d\{4}" |
| 130 | |
| 131 | " identifiers |
| 132 | syn match naturalIdent "\<[+#a-z][-_#a-z0-9]*\>[^\.']"me=e-1 |
| 133 | syn match naturalIdent "\<[+#a-z][-_#a-z0-9]*$" |
| 134 | syn match naturalLegalIdent "[+#a-z][-_#a-z0-9]*/[-_#a-z0-9]*" |
| 135 | |
| 136 | " parentheses |
| 137 | syn region naturalPar matchgroup=naturalParGui start="(" end=")" contains=naturalLabel,naturalRef,naturalOperator,@naturalConstant,naturalType,naturalSysVar,naturalPar,naturalLineNo,naturalPComment |
| 138 | syn match naturalLineRef "(\d\{4})" |
| 139 | |
| 140 | " build syntax groups |
| 141 | syntax cluster naturalConstant contains=naturalString,naturalNumber,naturalAttribute,naturalBoolean |
| 142 | |
| 143 | " folding |
| 144 | if v:version >= 600 |
| 145 | set foldignore=* |
| 146 | endif |
| 147 | |
| 148 | |
| 149 | if v:version >= 508 || !exists("did_natural_syntax_inits") |
| 150 | if v:version < 508 |
| 151 | let did_natural_syntax_inits = 1 |
| 152 | command -nargs=+ HiLink hi link <args> |
| 153 | else |
| 154 | command -nargs=+ HiLink hi def link <args> |
| 155 | endif |
| 156 | " The default methods for highlighting. Can be overridden later |
| 157 | |
| 158 | " Constants |
| 159 | HiLink naturalFormat Constant |
| 160 | HiLink naturalAttribute Constant |
| 161 | HiLink naturalNumber Number |
| 162 | HiLink naturalString String |
| 163 | HiLink naturalBoolean Boolean |
| 164 | |
| 165 | " All kinds of keywords |
| 166 | HiLink naturalConditional Conditional |
| 167 | HiLink naturalRepeat Repeat |
| 168 | HiLink naturalLoop Repeat |
| 169 | HiLink naturalFlow Keyword |
| 170 | HiLink naturalError Keyword |
| 171 | HiLink naturalKeyword Keyword |
| 172 | HiLink naturalOperator Operator |
| 173 | HiLink naturalParGui Operator |
| 174 | |
| 175 | " Labels |
| 176 | HiLink naturalLabel Label |
| 177 | HiLink naturalRefLabel Label |
| 178 | |
| 179 | " Comments |
| 180 | HiLink naturalPComment Comment |
| 181 | HiLink naturalComment Comment |
| 182 | HiLink naturalTodo Todo |
| 183 | HiLink naturalCommentMark PreProc |
| 184 | |
| 185 | HiLink naturalInclude Include |
| 186 | HiLink naturalSysVar Identifier |
| 187 | HiLink naturalLineNo LineNr |
| 188 | HiLink naturalLineRef Error |
| 189 | HiLink naturalSpecial Special |
| 190 | HiLink naturalComKey Todo |
| 191 | |
| 192 | " illegal things |
| 193 | HiLink naturalRMKeyword Error |
| 194 | HiLink naturalLegalIdent Error |
| 195 | |
| 196 | HiLink naturalType Type |
| 197 | HiLink naturalFunction Function |
| 198 | HiLink naturalObjName Function |
| 199 | |
| 200 | delcommand HiLink |
| 201 | endif |
| 202 | |
| 203 | let b:current_syntax = "natural" |
| 204 | |
| 205 | " vim:set ts=4 sw=4 noet ft=vim list: |