5 " Maintainer: Marko von Oppen <marko@von-oppen.com>
6 " Last Changed: 2008-07-29 01:40:52
7 " Support: http://www.von-oppen.com/
9 " For version 5.x: Clear all syntax items
10 " For version 6.x: Quit when this syntax file was already loaded
13 set iskeyword+=-,*,#,+,_,/
14 elseif exists("b:current_syntax")
17 setlocal iskeyword+=-,*,#,+,_,/
20 " NATURAL is case insensitive
24 syn keyword naturalInclude include nextgroup=naturalObjName skipwhite
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
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
43 syn keyword naturalConditional if then else end-if end-norec
44 syn keyword naturalConditional decide end-decide value when condition none any
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 numeric
50 syn keyword naturalKeyword examine full replace giving separate delimiter modified
51 syn keyword naturalKeyword suspend identical suppress
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
59 syn keyword naturalKeyword update store get delete end transaction work once close
62 syn keyword naturalKeyword first every of no record[s] found ignore immediate
63 syn keyword naturalKeyword set settime key control stop terminate
66 syn keyword naturalKeyword write display input reinput notitle nohdr map newpage
67 syn keyword naturalKeyword alarm text help eject index window base size
68 syn keyword naturalKeyword format printer skip lines
71 syn keyword naturalKeyword abs atn cos exp frac int log sgn sin sqrt tan val old
72 syn keyword naturalKeyword pos
74 " report mode keywords
75 syn keyword naturalRMKeyword same loop obtain indexed do doend
78 syn keyword naturalFlow perform subroutine nextgroup=naturalFunction skipwhite
79 syn match naturalFunction "\<[a-z][-_a-z0-9]*\>"
81 syn keyword naturalFlow using nextgroup=naturalKeyword,naturalObjName skipwhite
82 syn match naturalObjName "\<[a-z][-_a-z0-9]\{,7}\>"
85 syn match naturalLabel "\<[+#a-z][-_#a-z0-9]*\."
86 syn match naturalRef "\<[+#a-z][-_#a-z0-9]*\>\.\<[+#a-z][*]\=[-_#a-z0-9]*\>"
88 " mark keyword special handling
89 syn keyword naturalKeyword mark nextgroup=naturalMark skipwhite
90 syn match naturalMark "\<\*[a-z][-_#.a-z0-9]*\>"
93 syn match naturalSysVar "\<\*[a-z][-a-z0-9]*\>"
95 "integer number, or floating point number without a dot.
96 syn match naturalNumber "\<-\=\d\+\>"
97 "floating point number, with dot
98 syn match naturalNumber "\<-\=\d\+\.\d\+\>"
99 "floating point number, starting with a dot
100 syn match naturalNumber "\.\d\+"
102 " Formats in write statement
103 syn match naturalFormat "\<\d\+[TX]\>"
105 " String and Character contstants
106 syn match naturalString "H'\x\+'"
107 syn region naturalString start=+"+ end=+"+
108 syn region naturalString start=+'+ end=+'+
111 syn match naturalAttribute "\<[-a-z][a-z]=[-a-z0-9_\.,]\+\>"
112 syn match naturalType contained "\<[ABINP]\d\+\(,\d\+\)\=\>"
113 syn match naturalType contained "\<[CL]\>"
115 " "TODO" / other comments
116 syn keyword naturalTodo contained todo test
117 syn match naturalCommentMark contained "[a-z][^ \t/:|]*\(\s[^ \t/:'"|]\+\)*:\s"he=e-1
120 syn region naturalComment start="/\*" end="$" contains=naturalTodo,naturalLineRef,naturalCommentMark
121 syn region naturalComment start="^\*[ *]" end="$" contains=naturalTodo,naturalLineRef,naturalCommentMark
122 syn region naturalComment start="^\d\{4} \*[\ \*]"lc=5 end="$" contains=naturalTodo,naturalLineRef,naturalCommentMark
123 syn match naturalComment "^\*$"
124 syn match naturalComment "^\d\{4} \*$"lc=5
125 " /* is legal syntax in parentheses e.g. "#ident(label./*)"
126 syn region naturalPComment contained start="/\*\s*[^),]" end="$" contains=naturalTodo,naturalLineRef,naturalCommentMark
129 syn keyword naturalOperator and or not eq ne gt lt ge le mask scan modified
132 syn keyword naturalBoolean true false
133 syn match naturalLineNo "^\d\{4}"
136 syn match naturalIdent "\<[+#a-z][-_#a-z0-9]*\>[^\.']"me=e-1
137 syn match naturalIdent "\<[+#a-z][-_#a-z0-9]*$"
138 syn match naturalLegalIdent "[+#a-z][-_#a-z0-9]*/[-_#a-z0-9]*"
141 syn region naturalPar matchgroup=naturalParGui start="(" end=")" contains=naturalLabel,naturalRef,naturalOperator,@naturalConstant,naturalType,naturalSysVar,naturalPar,naturalLineNo,naturalPComment
142 syn match naturalLineRef "(\d\{4})"
144 " build syntax groups
145 syntax cluster naturalConstant contains=naturalString,naturalNumber,naturalAttribute,naturalBoolean
153 if v:version >= 508 || !exists("did_natural_syntax_inits")
155 let did_natural_syntax_inits = 1
156 command -nargs=+ HiLink hi link <args>
158 command -nargs=+ HiLink hi def link <args>
160 " The default methods for highlighting. Can be overridden later
163 HiLink naturalFormat Constant
164 HiLink naturalAttribute Constant
165 HiLink naturalNumber Number
166 HiLink naturalString String
167 HiLink naturalBoolean Boolean
169 " All kinds of keywords
170 HiLink naturalConditional Conditional
171 HiLink naturalRepeat Repeat
172 HiLink naturalLoop Repeat
173 HiLink naturalFlow Keyword
174 HiLink naturalError Keyword
175 HiLink naturalKeyword Keyword
176 HiLink naturalOperator Operator
177 HiLink naturalParGui Operator
180 HiLink naturalLabel Label
181 HiLink naturalRefLabel Label
184 HiLink naturalPComment Comment
185 HiLink naturalComment Comment
186 HiLink naturalTodo Todo
187 HiLink naturalCommentMark PreProc
189 HiLink naturalInclude Include
190 HiLink naturalSysVar Identifier
191 HiLink naturalLineNo LineNr
192 HiLink naturalLineRef Error
193 HiLink naturalSpecial Special
194 HiLink naturalComKey Todo
197 HiLink naturalRMKeyword Error
198 HiLink naturalLegalIdent Error
200 HiLink naturalType Type
201 HiLink naturalFunction Function
202 HiLink naturalObjName PreProc
207 let b:current_syntax = "natural"
209 " vim:set ts=8 sw=8 noet ft=vim: