Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " 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 |
| 12 | if version < 600 |
| 13 | syntax clear |
| 14 | elseif exists("b:current_syntax") |
| 15 | finish |
| 16 | endif |
| 17 | |
| 18 | syn 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. |
| 23 | syn match rexxClause "\(^\|;\|:\|then \|else \|otherwise \)\s*\w\+" contains=ALL |
| 24 | |
| 25 | " Considered keywords when used together in a phrase and begin a clause |
| 26 | syn match rexxKeyword contained "\<signal\( on \(error\|failure\|halt\|notready\|novalue\|syntax\|lostdigits\)\(\s\+name\)\=\)\=\>" |
| 27 | syn match rexxKeyword contained "\<signal off \(error\|failure\|halt\|notready\|novalue\|syntax\|lostdigits\)\>" |
| 28 | syn match rexxKeyword contained "\<call off \(error\|failure\|halt\|notready\)\>" |
| 29 | syn match rexxKeyword contained "\<parse \(upper \)\=\(arg\|linein\|pull\|source\|var\|value\|version\)\>" |
| 30 | syn match rexxKeyword contained "\<numeric \(digits\|form \(scientific\|engineering\|value\)\|fuzz\)\>" |
| 31 | syn match rexxKeyword contained "\<\(address\|trace\)\( value\)\=\>" |
| 32 | syn match rexxKeyword contained "\<procedure\( expose\)\=\>" |
| 33 | syn match rexxKeyword contained "\<do\( forever\)\=\>" |
| 34 | |
| 35 | " Another keyword phrase, separated to aid highlighting in rexxFunction |
| 36 | syn match rexxKeyword2 contained "\<call\( on \(error\|failure\|halt\|notready\)\(\s\+name\)\=\)\=\>" |
| 37 | |
| 38 | " Considered keywords when they begin a clause |
| 39 | syn match rexxKeyword contained "\<\(arg\|drop\|end\|exit\|if\|interpret\|iterate\|leave\|nop\)\>" |
| 40 | syn match rexxKeyword contained "\<\(options\|pull\|push\|queue\|return\|say\|select\|trace\)\>" |
| 41 | |
| 42 | " Conditional phrases |
| 43 | syn match rexxConditional "\(^\s*\| \)\(to\|by\|for\|until\|while\|then\|when\|otherwise\|else\)\( \|\s*$\)" contains=ALLBUT,rexxConditional |
| 44 | syn 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 |
| 47 | syn match rexxAssign "\<\w\+\s*=\s*" contains=rexxSpecialVariable |
| 48 | |
| 49 | " Functions/Procedures |
| 50 | syn match rexxFunction "\<\h\w*\(/\*\s*\*/\)*("me=e-1 contains=rexxComment,rexxConditional,rexxKeyword |
| 51 | syn match rexxFunction "\<\(arg\|trace\)\(/\*\s*\*/\)*("me=e-1 |
| 52 | syn match rexxFunction "\<call\( on \(error\|failure\|halt\|notready\)\(\s\+name\)\=\)\=\>\s\+\w\+\>" contains=rexxKeyword2 |
| 53 | |
| 54 | " String constants |
| 55 | syn region rexxString start=+"+ skip=+\\\\\|\\'+ end=+"+ |
| 56 | syn region rexxString start=+'+ skip=+\\\\\|\\"+ end=+'+ |
| 57 | syn match rexxCharacter +"'[^\\]'"+ |
| 58 | |
| 59 | " Catch errors caused by wrong parenthesis |
| 60 | syn region rexxParen transparent start='(' end=')' contains=ALLBUT,rexxParenError,rexxTodo,rexxUserLabel,rexxKeyword |
| 61 | syn match rexxParenError ")" |
| 62 | syn match rexxInParen "[\\[\\]{}]" |
| 63 | |
| 64 | " Comments |
| 65 | syn region rexxComment start="/\*" end="\*/" contains=rexxTodo,rexxComment |
| 66 | syn match rexxCommentError "\*/" |
| 67 | |
| 68 | syn keyword rexxTodo contained TODO FIXME XXX |
| 69 | |
| 70 | " Highlight User Labels |
| 71 | syn match rexxUserLabel "\<\I\i*\s*:"me=e-1 |
| 72 | |
| 73 | " Special Variables |
| 74 | syn keyword rexxSpecialVariable sigl rc result |
| 75 | syn match rexxCompoundVariable "\<\w\+\.\w*\>" |
| 76 | |
| 77 | if !exists("rexx_minlines") |
| 78 | let rexx_minlines = 10 |
| 79 | endif |
| 80 | exec "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 |
| 85 | if 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 |
| 109 | endif |
| 110 | |
| 111 | let b:current_syntax = "rexx" |
| 112 | |
| 113 | "vim: ts=8 |