7
|
1 " Vim syntax file
|
|
2 "
|
1698
|
3 " Language: NATURAL
|
|
4 " Version: 2.1.0.3
|
|
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/
|
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
|
|
20 " NATURAL is case insensitive
|
|
21 syntax case ignore
|
|
22
|
|
23 " preprocessor
|
1698
|
24 syn keyword naturalInclude include nextgroup=naturalObjName skipwhite
|
7
|
25
|
|
26 " define data
|
1698
|
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
|
7
|
30
|
|
31 " loops
|
1698
|
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
|
7
|
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
|
1698
|
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
|
7
|
52
|
|
53 " program flow
|
1698
|
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
|
7
|
57
|
|
58 " file operations
|
1698
|
59 syn keyword naturalKeyword update store get delete end transaction work once close
|
7
|
60
|
|
61 " other keywords
|
1698
|
62 syn keyword naturalKeyword first every of no record[s] found ignore immediate
|
|
63 syn keyword naturalKeyword set settime key control stop terminate
|
7
|
64
|
|
65 " in-/output
|
1698
|
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
|
7
|
69
|
|
70 " functions
|
1698
|
71 syn keyword naturalKeyword abs atn cos exp frac int log sgn sin sqrt tan val old
|
|
72 syn keyword naturalKeyword pos
|
7
|
73
|
|
74 " report mode keywords
|
|
75 syn keyword naturalRMKeyword same loop obtain indexed do doend
|
|
76
|
|
77 " Subroutine name
|
1698
|
78 syn keyword naturalFlow perform subroutine nextgroup=naturalFunction skipwhite
|
|
79 syn match naturalFunction "\<[a-z][-_a-z0-9]*\>"
|
7
|
80
|
1698
|
81 syn keyword naturalFlow using nextgroup=naturalKeyword,naturalObjName skipwhite
|
|
82 syn match naturalObjName "\<[a-z][-_a-z0-9]\{,7}\>"
|
7
|
83
|
|
84 " Labels
|
1698
|
85 syn match naturalLabel "\<[+#a-z][-_#a-z0-9]*\."
|
|
86 syn match naturalRef "\<[+#a-z][-_#a-z0-9]*\>\.\<[+#a-z][*]\=[-_#a-z0-9]*\>"
|
|
87
|
|
88 " mark keyword special handling
|
|
89 syn keyword naturalKeyword mark nextgroup=naturalMark skipwhite
|
|
90 syn match naturalMark "\<\*[a-z][-_#.a-z0-9]*\>"
|
7
|
91
|
|
92 " System variables
|
1698
|
93 syn match naturalSysVar "\<\*[a-z][-a-z0-9]*\>"
|
7
|
94
|
|
95 "integer number, or floating point number without a dot.
|
1698
|
96 syn match naturalNumber "\<-\=\d\+\>"
|
7
|
97 "floating point number, with dot
|
1698
|
98 syn match naturalNumber "\<-\=\d\+\.\d\+\>"
|
7
|
99 "floating point number, starting with a dot
|
1698
|
100 syn match naturalNumber "\.\d\+"
|
7
|
101
|
|
102 " Formats in write statement
|
1698
|
103 syn match naturalFormat "\<\d\+[TX]\>"
|
7
|
104
|
|
105 " String and Character contstants
|
1698
|
106 syn match naturalString "H'\x\+'"
|
|
107 syn region naturalString start=+"+ end=+"+
|
|
108 syn region naturalString start=+'+ end=+'+
|
7
|
109
|
|
110 " Type definition
|
1698
|
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]\>"
|
7
|
114
|
|
115 " "TODO" / other comments
|
1698
|
116 syn keyword naturalTodo contained todo test
|
|
117 syn match naturalCommentMark contained "[a-z][^ \t/:|]*\(\s[^ \t/:'"|]\+\)*:\s"he=e-1
|
7
|
118
|
|
119 " comments
|
1698
|
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
|
7
|
125 " /* is legal syntax in parentheses e.g. "#ident(label./*)"
|
1698
|
126 syn region naturalPComment contained start="/\*\s*[^),]" end="$" contains=naturalTodo,naturalLineRef,naturalCommentMark
|
7
|
127
|
|
128 " operators
|
1698
|
129 syn keyword naturalOperator and or not eq ne gt lt ge le mask scan modified
|
7
|
130
|
|
131 " constants
|
1698
|
132 syn keyword naturalBoolean true false
|
|
133 syn match naturalLineNo "^\d\{4}"
|
7
|
134
|
|
135 " identifiers
|
1698
|
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]*"
|
7
|
139
|
|
140 " parentheses
|
1698
|
141 syn region naturalPar matchgroup=naturalParGui start="(" end=")" contains=naturalLabel,naturalRef,naturalOperator,@naturalConstant,naturalType,naturalSysVar,naturalPar,naturalLineNo,naturalPComment
|
|
142 syn match naturalLineRef "(\d\{4})"
|
7
|
143
|
|
144 " build syntax groups
|
|
145 syntax cluster naturalConstant contains=naturalString,naturalNumber,naturalAttribute,naturalBoolean
|
|
146
|
|
147 " folding
|
|
148 if v:version >= 600
|
1698
|
149 set foldignore=*
|
7
|
150 endif
|
|
151
|
|
152
|
|
153 if v:version >= 508 || !exists("did_natural_syntax_inits")
|
1698
|
154 if v:version < 508
|
|
155 let did_natural_syntax_inits = 1
|
|
156 command -nargs=+ HiLink hi link <args>
|
|
157 else
|
|
158 command -nargs=+ HiLink hi def link <args>
|
|
159 endif
|
|
160 " The default methods for highlighting. Can be overridden later
|
7
|
161
|
1698
|
162 " Constants
|
|
163 HiLink naturalFormat Constant
|
|
164 HiLink naturalAttribute Constant
|
|
165 HiLink naturalNumber Number
|
|
166 HiLink naturalString String
|
|
167 HiLink naturalBoolean Boolean
|
7
|
168
|
1698
|
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
|
7
|
178
|
1698
|
179 " Labels
|
|
180 HiLink naturalLabel Label
|
|
181 HiLink naturalRefLabel Label
|
7
|
182
|
1698
|
183 " Comments
|
|
184 HiLink naturalPComment Comment
|
|
185 HiLink naturalComment Comment
|
|
186 HiLink naturalTodo Todo
|
|
187 HiLink naturalCommentMark PreProc
|
7
|
188
|
1698
|
189 HiLink naturalInclude Include
|
|
190 HiLink naturalSysVar Identifier
|
|
191 HiLink naturalLineNo LineNr
|
|
192 HiLink naturalLineRef Error
|
|
193 HiLink naturalSpecial Special
|
|
194 HiLink naturalComKey Todo
|
7
|
195
|
1698
|
196 " illegal things
|
|
197 HiLink naturalRMKeyword Error
|
|
198 HiLink naturalLegalIdent Error
|
7
|
199
|
1698
|
200 HiLink naturalType Type
|
|
201 HiLink naturalFunction Function
|
|
202 HiLink naturalObjName PreProc
|
7
|
203
|
1698
|
204 delcommand HiLink
|
7
|
205 endif
|
|
206
|
|
207 let b:current_syntax = "natural"
|
|
208
|
1698
|
209 " vim:set ts=8 sw=8 noet ft=vim:
|