From c8c4f52cc9130a349be2cefd4a3199729bef1bb9 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Thu, 9 Jul 2009 04:44:34 +0000
Subject: Add vim support files (indentation and syntax).

git-svn-id: http://svn.drobilla.net/resp/tuplr@187 ad02d1e2-f140-0410-9f75-f8b11f17cedd
---
 support/vim/syntax/tuplr.vim | 166 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 166 insertions(+)
 create mode 100644 support/vim/syntax/tuplr.vim

(limited to 'support/vim/syntax')

diff --git a/support/vim/syntax/tuplr.vim b/support/vim/syntax/tuplr.vim
new file mode 100644
index 0000000..7c47662
--- /dev/null
+++ b/support/vim/syntax/tuplr.vim
@@ -0,0 +1,166 @@
+" Vim syntax file
+" Language:	   Tuplr
+" Last Change: 2009 Apr 18
+" Maintainer:  David Robillard <dave@drobilla.net>
+
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+" Fascist highlighting: everything that doesn't fit the rules is an error...
+
+"syn match	tuplrError	oneline    ![^ \t()\[\]";]*!
+syn match	tuplrError	oneline    ")"
+
+" Quoted and backquoted stuff
+
+syn region tuplrQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+
+syn region tuplrQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+syn region tuplrQuoted matchgroup=Delimiter start="['`]#(" matchgroup=Delimiter end=")" contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+
+syn region tuplrStrucRestricted matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+syn region tuplrStrucRestricted matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+
+" Popular Scheme extension:
+" using [] as well as ()
+syn region tuplrStrucRestricted matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+syn region tuplrStrucRestricted matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+
+syn region tuplrUnquote matchgroup=Delimiter start="," end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+syn region tuplrUnquote matchgroup=Delimiter start=",@" end=![ \t\[\]()";]!me=e-1 contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+
+syn region tuplrUnquote matchgroup=Delimiter start=",(" end=")" contains=ALL
+syn region tuplrUnquote matchgroup=Delimiter start=",@(" end=")" contains=ALL
+
+syn region tuplrUnquote matchgroup=Delimiter start=",#(" end=")" contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+syn region tuplrUnquote matchgroup=Delimiter start=",@#(" end=")" contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+
+syn region tuplrUnquote matchgroup=Delimiter start=",\[" end="\]" contains=ALL
+syn region tuplrUnquote matchgroup=Delimiter start=",@\[" end="\]" contains=ALL
+
+syn region tuplrUnquote matchgroup=Delimiter start=",#\[" end="\]" contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+syn region tuplrUnquote matchgroup=Delimiter start=",@#\[" end="\]" contains=ALLBUT,tuplrStruc,tuplrSyntax,tuplrFunc
+
+" R5RS Scheme Functions and Syntax:
+
+if version < 600
+  set iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
+else
+  setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
+endif
+
+syn keyword tuplrSyntax fn def if match ns type
+syn keyword tuplrFunc cons car cdr
+
+syn match tuplrTypeAnnotation    ":[A-Z][a-zA-Z\.]*"
+syn match tuplrTypeAnnotationExp ":([A-Z][a-zA-Z ]*)"
+syn match tuplrType              "[A-Z][a-zA-Z\.]*"
+syn match tuplrPrefix            "[a-z][a-z]*\."
+
+" ... so that a single + or -, inside a quoted context, would not be
+" interpreted as a number (outside such contexts, it's a tuplrFunc)
+
+syn match	tuplrDelimiter	oneline    !\.[ \t\[\]()";]!me=e-1
+syn match	tuplrDelimiter	oneline    !\.$!
+" ... and a single dot is not a number but a delimiter
+
+" This keeps all other stuff unhighlighted, except *stuff* and <stuff>:
+
+syn match	tuplrOther	oneline    ,[a-z!$%&*/<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*,
+"syn match	tuplrError	oneline    ,[a-z!$%&*/:<=>?^_~+@#%-][-a-z!$%&*/:<=>?^_~0-9+.@#%]*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*,
+"
+"syn match	tuplrOther	oneline    "\.\.\."
+"syn match	tuplrError	oneline    !\.\.\.[^ \t\[\]()";]\+!
+"" ... a special identifier
+"
+"syn match	tuplrConstant	oneline    ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[ \t\[\]()";],me=e-1
+"syn match	tuplrConstant	oneline    ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*$,
+"syn match	tuplrError	oneline    ,\*[-a-z!$%&*/:<=>?^_~0-9+.@]*\*[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*,
+"
+"syn match	tuplrConstant	oneline    ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[ \t\[\]()";],me=e-1
+"syn match	tuplrConstant	oneline    ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>$,
+"syn match	tuplrError	oneline    ,<[-a-z!$%&*/:<=>?^_~0-9+.@]*>[^-a-z!$%&*/:<=>?^_~0-9+.@ \t\[\]()";]\+[^ \t\[\]()";]*,
+
+" Non-quoted lists, and strings:
+
+syn region tuplrStruc matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALL
+syn region tuplrStruc matchgroup=Delimiter start="#(" matchgroup=Delimiter end=")" contains=ALL
+
+syn region tuplrStruc matchgroup=Delimiter start="\[" matchgroup=Delimiter end="\]" contains=ALL
+syn region tuplrStruc matchgroup=Delimiter start="#\[" matchgroup=Delimiter end="\]" contains=ALL
+
+" Simple literals:
+syn region tuplrString start=+\%(\\\)\@<!"+ skip=+\\[\\"]+ end=+"+
+
+" Comments:
+
+syn match	tuplrComment	";.*$"
+
+
+" Writing out the complete description of Scheme numerals without
+" using variables is a day's work for a trained secretary...
+
+syn match	tuplrOther	oneline    ![+-][ \t\[\]()";]!me=e-1
+syn match	tuplrOther	oneline    ![+-]$!
+"
+" This is a useful lax approximation:
+syn match	tuplrNumber	oneline    "[-#+0-9.][-#+/0-9a-f@i.boxesfdl]*"
+syn match	tuplrError	oneline    ![-#+0-9.][-#+/0-9a-f@i.boxesfdl]*[^-#+/0-9a-f@i.boxesfdl \t\[\]()";][^ \t\[\]()";]*!
+
+syn match	tuplrBoolean	oneline    "#[tf]"
+syn match	tuplrError	oneline    !#[tf][^ \t\[\]()";]\+!
+
+syn match	tuplrChar	oneline    "#\\"
+syn match	tuplrChar	oneline    "#\\."
+syn match	tuplrError	oneline    !#\\.[^ \t\[\]()";]\+!
+syn match	tuplrChar	oneline    "#\\space"
+syn match	tuplrError	oneline    !#\\space[^ \t\[\]()";]\+!
+syn match	tuplrChar	oneline    "#\\newline"
+syn match	tuplrError	oneline    !#\\newline[^ \t\[\]()";]\+!
+
+syn region	tuplrComment start="#|" end="|#"
+
+" Synchronization and the wrapping up...
+
+syn sync match matchPlace grouphere NONE "^[^ \t]"
+" ... i.e. synchronize on a line that starts at the left margin
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_tuplr_syntax_inits")
+  if version < 508
+    let did_tuplr_syntax_inits = 1
+    command -nargs=+ HiLink hi link <args>
+  else
+    command -nargs=+ HiLink hi def link <args>
+  endif
+  
+  "HiLink tuplrPrefix            Identifier
+  HiLink tuplrSyntax            Statement
+  HiLink tuplrFunc              Function
+  HiLink tuplrTypeAnnotation    Type
+  HiLink tuplrTypeAnnotationExp Type
+  HiLink tuplrType              Type
+
+  HiLink tuplrString            String
+  HiLink tuplrChar              Character
+  HiLink tuplrNumber            Number
+  HiLink tuplrBoolean           Boolean
+                                
+  HiLink tuplrDelimiter         Delimiter
+  HiLink tuplrConstant          Constant
+                                
+  HiLink tuplrComment           Comment
+  HiLink tuplrMultilineComment  Comment
+  HiLink tuplrError             Error
+                                
+  HiLink tuplrExtSyntax         Type
+  HiLink tuplrExtFunc           PreProc
+  delcommand HiLink
+endif
+
+let b:current_syntax = "tuplr"
-- 
cgit v1.2.1