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