blob: c94231d9f2e896576e40715d4411f5c21bc6e293 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2"
Bram Moolenaare37d50a2008-08-06 17:06:04 +00003" Language: NATURAL
Bram Moolenaar5dc62522012-02-13 00:05:22 +01004" Version: 2.1.0.5
Bram Moolenaare37d50a2008-08-06 17:06:04 +00005" Maintainer: Marko von Oppen <marko@von-oppen.com>
Bram Moolenaar5dc62522012-02-13 00:05:22 +01006" Last Changed: 2012-02-05 18:50:43
Bram Moolenaare37d50a2008-08-06 17:06:04 +00007" Support: http://www.von-oppen.com/
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02009" quit when a syntax file was already loaded
10if exists("b:current_syntax")
Bram Moolenaare37d50a2008-08-06 17:06:04 +000011 finish
Bram Moolenaar071d4272004-06-13 20:20:40 +000012endif
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020013setlocal iskeyword+=-,*,#,+,_,/
Bram Moolenaar071d4272004-06-13 20:20:40 +000014
Bram Moolenaar5dc62522012-02-13 00:05:22 +010015let s:cpo_save = &cpo
16set cpo&vim
17
Bram Moolenaar071d4272004-06-13 20:20:40 +000018" NATURAL is case insensitive
19syntax case ignore
20
21" preprocessor
Bram Moolenaare37d50a2008-08-06 17:06:04 +000022syn keyword naturalInclude include nextgroup=naturalObjName skipwhite
Bram Moolenaar071d4272004-06-13 20:20:40 +000023
24" define data
Bram Moolenaare37d50a2008-08-06 17:06:04 +000025syn keyword naturalKeyword define data end-define
26syn keyword naturalKeyword independent global parameter local redefine view
27syn keyword naturalKeyword const[ant] init initial
Bram Moolenaar071d4272004-06-13 20:20:40 +000028
29" loops
Bram Moolenaare37d50a2008-08-06 17:06:04 +000030syn 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000039
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
Bram Moolenaare37d50a2008-08-06 17:06:04 +000045syn 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000050
51" program flow
Bram Moolenaare37d50a2008-08-06 17:06:04 +000052syn keyword naturalFlow callnat fetch return enter escape bottom top stack formatted
53syn keyword naturalFlow command call
54syn keyword naturalflow end-subroutine routine
Bram Moolenaar071d4272004-06-13 20:20:40 +000055
56" file operations
Bram Moolenaare37d50a2008-08-06 17:06:04 +000057syn keyword naturalKeyword update store get delete end transaction work once close
Bram Moolenaar071d4272004-06-13 20:20:40 +000058
59" other keywords
Bram Moolenaare37d50a2008-08-06 17:06:04 +000060syn keyword naturalKeyword first every of no record[s] found ignore immediate
61syn keyword naturalKeyword set settime key control stop terminate
Bram Moolenaar071d4272004-06-13 20:20:40 +000062
63" in-/output
Bram Moolenaare37d50a2008-08-06 17:06:04 +000064syn 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000067
68" functions
Bram Moolenaare37d50a2008-08-06 17:06:04 +000069syn keyword naturalKeyword abs atn cos exp frac int log sgn sin sqrt tan val old
70syn keyword naturalKeyword pos
Bram Moolenaar071d4272004-06-13 20:20:40 +000071
72" report mode keywords
73syn keyword naturalRMKeyword same loop obtain indexed do doend
74
75" Subroutine name
Bram Moolenaare37d50a2008-08-06 17:06:04 +000076syn keyword naturalFlow perform subroutine nextgroup=naturalFunction skipwhite
77syn match naturalFunction "\<[a-z][-_a-z0-9]*\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000078
Bram Moolenaare37d50a2008-08-06 17:06:04 +000079syn keyword naturalFlow using nextgroup=naturalKeyword,naturalObjName skipwhite
80syn match naturalObjName "\<[a-z][-_a-z0-9]\{,7}\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000081
82" Labels
Bram Moolenaare37d50a2008-08-06 17:06:04 +000083syn 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]*\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000089
90" System variables
Bram Moolenaare37d50a2008-08-06 17:06:04 +000091syn match naturalSysVar "\<\*[a-z][-a-z0-9]*\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000092
93"integer number, or floating point number without a dot.
Bram Moolenaare37d50a2008-08-06 17:06:04 +000094syn match naturalNumber "\<-\=\d\+\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000095"floating point number, with dot
Bram Moolenaare37d50a2008-08-06 17:06:04 +000096syn match naturalNumber "\<-\=\d\+\.\d\+\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +000097"floating point number, starting with a dot
Bram Moolenaare37d50a2008-08-06 17:06:04 +000098syn match naturalNumber "\.\d\+"
Bram Moolenaar071d4272004-06-13 20:20:40 +000099
100" Formats in write statement
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000101syn match naturalFormat "\<\d\+[TX]\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000102
103" String and Character contstants
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000104syn match naturalString "H'\x\+'"
105syn region naturalString start=+"+ end=+"+
106syn region naturalString start=+'+ end=+'+
Bram Moolenaar071d4272004-06-13 20:20:40 +0000107
108" Type definition
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000109syn match naturalAttribute "\<[-a-z][a-z]=[-a-z0-9_\.,]\+\>"
110syn match naturalType contained "\<[ABINP]\d\+\(,\d\+\)\=\>"
111syn match naturalType contained "\<[CL]\>"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000112
113" "TODO" / other comments
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000114syn keyword naturalTodo contained todo test
115syn match naturalCommentMark contained "[a-z][^ \t/:|]*\(\s[^ \t/:'"|]\+\)*:\s"he=e-1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000116
117" comments
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000118syn 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000123" /* is legal syntax in parentheses e.g. "#ident(label./*)"
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000124syn region naturalPComment contained start="/\*\s*[^),]" end="$" contains=naturalTodo,naturalLineRef,naturalCommentMark
Bram Moolenaar071d4272004-06-13 20:20:40 +0000125
126" operators
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000127syn keyword naturalOperator and or not eq ne gt lt ge le mask scan modified
Bram Moolenaar071d4272004-06-13 20:20:40 +0000128
129" constants
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000130syn keyword naturalBoolean true false
131syn match naturalLineNo "^\d\{4}"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000132
133" identifiers
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000134syn 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]*"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000137
138" parentheses
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000139syn region naturalPar matchgroup=naturalParGui start="(" end=")" contains=naturalLabel,naturalRef,naturalOperator,@naturalConstant,naturalType,naturalSysVar,naturalPar,naturalLineNo,naturalPComment
140syn match naturalLineRef "(\d\{4})"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000141
142" build syntax groups
143syntax cluster naturalConstant contains=naturalString,naturalNumber,naturalAttribute,naturalBoolean
144
145" folding
146if v:version >= 600
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000147 set foldignore=*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000148endif
149
150
151if v:version >= 508 || !exists("did_natural_syntax_inits")
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000152 if v:version < 508
153 let did_natural_syntax_inits = 1
154 command -nargs=+ HiLink hi link <args>
155 else
156 command -nargs=+ HiLink hi def link <args>
157 endif
158 " The default methods for highlighting. Can be overridden later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000160 " Constants
161 HiLink naturalFormat Constant
162 HiLink naturalAttribute Constant
163 HiLink naturalNumber Number
164 HiLink naturalString String
165 HiLink naturalBoolean Boolean
Bram Moolenaar071d4272004-06-13 20:20:40 +0000166
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000167 " All kinds of keywords
168 HiLink naturalConditional Conditional
169 HiLink naturalRepeat Repeat
170 HiLink naturalLoop Repeat
171 HiLink naturalFlow Keyword
172 HiLink naturalError Keyword
173 HiLink naturalKeyword Keyword
174 HiLink naturalOperator Operator
175 HiLink naturalParGui Operator
Bram Moolenaar071d4272004-06-13 20:20:40 +0000176
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000177 " Labels
178 HiLink naturalLabel Label
179 HiLink naturalRefLabel Label
Bram Moolenaar071d4272004-06-13 20:20:40 +0000180
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000181 " Comments
182 HiLink naturalPComment Comment
183 HiLink naturalComment Comment
184 HiLink naturalTodo Todo
185 HiLink naturalCommentMark PreProc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000186
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000187 HiLink naturalInclude Include
188 HiLink naturalSysVar Identifier
189 HiLink naturalLineNo LineNr
190 HiLink naturalLineRef Error
191 HiLink naturalSpecial Special
192 HiLink naturalComKey Todo
Bram Moolenaar071d4272004-06-13 20:20:40 +0000193
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000194 " illegal things
195 HiLink naturalRMKeyword Error
196 HiLink naturalLegalIdent Error
Bram Moolenaar071d4272004-06-13 20:20:40 +0000197
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000198 HiLink naturalType Type
199 HiLink naturalFunction Function
200 HiLink naturalObjName PreProc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000201
Bram Moolenaare37d50a2008-08-06 17:06:04 +0000202 delcommand HiLink
Bram Moolenaar071d4272004-06-13 20:20:40 +0000203endif
204
205let b:current_syntax = "natural"
206
Bram Moolenaar5dc62522012-02-13 00:05:22 +0100207let &cpo = s:cpo_save
208unlet s:cpo_save
209
210" vim:set ts=8 sw=8 noet ft=vim list: