diff runtime/syntax/snobol4.vim @ 1624:18ee39301b82 v7.2a

updated for version 7.2a
author vimboss
date Tue, 24 Jun 2008 22:58:06 +0000
parents b933657f7c9d
children 43efa4f5a8ea
line wrap: on
line diff
--- a/runtime/syntax/snobol4.vim
+++ b/runtime/syntax/snobol4.vim
@@ -2,8 +2,12 @@
 " Language:     SNOBOL4
 " Maintainer:   Rafal Sulejman <rms@poczta.onet.pl>
 " Site: http://rms.republika.pl/vim/syntax/snobol4.vim
-" Last change:  2006 may 1
+" Last change:  2006 may 10
 " Changes: 
+" - strict snobol4 mode (set snobol4_strict_mode to activate)
+" - incorrect HL of dots in strings corrected
+" - incorrect HL of dot-variables in parens corrected 
+" - one character labels weren't displayed correctly.
 " - nonexistent Snobol4 keywords displayed as errors.
 
 " For version 5.x: Clear all syntax items
@@ -15,40 +19,54 @@ elseif exists("b:current_syntax")
 endif
 
 syntax case ignore
-" Vanilla Snobol4 keywords
-syn keyword     snobol4Keyword   any apply arb arbno arg array
-syn keyword     snobol4Keyword   break
-syn keyword     snobol4Keyword   char clear code collect convert copy
-syn keyword     snobol4Keyword   data datatype date define detach differ dump dupl
-syn keyword     snobol4Keyword   endfile eq eval
-syn keyword     snobol4Keyword   field
-syn keyword     snobol4Keyword   ge gt ident
-syn keyword     snobol4Keyword   input integer item
-syn keyword     snobol4Keyword   le len lgt local lpad lt
-syn keyword     snobol4Keyword   ne notany
-syn keyword     snobol4Keyword   opsyn output
-syn keyword     snobol4Keyword   pos prototype
-syn keyword     snobol4Keyword   remdr replace rpad rpos rtab
-syn keyword     snobol4Keyword   size span stoptr
-syn keyword     snobol4Keyword   tab table time trace trim terminal
-syn keyword     snobol4Keyword   unload
-syn keyword     snobol4Keyword   value
-" Spitbol keywords
+
+" Snobol4 keywords
+syn keyword     snobol4Keyword      any apply arb arbno arg array
+syn keyword     snobol4Keyword      break
+syn keyword     snobol4Keyword      char clear code collect convert copy
+syn keyword     snobol4Keyword      data datatype date define detach differ dump dupl
+syn keyword     snobol4Keyword      endfile eq eval
+syn keyword     snobol4Keyword      field
+syn keyword     snobol4Keyword      ge gt ident
+syn keyword     snobol4Keyword      input integer item
+syn keyword     snobol4Keyword      le len lgt local lpad lt
+syn keyword     snobol4Keyword      ne notany
+syn keyword     snobol4Keyword      opsyn output
+syn keyword     snobol4Keyword      pos prototype
+syn keyword     snobol4Keyword      remdr replace rpad rpos rtab rewind
+syn keyword     snobol4Keyword      size span stoptr
+syn keyword     snobol4Keyword      tab table time trace trim terminal
+syn keyword     snobol4Keyword      unload
+syn keyword     snobol4Keyword      value
+
 " CSNOBOL keywords
-syn keyword     snobol4Keyword   sset
+syn keyword     snobol4ExtKeyword   breakx
+syn keyword     snobol4ExtKeyword   char chop
+syn keyword     snobol4ExtKeyword   date delete
+syn keyword     snobol4ExtKeyword   exp
+syn keyword     snobol4ExtKeyword   freeze function
+syn keyword     snobol4ExtKeyword   host
+syn keyword     snobol4ExtKeyword   io_findunit
+syn keyword     snobol4ExtKeyword   label lpad leq lge lle llt lne log
+syn keyword     snobol4ExtKeyword   ord
+syn keyword     snobol4ExtKeyword   reverse rpad rsort rename
+syn keyword     snobol4ExtKeyword   serv_listen sset set sort sqrt substr
+syn keyword     snobol4ExtKeyword   thaw
+syn keyword     snobol4ExtKeyword   vdiffer
 
-syn region      snobol4String       matchgroup=Quote start=+"+ skip=+\\"+ end=+"+
-syn region      snobol4String       matchgroup=Quote start=+'+ skip=+\\'+ end=+'+
-syn match       snobol4Statement    "^-[^ ][^ ]*"
-syn match       snobol4Comment      "^\*.*$"
-syn match       snobol4Comment      ";\*.*$"
-syn match       snobol4Constant     "[^a-z]\.[a-z][a-z0-9\-]*"
-syn region      snobol4Goto        start=":[sf]\{0,1}(" end=")\|$\|;" contains=ALLBUT,snobol4ParenError
+syn region      snobol4String       matchgroup=Quote start=+"+ end=+"+
+syn region      snobol4String       matchgroup=Quote start=+'+ end=+'+
+syn match       snobol4BogusStatement    "^-[^ ][^ ]*"
+syn match       snobol4Statement    "^-\(include\|copy\|module\|line\|plusopts\|case\|error\|noerrors\|list\|unlist\|execute\|noexecute\|copy\)"
+syn match       snobol4Constant     /"[^a-z"']\.[a-z][a-z0-9\-]*"/hs=s+1
+syn region      snobol4Goto         start=":[sf]\{0,1}(" end=")\|$\|;" contains=ALLBUT,snobol4ParenError
 syn match       snobol4Number       "\<\d*\(\.\d\d*\)*\>" 
-syn match       snobol4BogusSysVar       "&\w\{1,}"
+syn match       snobol4BogusSysVar  "&\w\{1,}"
 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\)"
-syn match       snobol4Label        "^[^-\.\+ \t]\S\{1,}"
-"
+syn match       snobol4ExtSysVar    "&\(gtrace\|line\|file\|lastline\|lastfile\)"
+syn match       snobol4Label        "\(^\|;\)[^-\.\+ \t\*\.]\{1,}[^ \t\*\;]*"
+syn match       snobol4Comment      "\(^\|;\)\([\*\|!;#].*$\)"
+
 " Parens matching
 syn cluster     snobol4ParenGroup   contains=snobol4ParenError
 syn region      snobol4Paren        transparent start='(' end=')' contains=ALLBUT,@snobol4ParenGroup,snobol4ErrInBracket
@@ -58,8 +76,7 @@ syn region      snobol4Bracket      tran
 syn match       snobol4ErrInBracket display contained "[){}]\|<%\|%>"
 
 " optional shell shebang line
-syn match       snobol4Comment    "^\#\!.*$"
-
+" syn match       snobol4Comment      "^\#\!.*$"
 
 " Define the default highlighting.
 " For version 5.7 and earlier: only when not done already
@@ -80,19 +97,26 @@ if version >= 508 || !exists("did_snobol
   HiLink snobol4Number          Number
   HiLink snobol4Error           Error
   HiLink snobol4Statement       PreProc
+  HiLink snobol4BogusStatement  snobol4Error
   HiLink snobol4String          String
   HiLink snobol4Comment         Comment
   HiLink snobol4Special         Special
   HiLink snobol4Todo            Todo
-  HiLink snobol4Keyword         Statement
-  HiLink snobol4Function        Statement
   HiLink snobol4Keyword         Keyword
+  HiLink snobol4Function        Function
   HiLink snobol4MathsOperator   Operator
   HiLink snobol4ParenError      snobol4Error
   HiLink snobol4ErrInParen      snobol4Error
   HiLink snobol4ErrInBracket    snobol4Error
   HiLink snobol4SysVar          Keyword
   HiLink snobol4BogusSysVar     snobol4Error
+  if exists("snobol4_strict_mode")
+    HiLink snobol4ExtSysVar       WarningMsg
+    HiLink snobol4ExtKeyword      WarningMsg
+  else
+    HiLink snobol4ExtSysVar       snobol4SysVar
+    HiLink snobol4ExtKeyword      snobol4Keyword
+  endif
 
   delcommand HiLink
 endif