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