2017-09-12 23:00:42 -07:00
|
|
|
" Language: Nomsu
|
|
|
|
" Maintainer: Bruce Hill <bruce@bruce-hill.com>
|
|
|
|
" License: WTFPL
|
|
|
|
|
|
|
|
" Bail if our syntax is already loaded.
|
|
|
|
if exists('b:current_syntax') && b:current_syntax == 'nomsu'
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Highlight long strings.
|
|
|
|
syn sync minlines=100
|
|
|
|
|
2017-09-14 00:12:28 -07:00
|
|
|
hi def link nomsuInterpDelim PreProc
|
2017-09-20 04:39:41 -07:00
|
|
|
syn region nomsuOneLineComment start=/#\(\.\.\)\@!/ end=/$/
|
|
|
|
hi nomsuOneLineComment ctermfg=DarkBlue
|
2017-09-14 00:12:28 -07:00
|
|
|
hi def link nomsuOneLineComment Comment
|
2017-09-20 04:39:41 -07:00
|
|
|
syn region nomsuComment start=/\(\n\z(\s*\)[^\n]*\)\@<=#\.\./ skip=/\n\s*$/ end=/\n\(\z1\s\)\@!/
|
|
|
|
hi nomsuComment ctermfg=DarkBlue
|
2017-09-14 00:12:28 -07:00
|
|
|
hi def link nomsuComment Comment
|
2017-09-12 23:00:42 -07:00
|
|
|
|
2017-09-14 00:12:28 -07:00
|
|
|
|
2017-09-20 04:39:41 -07:00
|
|
|
syn region nomsuShortString start=/\("\.\.\)\@<!"\(\.\."\)\@!/ skip=/\\\\\|\\"/ end=/"/
|
|
|
|
hi nomsuShortString ctermfg=Magenta
|
|
|
|
hi def link nomsuShortString String
|
2017-09-14 04:23:04 -07:00
|
|
|
|
2017-09-14 00:12:28 -07:00
|
|
|
|
2017-09-20 04:39:41 -07:00
|
|
|
syn match nomsuLongStringStart /"\.\."/ contains=nomsuIndentor contained
|
|
|
|
hi nomsuLongStringStart ctermfg=Yellow
|
|
|
|
syn match nomsuStringPipe /|/ contained
|
|
|
|
hi nomsuStringPipe ctermfg=DarkGray
|
|
|
|
hi def link nomsuStringPipe Special
|
|
|
|
syn region nomsuInterp matchgroup=nomsuInterpDelim start=/\\/ end=/\\/ contained
|
|
|
|
\ contains=@nomsuAll
|
|
|
|
syn region nomsuLongStringValue start=/\(|\)\@<=/ end=/\(\n\)\@=/ contained
|
|
|
|
\ contains=nomsuInterp
|
|
|
|
hi nomsuLongStringValue ctermbg=Black ctermfg=Gray
|
|
|
|
hi def link nomsuLongStringValue String
|
|
|
|
syn region nomsuLongStringFirstLine start=/\("\.\."\s*\)\@<=|/ end=/$/ contained
|
|
|
|
\ contains=nomsuStringPipe,nomsuLongStringValue
|
|
|
|
syn region nomsuLongStringLine start=/^\s\+|/ end=/$/ contained
|
|
|
|
\ contains=nomsuStringPipe,nomsuLongStringValue
|
|
|
|
syn region nomsuLongString start=/\(^\z(\s*\)[^\n]*\)\@<="\.\."/ skip=/^\s*$/ end=/^\(\z1\s\)\@!/
|
|
|
|
\ contains=nomsuLongStringStart,nomsuOneLineComment,nomsuComment,nomsuLongStringLine,nomsuLongStringFirstLine
|
|
|
|
|
|
|
|
|
|
|
|
syn match nomsuVar /\v\%[a-zA-Z0-9`~!@^&*_+=|<>?'-][a-zA-Z0-9`~!@^&*_+=|<>?-]*/
|
|
|
|
hi nomsuVar ctermfg=Cyan
|
|
|
|
hi def link nomsuVar Identifier
|
2017-09-14 00:12:28 -07:00
|
|
|
|
2017-09-12 23:00:42 -07:00
|
|
|
|
2017-09-20 04:39:41 -07:00
|
|
|
syn match nomsuWord /\v[a-zA-Z0-9`~!@^&*_+=|<>?'-][a-zA-Z0-9`~!@^&*_+=|<>?-]*/
|
|
|
|
hi def link nomsuWord Function
|
|
|
|
hi nomsuWord ctermfg=White
|
2017-09-12 23:00:42 -07:00
|
|
|
|
2017-09-20 04:39:41 -07:00
|
|
|
syn match nomsuNumber /-\?\d\+\(\.\(\d\+\)\?\)\?/
|
|
|
|
syn match nomsuNumber /-\?\.\d\+/
|
2017-09-12 23:00:42 -07:00
|
|
|
hi def link nomsuNumber Number
|
|
|
|
|
|
|
|
syn match nomsuIndentor /\.\./
|
2017-09-20 04:39:41 -07:00
|
|
|
hi def link nomsuIndentor Special
|
|
|
|
hi nomsuIndentor ctermfg=DarkGray
|
2017-09-12 23:00:42 -07:00
|
|
|
|
2017-09-20 04:39:41 -07:00
|
|
|
syn match nomsuDelim /[,()\[\]]/
|
|
|
|
hi nomsuDelim ctermfg=Yellow
|
|
|
|
hi def link nomsuDelim Delimiter
|
2017-09-12 23:00:42 -07:00
|
|
|
|
|
|
|
syn match nomsuThunk /:/
|
2017-09-20 04:39:41 -07:00
|
|
|
hi nomsuThunk ctermfg=Yellow
|
2017-09-12 23:00:42 -07:00
|
|
|
hi def link nomsuThunk Structure
|
|
|
|
|
2017-09-20 04:39:41 -07:00
|
|
|
syn cluster nomsuAll contains=nomsuShortString,nomsuLongString,nomsuComment,nomsuOneLineComment,
|
|
|
|
\ nomsuVar,nomsuNumber,nomsuDelim,nomsuThunk,nomsuIndentor,nomsuWord
|
2017-09-14 00:12:28 -07:00
|
|
|
|
2017-09-12 23:00:42 -07:00
|
|
|
if !exists('b:current_syntax')
|
|
|
|
let b:current_syntax = 'nomsu'
|
|
|
|
endif
|