home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / runtime / dos / syntax / natural.vim < prev    next >
Encoding:
Text File  |  2012-05-31  |  7.3 KB  |  216 lines

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