xref: /vim-8.2.3635/runtime/syntax/snobol4.vim (revision cf2d8dee)
1" Vim syntax file
2" Language:     SNOBOL4
3" Maintainer:   Rafal Sulejman <[email protected]>
4" Site: http://rms.republika.pl/vim/syntax/snobol4.vim
5" Last change:  2006 may 10
6" Changes:
7" - strict snobol4 mode (set snobol4_strict_mode to activate)
8" - incorrect HL of dots in strings corrected
9" - incorrect HL of dot-variables in parens corrected
10" - one character labels weren't displayed correctly.
11" - nonexistent Snobol4 keywords displayed as errors.
12
13" For version 5.x: Clear all syntax items
14" For version 6.x: Quit when a syntax file was already loaded
15if version < 600
16  syntax clear
17elseif exists("b:current_syntax")
18  finish
19endif
20
21syntax case ignore
22
23" Snobol4 keywords
24syn keyword     snobol4Keyword      any apply arb arbno arg array
25syn keyword     snobol4Keyword      break
26syn keyword     snobol4Keyword      char clear code collect convert copy
27syn keyword     snobol4Keyword      data datatype date define detach differ dump dupl
28syn keyword     snobol4Keyword      endfile eq eval
29syn keyword     snobol4Keyword      field
30syn keyword     snobol4Keyword      ge gt ident
31syn keyword     snobol4Keyword      input integer item
32syn keyword     snobol4Keyword      le len lgt local lpad lt
33syn keyword     snobol4Keyword      ne notany
34syn keyword     snobol4Keyword      opsyn output
35syn keyword     snobol4Keyword      pos prototype
36syn keyword     snobol4Keyword      remdr replace rpad rpos rtab rewind
37syn keyword     snobol4Keyword      size span stoptr
38syn keyword     snobol4Keyword      tab table time trace trim terminal
39syn keyword     snobol4Keyword      unload
40syn keyword     snobol4Keyword      value
41
42" CSNOBOL keywords
43syn keyword     snobol4ExtKeyword   breakx
44syn keyword     snobol4ExtKeyword   char chop
45syn keyword     snobol4ExtKeyword   date delete
46syn keyword     snobol4ExtKeyword   exp
47syn keyword     snobol4ExtKeyword   freeze function
48syn keyword     snobol4ExtKeyword   host
49syn keyword     snobol4ExtKeyword   io_findunit
50syn keyword     snobol4ExtKeyword   label lpad leq lge lle llt lne log
51syn keyword     snobol4ExtKeyword   ord
52syn keyword     snobol4ExtKeyword   reverse rpad rsort rename
53syn keyword     snobol4ExtKeyword   serv_listen sset set sort sqrt substr
54syn keyword     snobol4ExtKeyword   thaw
55syn keyword     snobol4ExtKeyword   vdiffer
56
57syn region      snobol4String       matchgroup=Quote start=+"+ end=+"+
58syn region      snobol4String       matchgroup=Quote start=+'+ end=+'+
59syn match       snobol4BogusStatement    "^-[^ ][^ ]*"
60syn match       snobol4Statement    "^-\(include\|copy\|module\|line\|plusopts\|case\|error\|noerrors\|list\|unlist\|execute\|noexecute\|copy\)"
61syn match       snobol4Constant     /"[^a-z"']\.[a-z][a-z0-9\-]*"/hs=s+1
62syn region      snobol4Goto         start=":[sf]\{0,1}(" end=")\|$\|;" contains=ALLBUT,snobol4ParenError
63syn match       snobol4Number       "\<\d*\(\.\d\d*\)*\>"
64syn match       snobol4BogusSysVar  "&\w\{1,}"
65syn 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\)"
66syn match       snobol4ExtSysVar    "&\(gtrace\|line\|file\|lastline\|lastfile\)"
67syn match       snobol4Label        "\(^\|;\)[^-\.\+ \t\*\.]\{1,}[^ \t\*\;]*"
68syn match       snobol4Comment      "\(^\|;\)\([\*\|!;#].*$\)"
69
70" Parens matching
71syn cluster     snobol4ParenGroup   contains=snobol4ParenError
72syn region      snobol4Paren        transparent start='(' end=')' contains=ALLBUT,@snobol4ParenGroup,snobol4ErrInBracket
73syn match       snobol4ParenError   display "[\])]"
74syn match       snobol4ErrInParen   display contained "[\]{}]\|<%\|%>"
75syn region      snobol4Bracket      transparent start='\[\|<:' end=']\|:>' contains=ALLBUT,@snobol4ParenGroup,snobol4ErrInParen
76syn match       snobol4ErrInBracket display contained "[){}]\|<%\|%>"
77
78" optional shell shebang line
79" syn match       snobol4Comment      "^\#\!.*$"
80
81" Define the default highlighting.
82" For version 5.7 and earlier: only when not done already
83" For version 5.8 and later: only when an item doesn't have highlighting yet
84if version >= 508 || !exists("did_snobol4_syntax_inits")
85  if version < 508
86    let did_snobol4_syntax_inits = 1
87    command -nargs=+ HiLink hi link <args>
88  else
89    command -nargs=+ HiLink hi def link <args>
90  endif
91
92  HiLink snobol4Constant        Constant
93  HiLink snobol4Label           Label
94  HiLink snobol4Goto            Repeat
95  HiLink snobol4Conditional     Conditional
96  HiLink snobol4Repeat          Repeat
97  HiLink snobol4Number          Number
98  HiLink snobol4Error           Error
99  HiLink snobol4Statement       PreProc
100  HiLink snobol4BogusStatement  snobol4Error
101  HiLink snobol4String          String
102  HiLink snobol4Comment         Comment
103  HiLink snobol4Special         Special
104  HiLink snobol4Todo            Todo
105  HiLink snobol4Keyword         Keyword
106  HiLink snobol4Function        Function
107  HiLink snobol4MathsOperator   Operator
108  HiLink snobol4ParenError      snobol4Error
109  HiLink snobol4ErrInParen      snobol4Error
110  HiLink snobol4ErrInBracket    snobol4Error
111  HiLink snobol4SysVar          Keyword
112  HiLink snobol4BogusSysVar     snobol4Error
113  if exists("snobol4_strict_mode")
114    HiLink snobol4ExtSysVar       WarningMsg
115    HiLink snobol4ExtKeyword      WarningMsg
116  else
117    HiLink snobol4ExtSysVar       snobol4SysVar
118    HiLink snobol4ExtKeyword      snobol4Keyword
119  endif
120
121  delcommand HiLink
122endif
123
124let b:current_syntax = "snobol4"
125" vim: ts=8
126