neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

natural.vim (6977B)


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