3 " Maintainer: Rafal Sulejman <rms@poczta.onet.pl>
4 " Site: http://rms.republika.pl/vim/syntax/snobol4.vim
5 " Last change: 2006 may 1
7 " - nonexistent Snobol4 keywords displayed as errors.
9 " For version 5.x: Clear all syntax items
10 " For version 6.x: Quit when a syntax file was already loaded
13 elseif exists("b:current_syntax")
18 " Vanilla Snobol4 keywords
19 syn keyword snobol4Keyword any apply arb arbno arg array
20 syn keyword snobol4Keyword break
21 syn keyword snobol4Keyword char clear code collect convert copy
22 syn keyword snobol4Keyword data datatype date define detach differ dump dupl
23 syn keyword snobol4Keyword endfile eq eval
24 syn keyword snobol4Keyword field
25 syn keyword snobol4Keyword ge gt ident
26 syn keyword snobol4Keyword input integer item
27 syn keyword snobol4Keyword le len lgt local lpad lt
28 syn keyword snobol4Keyword ne notany
29 syn keyword snobol4Keyword opsyn output
30 syn keyword snobol4Keyword pos prototype
31 syn keyword snobol4Keyword remdr replace rpad rpos rtab
32 syn keyword snobol4Keyword size span stoptr
33 syn keyword snobol4Keyword tab table time trace trim terminal
34 syn keyword snobol4Keyword unload
35 syn keyword snobol4Keyword value
38 syn keyword snobol4Keyword sset
40 syn region snobol4String matchgroup=Quote start=+"+ skip=+\\"+ end=+"+
41 syn region snobol4String matchgroup=Quote start=+'+ skip=+\\'+ end=+'+
42 syn match snobol4Statement "^-[^ ][^ ]*"
43 syn match snobol4Comment "^\*.*$"
44 syn match snobol4Comment ";\*.*$"
45 syn match snobol4Constant "[^a-z]\.[a-z][a-z0-9\-]*"
46 syn region snobol4Goto start=":[sf]\{0,1}(" end=")\|$\|;" contains=ALLBUT,snobol4ParenError
47 syn match snobol4Number "\<\d*\(\.\d\d*\)*\>"
48 syn match snobol4BogusSysVar "&\w\{1,}"
49 syn match snobol4SysVar "&\(abort\|alphabet\|anchor\|arb\|bal\|case\|code\|dump\|errlimit\|errtext\|errtype\|fail\|fence\|fnclevel\|ftrace\|fullscan\|input\|lastno\|lcase\|maxlngth\|output\|parm\|rem\|rtntype\|stcount\|stfcount\|stlimit\|stno\|succeed\|trace\|trim\|ucase\)"
50 syn match snobol4Label "^[^-\.\+ \t]\S\{1,}"
53 syn cluster snobol4ParenGroup contains=snobol4ParenError
54 syn region snobol4Paren transparent start='(' end=')' contains=ALLBUT,@snobol4ParenGroup,snobol4ErrInBracket
55 syn match snobol4ParenError display "[\])]"
56 syn match snobol4ErrInParen display contained "[\]{}]\|<%\|%>"
57 syn region snobol4Bracket transparent start='\[\|<:' end=']\|:>' contains=ALLBUT,@snobol4ParenGroup,snobol4ErrInParen
58 syn match snobol4ErrInBracket display contained "[){}]\|<%\|%>"
60 " optional shell shebang line
61 syn match snobol4Comment "^\#\!.*$"
64 " Define the default highlighting.
65 " For version 5.7 and earlier: only when not done already
66 " For version 5.8 and later: only when an item doesn't have highlighting yet
67 if version >= 508 || !exists("did_snobol4_syntax_inits")
69 let did_snobol4_syntax_inits = 1
70 command -nargs=+ HiLink hi link <args>
72 command -nargs=+ HiLink hi def link <args>
75 HiLink snobol4Constant Constant
76 HiLink snobol4Label Label
77 HiLink snobol4Goto Repeat
78 HiLink snobol4Conditional Conditional
79 HiLink snobol4Repeat Repeat
80 HiLink snobol4Number Number
81 HiLink snobol4Error Error
82 HiLink snobol4Statement PreProc
83 HiLink snobol4String String
84 HiLink snobol4Comment Comment
85 HiLink snobol4Special Special
86 HiLink snobol4Todo Todo
87 HiLink snobol4Keyword Statement
88 HiLink snobol4Function Statement
89 HiLink snobol4Keyword Keyword
90 HiLink snobol4MathsOperator Operator
91 HiLink snobol4ParenError snobol4Error
92 HiLink snobol4ErrInParen snobol4Error
93 HiLink snobol4ErrInBracket snobol4Error
94 HiLink snobol4SysVar Keyword
95 HiLink snobol4BogusSysVar snobol4Error
100 let b:current_syntax = "snobol4"