3 " Maintainer: Thomas Geulig <geulig@nentec.de>
4 " Last Change: 2001 May 2
5 " URL: http://sites.netscape.net/sharpPeople/vim/syntax/rexx.vim
6 " or http://www.crosswinds.net/~vimuser/vim/syntax/rexx.vim
8 " Special Thanks to Dan Sharp <dwsharp@hotmail.com> for comments and additions
9 " (and providing the webspace)
11 " For version 5.x: Clear all syntax items
12 " For version 6.x: Quit when a syntax file was already loaded
15 elseif exists("b:current_syntax")
21 " A Keyword is the first symbol in a clause. A clause begins at the start
22 " of a line or after a semicolon. THEN, ELSE, OTHERWISE, and colons are always
23 " followed by an implied semicolon.
24 syn match rexxClause "\(^\|;\|:\|then \|else \|otherwise \)\s*\w\+" contains=ALL
26 " Considered keywords when used together in a phrase and begin a clause
27 syn match rexxKeyword contained "\<signal\( on \(error\|failure\|halt\|notready\|novalue\|syntax\|lostdigits\)\(\s\+name\)\=\)\=\>"
28 syn match rexxKeyword contained "\<signal off \(error\|failure\|halt\|notready\|novalue\|syntax\|lostdigits\)\>"
29 syn match rexxKeyword contained "\<call off \(error\|failure\|halt\|notready\)\>"
30 syn match rexxKeyword contained "\<parse \(upper \)\=\(arg\|linein\|pull\|source\|var\|value\|version\)\>"
31 syn match rexxKeyword contained "\<numeric \(digits\|form \(scientific\|engineering\|value\)\|fuzz\)\>"
32 syn match rexxKeyword contained "\<\(address\|trace\)\( value\)\=\>"
33 syn match rexxKeyword contained "\<procedure\( expose\)\=\>"
34 syn match rexxKeyword contained "\<do\( forever\)\=\>"
36 " Another keyword phrase, separated to aid highlighting in rexxFunction
37 syn match rexxKeyword2 contained "\<call\( on \(error\|failure\|halt\|notready\)\(\s\+name\)\=\)\=\>"
39 " Considered keywords when they begin a clause
40 syn match rexxKeyword contained "\<\(arg\|drop\|end\|exit\|if\|interpret\|iterate\|leave\|nop\)\>"
41 syn match rexxKeyword contained "\<\(options\|pull\|push\|queue\|return\|say\|select\|trace\)\>"
44 syn match rexxConditional "\(^\s*\| \)\(to\|by\|for\|until\|while\|then\|when\|otherwise\|else\)\( \|\s*$\)" contains=ALLBUT,rexxConditional
45 syn match rexxConditional contained "\<\(to\|by\|for\|until\|while\|then\|when\|else\|otherwise\)\>"
47 " Assignments -- a keyword followed by an equal sign becomes a variable
48 syn match rexxAssign "\<\w\+\s*=\s*" contains=rexxSpecialVariable
50 " Functions/Procedures
51 syn match rexxFunction "\<\h\w*\(/\*\s*\*/\)*("me=e-1 contains=rexxComment,rexxConditional,rexxKeyword
52 syn match rexxFunction "\<\(arg\|trace\)\(/\*\s*\*/\)*("me=e-1
53 syn match rexxFunction "\<call\( on \(error\|failure\|halt\|notready\)\(\s\+name\)\=\)\=\>\s\+\w\+\>" contains=rexxKeyword2
56 syn region rexxString start=+"+ skip=+\\\\\|\\'+ end=+"+
57 syn region rexxString start=+'+ skip=+\\\\\|\\"+ end=+'+
58 syn match rexxCharacter +"'[^\\]'"+
60 " Catch errors caused by wrong parenthesis
61 syn region rexxParen transparent start='(' end=')' contains=ALLBUT,rexxParenError,rexxTodo,rexxUserLabel,rexxKeyword
62 syn match rexxParenError ")"
63 syn match rexxInParen "[\\[\\]{}]"
66 syn region rexxComment start="/\*" end="\*/" contains=rexxTodo,rexxComment
67 syn match rexxCommentError "\*/"
69 syn keyword rexxTodo contained TODO FIXME XXX
71 " Highlight User Labels
72 syn match rexxUserLabel "\<\I\i*\s*:"me=e-1
75 syn keyword rexxSpecialVariable sigl rc result
76 syn match rexxCompoundVariable "\<\w\+\.\w*\>"
78 if !exists("rexx_minlines")
79 let rexx_minlines = 10
81 exec "syn sync ccomment rexxComment minlines=" . rexx_minlines
83 " Define the default highlighting.
84 " For version 5.7 and earlier: only when not done already
85 " For version 5.8 and later: only when an item doesn't have highlighting yet
86 if version >= 508 || !exists("did_rexx_syn_inits")
88 let did_rexx_syn_inits = 1
89 command -nargs=+ HiLink hi link <args>
91 command -nargs=+ HiLink hi def link <args>
94 HiLink rexxUserLabel Function
95 HiLink rexxCharacter Character
96 HiLink rexxParenError rexxError
97 HiLink rexxInParen rexxError
98 HiLink rexxCommentError rexxError
99 HiLink rexxError Error
100 HiLink rexxKeyword Statement
101 HiLink rexxKeyword2 rexxKeyword
102 HiLink rexxFunction Function
103 HiLink rexxString String
104 HiLink rexxComment Comment
106 HiLink rexxSpecialVariable Special
107 HiLink rexxConditional rexxKeyword
112 let b:current_syntax = "rexx"