tisp.vim

vim configuration for the tisp langauge
git clone git://edryd.org/tisp.vim
Log | Files | Refs

tisp.vim (4781B)


      1 " Vim syntax file
      2 " Language: tisp
      3 " Author:   Ed van Bruggen <ed@edryd.org>
      4 " URL:      edryd.org/projects/tisp.html
      5 
      6 if version < 600
      7   syntax clear
      8 elseif exists("b:current_syntax")
      9   finish
     10 endif
     11 
     12 " highlight unmatched parens
     13 syn match tispError '[]})]'
     14 
     15 if version < 600
     16   set iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
     17 else
     18   setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
     19 endif
     20 
     21 " built-ins
     22 syn keyword tispSyntax cons quote quasiquote unquote do do0 eval cond
     23 syn keyword tispSyntax set! def defmacro Func Macro load quit error assert
     24 syn keyword tispSyntax if else when unless let recur switch
     25 syn keyword tispSyntax not and or nand nor
     26 syn keyword tispSyntax typeof Void Bool Pair Int Dec Str Sym get
     27 
     28 " functions
     29 syn keyword tispFunc any? nil? empty? void? atom? string? symbol? pair? cons? list?
     30 syn keyword tispFunc function? specialform? primitive? macro? builtin? procedure?
     31 syn keyword tispFunc integer? ratio? decimal? rational? number?
     32 syn keyword tispFunc boolean? true? false?
     33 syn keyword tispFunc version repl ans doc default
     34 
     35 " math
     36 syn keyword tispFunc + - * / ^ mod ! = /= < <= = > >=
     37 syn keyword tispFunc inc dec round truncate floor ceiling
     38 syn keyword tispFunc sqr cube root sqrt cbrt exp log log10 logb
     39 syn keyword tispFunc abs sgn max min numerator denominator dot norm
     40 syn keyword tispFunc sin sinh cos cosh tan tanh
     41 syn keyword tispFunc arcsin arcsinh arccos arccosh arctan arctanh
     42 syn keyword tispFunc csc csch sec sech cot coth
     43 syn keyword tispFunc arccsc arccsch arcsec arcsech arccot arccoth
     44 syn keyword tispFunc negative? positive? zero? even? odd?
     45 
     46 " i/o
     47 syn keyword tispFunc read parse write save open run print println display displayln newline
     48 syn keyword tispNumber stdout stderr
     49 
     50 " os
     51 syn keyword tispFunc cd! pwd now time
     52 
     53 " list
     54 syn keyword tispFunc list list* length last nth head tail count
     55 syn keyword tispFunc apply map convert assoc filter keep remove memp member everyp? every?
     56 syn keyword tispFunc compose reverse append zip
     57 
     58 " stack
     59 syn keyword tispFunc push push! pop pop! peek swap swap!
     60 
     61 " cxr
     62 syn keyword tispFunc car cdr caar cadr cdar cddr caaar caadr cadar caddr cdaar
     63 syn keyword tispFunc cdadr cddar cdddr caaaar caaadr caadar caaddr cadaar
     64 syn keyword tispFunc cadadr caddar cadddr cdaaar cdaadr cdadar cdaddr cddaar
     65 syn keyword tispFunc cddadr cdddar cddddr first rest
     66 syn keyword tispFunc second third forth fifth sixth seventh eighth ninth tenth
     67 
     68 " lambda sign
     69 " syn match tispSyntax /\<[\u03bb]\>/
     70 
     71 syn region tispString start='\%(\\\)\@<!"' skip='\\[\\"]' end='"' contains=@Spell
     72 
     73 syn match tispComment ';.*$' contains=tispTodo,tispNote,@Spell
     74 syn keyword tispTodo FIXME TODO XXX contained
     75 syn keyword tispNote '\CNOTE\ze:\?' contained
     76 
     77 syn match tispDelimiter '\<\.\>'
     78 
     79 syn keyword tispNumber e pi tau
     80 syn match tispNumber "[+-]\=\(\.\d\+\|\d\+\(\.\d*\)\=\)\([eE][-+]\=\d\+\)\="
     81 syn match tispNumber "[+-]\=\(\d\+/\d\+\)"
     82 
     83 syn match tispSymbol ,\k+, contained
     84 
     85 syn keyword tispBoolean True () Nil False it
     86 
     87 syn cluster tispNormal  contains=tispSyntax,tispFunc,tispDelimiter
     88 syn cluster tispQuotedStuff  contains=tispSymbol
     89 syn cluster tispQuotedOrNormal  contains=tispDelimiter
     90 
     91 syn region tispStruc matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=ALL
     92 syn region tispQuoted matchgroup=Delimiter start="['`]" end=![ \t()";]!me=e-1 contains=ALL
     93 
     94 syn region tispQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=ALL
     95 
     96 syn region tispUnquote matchgroup=Delimiter start="," end=![ \t()";]!me=e-1 contains=ALL
     97 syn region tispUnquote matchgroup=Delimiter start=",@" end=![ \t()";]!me=e-1 contains=ALL
     98 
     99 syn region tispUnquote matchgroup=Delimiter start=",(" end=")" contains=ALL
    100 syn region tispUnquote matchgroup=Delimiter start=",@(" end=")" contains=ALL
    101 
    102 " Comments
    103 syn cluster tispNormal  add=tispQuoted,tispComment
    104 syn cluster tispQuotedOrNormal  add=tispComment
    105 
    106 
    107 " Synchronization and the wrapping up...
    108 syn sync match matchPlace grouphere NONE "^[^ \t]"
    109 " ... i.e. synchronize on a line that starts at the left margin
    110 
    111 " Define the default highlighting.
    112 hi def link tispSyntax             Statement
    113 hi def link tispFunc               Function
    114 
    115 hi def link tispString             String
    116 hi def link tispChar               Character
    117 hi def link tispBoolean            Boolean
    118 
    119 hi def link tispNumber             Number
    120 hi def link tispNumberError        Error
    121 
    122 hi def link tispQuoted             Structure
    123 hi def link tispSymbol             Structure
    124 
    125 hi def link tispDelimiter          Delimiter
    126 hi def link tispConstant           Constant
    127 
    128 hi def link tispComment            Comment
    129 hi def link tispTodo               Todo
    130 hi def link tispNote               SpecialComment
    131 hi def link tispError              Error
    132 
    133 let b:current_syntax = "tisp"