2019-03-04 03:28:35 -05:00
|
|
|
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'carp') != -1
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
2017-12-30 05:29:09 -05:00
|
|
|
" Vim syntax file
|
|
|
|
" Language: Carp
|
|
|
|
" Maintainer: Veit Heller <veit@veitheller.de>
|
|
|
|
" URL: http://github.com/hellerve/carp-vim.git
|
|
|
|
" Description: Contains all of the keywords in #lang carp
|
|
|
|
|
|
|
|
if exists("b:current_syntax")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
|
|
|
syn match carpError ,[]})],
|
|
|
|
|
|
|
|
if version < 600
|
|
|
|
set iskeyword=33,35-39,42-43,45-58,60-63,65-90,94,95,97-122,124,126,_
|
|
|
|
else
|
|
|
|
setlocal iskeyword=33,35-39,42-43,45-58,60-63,65-90,94,95,97-122,124,126,_
|
|
|
|
endif
|
|
|
|
|
|
|
|
syn keyword carpSyntax def defn let do if while ref address set! the
|
2018-10-08 13:00:59 -04:00
|
|
|
syn keyword carpSyntax defmacro defdynamic quote cons list array fn
|
2017-12-30 05:29:09 -05:00
|
|
|
syn keyword carpSyntax expand deftype register system-include register-type
|
|
|
|
syn keyword carpSyntax defmodule copy use module defalias definterface eval
|
|
|
|
syn keyword carpSyntax expand instantiate type info help quit env build run
|
2018-12-26 04:41:57 -05:00
|
|
|
syn keyword carpSyntax cat project-set! local-include cons-last
|
2018-02-05 22:15:01 -05:00
|
|
|
syn keyword carpSyntax add-cflag add-lib project load reload let-do ignore
|
|
|
|
syn keyword carpSyntax fmt mac-only linux-only windows-only use-all when
|
|
|
|
syn keyword carpSyntax unless defn-do comment forever-do case and* or*
|
2018-04-30 15:00:42 -04:00
|
|
|
syn keyword carpSyntax str* println* break doc sig hidden private
|
2018-02-05 22:15:01 -05:00
|
|
|
syn match carpSyntax "\vc(a|d){1,4}r"
|
2017-12-30 05:29:09 -05:00
|
|
|
|
2018-02-05 22:15:01 -05:00
|
|
|
syn keyword carpFunc Int Float Double Bool String Char Array Fn Ref Long λ
|
2018-04-30 15:00:42 -04:00
|
|
|
syn keyword carpFunc Pattern
|
2017-12-30 05:29:09 -05:00
|
|
|
syn keyword carpFunc not or and + - * / = /= >= <= > < inc dec
|
2018-04-30 15:00:42 -04:00
|
|
|
syn keyword carpFunc println print get-line from-string mod random
|
2018-06-05 16:50:18 -04:00
|
|
|
syn keyword carpFunc random-between str mask delete append length duplicate
|
2017-12-30 05:29:09 -05:00
|
|
|
syn keyword carpFunc cstr chars from-chars to-int from-int sin cos sqrt acos
|
2018-04-30 15:00:42 -04:00
|
|
|
syn keyword carpFunc atan2 exit time seed-random for cond floor abs sort-with
|
2018-02-05 22:15:01 -05:00
|
|
|
syn keyword carpFunc subarray prefix-array suffix-array reverse sum min max
|
|
|
|
syn keyword carpFunc first last reduce format zero read-file bit-shift-left
|
|
|
|
syn keyword carpFunc bit-shift-right bit-and bit-or bit-xor bit-not safe-add
|
|
|
|
syn keyword carpFunc safe-sub safe-mul even? odd? cmp allocate repeat-indexed
|
|
|
|
syn keyword carpFunc sanitize-addresses memory-balance reset-memory-balance!
|
|
|
|
syn keyword carpFunc log-memory-balance! memory-logged assert-balanced trace
|
2018-04-30 15:00:42 -04:00
|
|
|
syn keyword carpFunc pi e swap! update! char-at tail head split-by words lines
|
2018-02-05 22:15:01 -05:00
|
|
|
syn keyword carpFunc pad-left pad-right count-char empty? random-sized substring
|
|
|
|
syn keyword carpFunc prefix-string suffix-string starts-with? ends-with?
|
2018-04-30 15:00:42 -04:00
|
|
|
syn keyword carpFunc string-join free sleep-seconds sleep-micros substitute
|
|
|
|
syn keyword carpFunc neg to-float match matches? find global-match match-str
|
2017-12-30 05:29:09 -05:00
|
|
|
syn keyword carpFunc from-float tan asin atan cosh sinh tanh exp frexp ldexp
|
|
|
|
syn keyword carpFunc log log10 modf pow ceil clamp approx refstr foreach
|
2018-04-30 15:00:42 -04:00
|
|
|
syn keyword carpFunc => ==> repeat nth replicate range raw aset aset!
|
2017-12-30 05:29:09 -05:00
|
|
|
syn keyword carpFunc push-back pop-back sort index-of element-count
|
|
|
|
|
|
|
|
|
|
|
|
syn match carpSymbol ,\k+, contained
|
|
|
|
syn match carpTodo /\v<(FIXME|NOTE|TODO|OPTIMIZE)/ containedin=carpComment,carpString
|
|
|
|
|
|
|
|
syn cluster carpNormal contains=carpSyntax,carpFunc,carpDelimiter
|
|
|
|
syn cluster carpQuotedStuff contains=carpSymbol
|
|
|
|
syn cluster carpQuotedOrNormal contains=carpDelimiter
|
|
|
|
|
|
|
|
syn region carpQuotedStruc start="@("rs=s+2 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
|
|
|
syn region carpQuotedStruc start="&("rs=s+2 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
|
|
|
syn region carpQuotedStruc start="("rs=s+1 end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
2018-10-08 13:00:59 -04:00
|
|
|
syn region carpQuotedStruc start="{"rs=s+1 end="}"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
2017-12-30 05:29:09 -05:00
|
|
|
syn region carpQuotedStruc start="\["rs=s+1 end="\]"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal contained
|
|
|
|
|
|
|
|
syn cluster carpQuotedStuff add=carpQuotedStruc
|
|
|
|
|
|
|
|
syn region carpStruc matchgroup=Delimiter start="@("rs=s+2 matchgroup=Delimiter end=")"re=e-1 contains=@carpNormal
|
|
|
|
syn region carpStruc matchgroup=Delimiter start="&("rs=s+2 matchgroup=Delimiter end=")"re=e-1 contains=@carpNormal
|
|
|
|
syn region carpStruc matchgroup=Delimiter start="&"rs=s+1 end=![ \t()\[\]";]!me=e-1 contains=@carpNormal
|
|
|
|
syn region carpStruc matchgroup=Delimiter start="@"rs=s+1 end=![ \t()\[\]";]!me=e-1 contains=@carpNormal
|
|
|
|
syn region carpStruc matchgroup=Delimiter start="("rs=s+1 matchgroup=Delimiter end=")"re=e-1 contains=@carpNormal
|
2018-10-08 13:00:59 -04:00
|
|
|
syn region carpStruc matchgroup=Delimiter start="{"rs=s+1 matchgroup=Delimiter end="}"re=e-1 contains=@carpNormal
|
2017-12-30 05:29:09 -05:00
|
|
|
syn region carpStruc matchgroup=Delimiter start="\["rs=s+1 matchgroup=Delimiter end="\]"re=e-1 contains=@carpNormal
|
|
|
|
|
|
|
|
syn region carpString start=/\%(\\\)\@<!"/ skip=/\\[\\"]/ end=/"/
|
2018-04-30 15:00:42 -04:00
|
|
|
syn region carpPattern start=/\%(\\\)\@<!\#"/ skip=/\\[\\"]/ end=/"/
|
2017-12-30 05:29:09 -05:00
|
|
|
|
2018-04-30 15:00:42 -04:00
|
|
|
syn cluster carpNormal add=carpError,carpStruc,carpString,carpPattern
|
2017-12-30 05:29:09 -05:00
|
|
|
syn cluster carpQuotedOrNormal add=carpString
|
|
|
|
|
|
|
|
syn match carpNumber "\<[-+]\?\(\d\+\|\d\+#*\.\|\d*\.\d\+\)#*\(/\d\+#*\)\?[lf]\?\>" contains=carpContainedNumberError
|
|
|
|
syn match carpNumber "\<[-+]\?\d\+/\d\+[lf]\?\>" contains=carpContainedNumberError
|
|
|
|
|
|
|
|
|
|
|
|
syn keyword carpBoolean true false
|
|
|
|
|
|
|
|
syn match carpChar "\<\\.\w\@!"
|
|
|
|
|
|
|
|
syn region carpQuoted matchgroup=Delimiter start="['`]" end=![ \t()\[\]";]!me=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal
|
|
|
|
syn region carpQuoted matchgroup=Delimiter start="['`](" matchgroup=Delimiter end=")" contains=@carpQuotedStuff,@carpQuotedOrNormal
|
|
|
|
|
|
|
|
syn cluster carpNormal add=carpNumber,carpBoolean,carpChar
|
|
|
|
syn cluster carpQuotedOrNormal add=carpNumber,carpBoolean
|
|
|
|
|
|
|
|
syn match carpComment /;.*$/ contains=@Spell
|
|
|
|
|
|
|
|
syn region carpQuoted matchgroup=Delimiter start="#['`]"rs=s+2 end=![ \t()\[\]";]!re=e-1,me=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal
|
|
|
|
syn region carpQuoted matchgroup=Delimiter start="#['`]("rs=s+3 matchgroup=Delimiter end=")"re=e-1 contains=@carpQuotedStuff,@carpQuotedOrNormal
|
|
|
|
|
|
|
|
syn cluster carpNormal add=carpQuoted,carpComment
|
|
|
|
syn cluster carpQuotedOrNormal add=carpComment
|
|
|
|
|
|
|
|
syn sync match matchPlace grouphere NONE "^[^ \t]"
|
|
|
|
|
|
|
|
if version >= 508 || !exists("carp_syntax_init")
|
|
|
|
if version < 508
|
|
|
|
let carp_syntax_init = 1
|
|
|
|
command -nargs=+ HiLink hi link <args>
|
|
|
|
else
|
|
|
|
command -nargs=+ HiLink hi def link <args>
|
|
|
|
endif
|
|
|
|
|
|
|
|
HiLink carpSyntax Statement
|
|
|
|
HiLink carpFunc Function
|
|
|
|
HiLink carpCopy Function
|
|
|
|
|
|
|
|
HiLink carpString String
|
2018-04-30 15:00:42 -04:00
|
|
|
HiLink carpPattern String
|
2017-12-30 05:29:09 -05:00
|
|
|
HiLink carpChar Character
|
|
|
|
HiLink carpBoolean Boolean
|
|
|
|
|
|
|
|
HiLink carpNumber Number
|
|
|
|
HiLink carpNumberError Error
|
|
|
|
HiLink carpContainedNumberError Error
|
|
|
|
|
|
|
|
HiLink carpQuoted Structure
|
|
|
|
HiLink carpQuotedStruc Structure
|
|
|
|
HiLink carpSymbol Structure
|
|
|
|
HiLink carpAtom Structure
|
|
|
|
|
|
|
|
HiLink carpDelimiter Delimiter
|
|
|
|
HiLink carpConstant Constant
|
|
|
|
|
|
|
|
HiLink carpTodo Todo
|
|
|
|
HiLink carpComment Comment
|
|
|
|
HiLink carpError Error
|
|
|
|
delcommand HiLink
|
|
|
|
endif
|
|
|
|
|
|
|
|
let b:current_syntax = "carp"
|