blob: be529f2d85f7a02c47a86995e8a52ad8f45ab513 [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
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200151" The default methods for highlighting. Can be overridden later
Bram Moolenaar071d4272004-06-13 20:20:40 +0000152
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200153" 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000159
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200160" 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000169
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200170" Labels
171hi def link naturalLabel Label
172hi def link naturalRefLabel Label
Bram Moolenaar071d4272004-06-13 20:20:40 +0000173
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200174" Comments
175hi def link naturalPComment Comment
176hi def link naturalComment Comment
177hi def link naturalTodo Todo
178hi def link naturalCommentMark PreProc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000179
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200180hi 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
Bram Moolenaar071d4272004-06-13 20:20:40 +0000186
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200187" illegal things
188hi def link naturalRMKeyword Error
189hi def link naturalLegalIdent Error
Bram Moolenaar071d4272004-06-13 20:20:40 +0000190
Bram Moolenaarf37506f2016-08-31 22:22:10 +0200191hi def link naturalType Type
192hi def link naturalFunction Function
193hi def link naturalObjName PreProc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000194
Bram Moolenaar071d4272004-06-13 20:20:40 +0000195
196let b:current_syntax = "natural"
197
Bram Moolenaar5dc62522012-02-13 00:05:22 +0100198let &cpo = s:cpo_save
199unlet s:cpo_save
200
201" vim:set ts=8 sw=8 noet ft=vim list: