aboutsummaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-07-09 04:44:34 +0000
committerDavid Robillard <d@drobilla.net>2009-07-09 04:44:34 +0000
commitc8c4f52cc9130a349be2cefd4a3199729bef1bb9 (patch)
treef5c7e271a6e6cedcc185069e3a1de03ddcf062a2 /support
parentd1f38c9f27ff1a0208884058d3c8450650703ee9 (diff)
downloadresp-c8c4f52cc9130a349be2cefd4a3199729bef1bb9.tar.gz
resp-c8c4f52cc9130a349be2cefd4a3199729bef1bb9.tar.bz2
resp-c8c4f52cc9130a349be2cefd4a3199729bef1bb9.zip
Add vim support files (indentation and syntax).
git-svn-id: http://svn.drobilla.net/resp/tuplr@187 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'support')
-rw-r--r--support/vim/indent/tuplr.vim15
-rw-r--r--support/vim/syntax/tuplr.vim166
2 files changed, 181 insertions, 0 deletions
diff --git a/support/vim/indent/tuplr.vim b/support/vim/indent/tuplr.vim
new file mode 100644
index 0000000..8e0c6e4
--- /dev/null
+++ b/support/vim/indent/tuplr.vim
@@ -0,0 +1,15 @@
+" Vim indent file
+" Language: Tuplr
+" Maintainer: Dave Robillard <dave@drobilla.net>
+" Last Change: 2009 Mar 5
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+setlocal lisp
+setlocal lispwords=def,fn,match,type
+setlocal expandtab
+
+runtime! indent/lisp.vim
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"