natural.vim 6.8 KB

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