|
|
|
@ -0,0 +1,99 @@
|
|
|
|
|
" Vim syntax file
|
|
|
|
|
" Language: slope
|
|
|
|
|
" Maintainer: sloum <sloum@rawtext.club>,
|
|
|
|
|
" Last Change: Tue Sep 14 20:21:40 PST 2021
|
|
|
|
|
|
|
|
|
|
" Information about slope can be found at:
|
|
|
|
|
" https://git.rawtext.club/slope-lang
|
|
|
|
|
|
|
|
|
|
" For version 5.x: Clear all syntax items
|
|
|
|
|
" For version 6.x: Quit when a syntax file was already loaded
|
|
|
|
|
if version < 600
|
|
|
|
|
syntax clear
|
|
|
|
|
elseif exists("b:current_syntax")
|
|
|
|
|
finish
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
let b:current_syntax = "slope"
|
|
|
|
|
|
|
|
|
|
setlocal iskeyword=33,35-39,42-58,60-90,94,95,97-122,126,_
|
|
|
|
|
|
|
|
|
|
" slope special forms
|
|
|
|
|
syn keyword slopeCommand quote if and or cond set! define lambda usage
|
|
|
|
|
syn keyword slopeCommand begin begin0 filter load load-mod load-mod-file
|
|
|
|
|
|
|
|
|
|
" slope bools
|
|
|
|
|
syn match slopeBool "#[tf]"
|
|
|
|
|
|
|
|
|
|
" slope comments
|
|
|
|
|
syn keyword slopeTodo TODO XXX FIXME BUG NOTE DEBUG contained
|
|
|
|
|
syn region slopeComment start=/\;/ end=/$/ contains=slopeTodo
|
|
|
|
|
|
|
|
|
|
" slope escape
|
|
|
|
|
syn match slopeEscape /\\\h\{1}/ contained
|
|
|
|
|
|
|
|
|
|
" slope strings
|
|
|
|
|
syn region slopeString start=/\v"/ skip=/\v\\./ end=/\v"/ contains=slopeEscape
|
|
|
|
|
|
|
|
|
|
" catch errors caused by wrong parenthesis and brackets
|
|
|
|
|
syn cluster slopeAll contains=slopeRegion,slopeDelim,slopeFunction,slopeVariable,slopeComment,slopeParenError,slopeSpecial,slopeNumber,slopeClause,slopeCommand,slopeString,slopeEscape,slopeBool
|
|
|
|
|
syn region slopeRegion matchgroup=Delimiter start="(" skip="|.\{-}|" matchgroup=Delimiter end=")" contains=@slopeAll
|
|
|
|
|
syn region slopeRegion matchgroup=Delimiter start="'(" skip="|.\{-}|" matchgroup=Delimiter end=")" contains=@slopeAll
|
|
|
|
|
syn region slopeRegion matchgroup=Delimiter start="\[" skip="|.\{-}|" matchgroup=Delimiter end="\]" contains=@slopeAll
|
|
|
|
|
syn match slopeParenError "]"
|
|
|
|
|
syn match slopeParenError ")"
|
|
|
|
|
|
|
|
|
|
" slope specials
|
|
|
|
|
syn keyword slopeSpecial PI PHI E sys-args stdin stdout stderr devnull
|
|
|
|
|
|
|
|
|
|
" supporting integer numbers
|
|
|
|
|
syn match slopeNumber "[-+]\=[0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\>"
|
|
|
|
|
syn match slopeNumber "[-+]\=\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\>"
|
|
|
|
|
syn match slopeNumber "[-+]\=[0-9]\+/[0-9]\+\>"
|
|
|
|
|
syn match slopeNumber "\([-+]\=\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\)\=[-+]\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\=i\>"
|
|
|
|
|
|
|
|
|
|
" slope commands
|
|
|
|
|
syn keyword slopeFunction positive? negative? zero? abs floor ceil round + - / * min max number->string rand
|
|
|
|
|
syn keyword slopeFunction > >= < <= not equal? number? string? bool? symbol? pair? null? list? procedure? atom? ~bool assoc? string-buf? io-handle?
|
|
|
|
|
syn keyword slopeFunction length cons car cdr append list map for-each list->string list-ref list-sort reverse assoc member? list-seed
|
|
|
|
|
syn keyword slopeFunction substring string-append string->number string-format string->list string-trim-space string-index-of string-ref string->sha256
|
|
|
|
|
syn keyword slopeFunction string-upper string-lower string-make-buf string-buf-clear regex-match? regex-find regex-replace string-fields string->md5
|
|
|
|
|
syn keyword slopeFunction newline display display-lines write write-raw read-line read-char read-all read-all-lines close file-create file-create-temp
|
|
|
|
|
syn keyword slopeFunction file-open-read file-open-write file-append-to file-stat file-name exit license apply ! exception-mode-panic exception-mode-panic?
|
|
|
|
|
syn keyword slopeFunction exception-mode-pass exception-mode-pass? term-size term-char-mode term-raw-mode term-cooked-mode term-sane-mode signal-catch-sigint
|
|
|
|
|
syn keyword slopeFunction mod-path path-exists? path-is-dir? path-abs path-join path-extension path-base path-dir path-glob chmod chdir env subprocess
|
|
|
|
|
syn keyword slopeFunction mkdir rm mv pwd net-conn url-scheme url-host url-port url-path url-query hostname timestamp date timestamp->date date->timestamp
|
|
|
|
|
syn keyword slopeFunction date-format sleep date-default-format
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
" synchronization
|
|
|
|
|
syn sync lines=100
|
|
|
|
|
|
|
|
|
|
" 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_slope_syntax_inits")
|
|
|
|
|
if version < 508
|
|
|
|
|
let did_slope_syntax_inits = 1
|
|
|
|
|
command -nargs=+ HiLink hi link <args>
|
|
|
|
|
else
|
|
|
|
|
command -nargs=+ HiLink hi def link <args>
|
|
|
|
|
endif
|
|
|
|
|
HiLink slopeComment Comment
|
|
|
|
|
HiLink slopeFunction Function
|
|
|
|
|
HiLink slopeClause Operator
|
|
|
|
|
HiLink slopeDelim Delimiter
|
|
|
|
|
HiLink slopeNumber Number
|
|
|
|
|
HiLink slopeSpecial Constant
|
|
|
|
|
HiLink slopeString String
|
|
|
|
|
HiLink slopeBool Boolean
|
|
|
|
|
HiLink slopeCommand Statement
|
|
|
|
|
HiLink slopeParenError Error
|
|
|
|
|
HiLink slopeBracketError Error
|
|
|
|
|
HiLink slopeTodo Todo
|
|
|
|
|
HiLink slopeEscape Character
|
|
|
|
|
delcommand HiLink
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|