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