bqn-vim/syntax/bqn.vim

62 lines
1.7 KiB
VimL
Raw Permalink Normal View History

2022-01-14 15:15:22 -05:00
if exists('b:current_syntax')
finish
endif
" can't include • and ¯ because their codepoints
" are greater than 255. lol. lmao
syn iskeyword @,48-57,_,192-255,.
syn region bqnComment start=/#/ end=/$/
hi def link bqnComment Comment
syn match bqnError /\[\|\]\|\*\|[↙↖→⍳⍎⍕~]\|\\/
hi def link bqnError Error
syn match bqnDelim /[{}()⟨⟩‿,⋄:;?←⇐↩]/
hi def link bqnDelim Delimiter
syn match bqnOp "[-¬!√÷+=⋆×⌽∊⍷↑⍋∧⊔⊑⊏⊒⊐⊣⊢|⍉↕«»⋈⥊↓⍒∨⌈⌊≢≡<≤∾>≥≍/≠]"
hi def link bqnOp Function
syn match bqnNameOp /\%(\<\|\.\@<=\)\u\%(\w\|¯\)*\%([˜˘¨˝˙]\|\>\)\@=/
2022-01-14 15:15:22 -05:00
hi def link bqnNameOp bqnOp
syn match bqnMod1 /[`˜˘¨⁼⌜´˝˙]/
hi def link bqnMod1 Typedef
syn match bqnNameMod1 /\%(\<\|\.\@<=\)_\%(\w\|¯\)\+\%([˜˘¨˝˙]\|\>\)\@=/
2022-01-14 15:15:22 -05:00
hi def link bqnNameMod1 bqnMod1
syn match bqnMod2 /[⎉⚇⍟◶⊘⎊⊸∘○⌾⟜]/
hi def link bqnMod2 Keyword
syn match bqnNameMod2 /\%(\<\|\.\@<=\)_\%(\w\|¯\)\+_\%([˜˘¨˝˙]\|\>\)\@=/
2022-01-14 15:15:22 -05:00
hi def link bqnNameMod2 bqnMod2
" system subjects highlighted different
2022-01-24 11:28:18 -05:00
syn match bqnSubject /\%(\<\|\.\@<=\)\l\%(\w\|¯\)*\%([˜˘¨˝˙]\|\>\)\@=/
2022-01-14 15:15:22 -05:00
hi def link bqnSubject Normal
syn match bqnSystem /•\%(\%(\w\|¯\)\+\%(\>\|\.\@=\)\)\?/
2022-01-14 15:15:22 -05:00
hi def link bqnSystem Macro
syn match bqnSpecialName /[𝕨𝕎𝕩𝕏𝕗𝔽𝕘𝔾𝕤𝕊]\|_𝕣_\?/
hi def link bqnSpecialName Label
syn match bqnNothing /·/
hi def link bqnNothing Constant
2022-01-24 11:28:08 -05:00
syn region bqnString start=/"/ end=/"/ skip=/""/
2022-01-14 15:15:22 -05:00
hi def link bqnString String
2022-01-25 05:25:58 -05:00
syn match bqnNumber /∞\|π\|¯\?\<\d\%(\%(\d\|_\)*\d\)\?\%(\.\%(\%(\d\|_\)*\d\)\?\)\?\>/
2022-01-14 15:15:22 -05:00
hi def link bqnNumber Number
" yes including '''
syn match bqnChar /'.'\|@/
hi def link bqnChar String
let b:current_syntax = 'bqn'