uiua semantic tokens

main
aprzn 1 year ago
parent 2b9a9ee4b6
commit a9d3bceb9f

@ -1,5 +1,5 @@
{ {
"rust-analyzer.checkOnSave.command": "clippy", "rust-analyzer.check.command": "clippy",
"clangd.path": "~/.config/coc/extensions/coc-clangd-data/install/16.0.2/clangd_16.0.2/bin/clangd", "clangd.path": "~/.config/coc/extensions/coc-clangd-data/install/16.0.2/clangd_16.0.2/bin/clangd",
"languageserver": { "languageserver": {
"uiua": { "uiua": {
@ -7,5 +7,6 @@
"args": ["lsp"], "args": ["lsp"],
"filetypes": ["uiua"] "filetypes": ["uiua"]
} }
} },
"semanticTokens.enable": true
} }

@ -46,6 +46,7 @@ vim.api.nvim_create_autocmd("FileType", {
if vim.g.neovide then if vim.g.neovide then
if ev.match == "uiua" then if ev.match == "uiua" then
vim.o.guifont = "Uiua386:h14" vim.o.guifont = "Uiua386:h14"
vim.opt_local.commentstring = "# %s"
else else
vim.o.guifont = "FiraCode Nerd Font:h14" vim.o.guifont = "FiraCode Nerd Font:h14"
end end

@ -1,104 +1,111 @@
if exists("b:current_syntax") " if exists("b:current_syntax")
finish " finish
endif " endif
let b:current_syntax = "uiua" " let b:current_syntax = "uiua"
syn iskeyword a-z " syn iskeyword a-z
syn keyword uiuaIdentifier e os family arch ExeExt DllExt sep " syn keyword uiuaIdentifier e os family arch ExeExt DllExt sep
syn match uiuaIdentifier '[a-zA-Z]\+' " syn match uiuaIdentifier '[a-zA-Z]\+'
" {{{ functions and modifiers " " {{{ functions and modifiers
" constants " " constants
syn keyword uiuaNoadic eta pi tau inf[inity] rand[om] tag now " syn keyword uiuaNoadic eta pi tau inf[inity] rand[om] tag now
syn match uiuaNoadic '[ηπ∞τ⚂]' " syn match uiuaNoadic '[ηπ∞τ⚂]'
" monadic and dyadic pervasive functions " " monadic and dyadic pervasive functions
syn keyword uiuaPervasive not sig[n] abs[olute] sqr[t] sin[e] flo[or] cei[ling] rou[nd] add subtract multiply divide mod[ulus] pow[er] log[arithm] min[imum] max[imum] ata[ngent] " syn keyword uiuaPervasive not sig[n] abs[olute] sqr[t] sin[e] flo[or] cei[ling] rou[nd] add subtract multiply divide mod[ulus] pow[er] log[arithm] min[imum] max[imum] ata[ngent]
syn match uiuaPervasive '[¬±`¯⌵√○⌊⌈⁅]\|!=\|<=\|>=\|[=≠<≤>≥+\-×*÷%◿ⁿₙ↧↥∠]' " syn match uiuaPervasive '[¬±`¯⌵√○⌊⌈⁅]\|!=\|<=\|>=\|[=≠<≤>≥+\-×*÷%◿ⁿₙ↧↥∠]'
" monadic array functions " " monadic array functions
syn keyword uiuaMonadic len[gth] sha[pe] rang[e] fir[st] rev[erse] des[hape] bit[s] tra[nspose] ris[e] fal[e] whe[re] cla[ssify] ded[uplicate] box unb[ox] bre[ak] rec[ur] wait call parse gen type sig " syn keyword uiuaMonadic len[gth] sha[pe] rang[e] fir[st] rev[erse] des[hape] bit[s] tra[nspose] ris[e] fal[e] whe[re] cla[ssify] ded[uplicate] box unb[ox] bre[ak] rec[ur] wait call parse gen type sig
syn match uiuaMonadic '[⧻△⇡⊢⇌♭⋯⍉⍏⍖⊚⊛⊝□⊔!⎋↬]' " syn match uiuaMonadic '[⧻△⇡⊢⇌♭⋯⍉⍏⍖⊚⊛⊝□⊔!⎋↬]'
" dyadic array functions " " dyadic array functions
syn keyword uiuaDyadic joi[n] cou[ple] mat[ch] pic[k] sel[ect] resh[ape] tak[e] dro[p] rot[ate] win[dows] kee[p] fin[d] mem[ber] ind[exof] ass[ert] deal " syn keyword uiuaDyadic joi[n] cou[ple] mat[ch] pic[k] sel[ect] resh[ape] tak[e] dro[p] rot[ate] win[dows] kee[p] fin[d] mem[ber] ind[exof] ass[ert] deal
syn match uiuaDyadic '[⊂⊟≅⊡⊏↯↙↘↻◫▽⌕∊⊗⍤]' " syn match uiuaDyadic '[⊂⊟≅⊡⊏↯↙↘↻◫▽⌕∊⊗⍤]'
" monadic modifiers " " monadic modifiers
syn keyword uiuaMonadicMod di[p] ga[p] eac[h] row[s] dis[tribute] tab[le] cro[ss] rep[eat] reduce fol[d] scan gro[up] par[tition] inv[ert] bot[h] spawn " syn keyword uiuaMonadicMod di[p] ga[p] eac[h] row[s] dis[tribute] tab[le] cro[ss] rep[eat] reduce fol[d] scan gro[up] par[tition] inv[ert] bot[h] spawn
syn match uiuaMonadicMod '[⊙⋅∵≡∺⊞⊠⍥/∧⊕⊜\\⍘∩]' " syn match uiuaMonadicMod '[⊙⋅∵≡∺⊞⊠⍥/∧⊕⊜\\⍘∩]'
" dyadic and triadic modifiers " " dyadic and triadic modifiers
syn keyword uiuaOtherMod lev[el] und[er] fil[l] bind bra[cket] for[k] try if " syn keyword uiuaOtherMod lev[el] und[er] fil[l] bind bra[cket] for[k] try if
syn match uiuaOtherMod /[⍚⍜⬚'⊓⊃⍣?]/ " syn match uiuaOtherMod /[⍚⍜⬚'⊓⊃⍣?]/
" }}} " " }}}
" {{{ system functions " " {{{ system functions
" defined in inverse order so precedence for e.g. " " defined in inverse order so precedence for e.g.
" &i and &ime, &s and &sc, etc. is correct " " &i and &ime, &s and &sc, etc. is correct
" modules " " modules
syn keyword uiuaModuleSF use " syn keyword uiuaModuleSF use
syn match uiuaModuleSF '&i' " syn match uiuaModuleSF '&i'
syn match uiuaDyadicSF '\v\&(rs|rb|ru|w|fwa|ime|ae|tcpsrt|tcpswt|httpsw)' " syn match uiuaDyadicSF '\v\&(rs|rb|ru|w|fwa|ime|ae|tcpsrt|tcpswt|httpsw)'
syn match uiuaMonadicSF '\v\&(sl|s|pf|p|var|runi|runc|cd|cl|fo|fc|fe|fld|fif|fras|frab|fwa|imd|ims|gife|ad|ap|ast|tcpl|tcpa|tcpc|tcpsnb|tcpaddr)' " syn match uiuaMonadicSF '\v\&(sl|s|pf|p|var|runi|runc|cd|cl|fo|fc|fe|fld|fif|fras|frab|fwa|imd|ims|gife|ad|ap|ast|tcpl|tcpa|tcpc|tcpsnb|tcpaddr)'
syn match uiuaNoadicSF '\v\&(sc|ts|args|asr)' " syn match uiuaNoadicSF '\v\&(sc|ts|args|asr)'
" }}} " " }}}
" {{{ literals " " {{{ literals
" numeric literal " " numeric literal
syn match uiuaNum '[¯`]\?\d\+\(\.\d\+\)\?\(e[¯`]\?\d\+\)\?' " syn match uiuaNum '[¯`]\?\d\+\(\.\d\+\)\?\(e[¯`]\?\d\+\)\?'
" escape sequence and format placeholder " " escape sequence and format placeholder
syn match uiuaEsc contained /\\[\\'"_0nrt]/ " syn match uiuaEsc contained /\\[\\'"_0nrt]/
syn match uiuaFmt contained '_' " syn match uiuaFmt contained '_'
" character literal " " character literal
syn match uiuaChar '@.' contains=uiuaEsc " syn match uiuaChar '@.' contains=uiuaEsc
" string literal (plain, format, and multiline) " " string literal (plain, format, and multiline)
syn region uiuaStr start='"' end='"' skip='\\"' contains=uiuaEsc " syn region uiuaStr start='"' end='"' skip='\\"' contains=uiuaEsc
syn region uiuaStr start='\$"' end='"' skip='\\"' contains=uiuaEsc,uiuaFmt " syn region uiuaStr start='\$"' end='"' skip='\\"' contains=uiuaEsc,uiuaFmt
syn region uiuaStr start='\$ ' end='$' contains=uiuaEsc,uiuaFmt " syn region uiuaStr start='\$ ' end='$' contains=uiuaEsc,uiuaFmt
" }}} " " }}}
" {{{ misc " " {{{ misc
" function signatures " " function signatures
syn match uiuaSignature '|\d\+\(\.\d\+\)\?' " syn match uiuaSignature '|\d\+\(\.\d\+\)\?'
" scopes, <- assignments, and stranded arrays " " scopes, <- assignments, and stranded arrays
syn match uiuaFaded '^---$\|[←_]' " syn match uiuaFaded '^---$\|[←_]'
" debug functions " " debug functions
syn keyword uiuaDebug dump " syn keyword uiuaDebug dump
syn match uiuaDebug '[~]' " syn match uiuaDebug '[~]'
" comments " " comments
syn match uiuaComment '#.*$' " syn match uiuaComment '#.*$'
" }}} " " }}}
" {{{ highlight groups " " {{{ highlight groups
hi def link uiuaNoadic Keyword " hi def link uiuaNoadic Keyword
hi def link uiuaNoadicSF Keyword " hi def link uiuaNoadicSF Keyword
hi def link uiuaPervasive Operator " hi def link uiuaPervasive Operator
hi def link uiuaMonadic Function " hi def link uiuaMonadic Function
hi def link uiuaMonadicSF Function " hi def link uiuaMonadicSF Function
hi def link uiuaDyadic Identifier " hi def link uiuaDyadic Identifier
hi def link uiuaDyadicSF Identifier " hi def link uiuaDyadicSF Identifier
hi def link uiuaMonadicMod Type " hi def link uiuaMonadicMod Type
hi def link uiuaOtherMod Number " hi def link uiuaOtherMod Number
hi def link uiuaModuleSF Keyword " hi def link uiuaModuleSF Keyword
hi def link uiuaNum Number " hi def link uiuaNum Number
hi def link uiuaEsc SpecialChar " hi def link uiuaEsc SpecialChar
hi def link uiuaChar String " hi def link uiuaChar String
hi def link uiuaFmt Operator " hi def link uiuaFmt Operator
hi def link uiuaStr String " hi def link uiuaStr String
hi def link uiuaSignature Type " hi def link uiuaSignature Type
hi def link uiuaDebug Operator " hi def link uiuaDebug Operator
hi def link uiuaFaded Comment " hi def link uiuaFaded Comment
hi def link uiuaComment Comment " hi def link uiuaComment Comment
" }}} " " }}}
" hi link CocSemStack_function
hi link CocSemNoadic_function Keyword
hi link CocSemMonadic_function Function
hi link CocSemDyadic_function Identifier
hi link CocSemMonadic_modifier Type
hi link CocSemDyadic_modifier Number

Loading…
Cancel
Save