Mercurial > vim
changeset 36144:fc89268e5d0d
runtime(vim): Update base-syntax, match Vim9 bool/null literal args to :if/:while/:return
Commit: https://github.com/vim/vim/commit/4d427d4cab9c942d6871c50f714e18d7edcfe135
Author: Doug Kearns <dougkearns@gmail.com>
Date: Sun Sep 15 19:21:18 2024 +0200
runtime(vim): Update base-syntax, match Vim9 bool/null literal args to :if/:while/:return
Match Vim9 boolean and null literals in expression arguments of :if,
:elseif, :while and :return.
closes: #15684
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 15 Sep 2024 19:30:11 +0200 |
parents | a15988a70942 |
children | 79b19045314f |
files | runtime/syntax/generator/gen_syntax_vim.vim runtime/syntax/generator/vim.vim.base runtime/syntax/testdir/dumps/vim9_expr_00.dump runtime/syntax/testdir/dumps/vim9_expr_01.dump runtime/syntax/testdir/dumps/vim_object_methods_00.dump runtime/syntax/testdir/dumps/vim_object_methods_01.dump runtime/syntax/testdir/dumps/vim_object_methods_02.dump runtime/syntax/testdir/input/vim9_expr.vim runtime/syntax/vim.vim |
diffstat | 9 files changed, 77 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/syntax/generator/gen_syntax_vim.vim +++ b/runtime/syntax/generator/gen_syntax_vim.vim @@ -1,7 +1,7 @@ " Vim syntax file generator " Language: Vim script " Maintainer: Hirohito Higashi (h_east) -" Last Change: 2024 Aug 30 +" Last Change: 2024 Sep 14 let s:keepcpo= &cpo set cpo&vim @@ -296,12 +296,14 @@ function! s:get_vim_command_type(cmd_nam echomsg echon echowindow + elseif enddef endfunction execute final for function + if insert let loadkeymap @@ -312,6 +314,7 @@ function! s:get_vim_command_type(cmd_nam new normal popup + return set setglobal setlocal @@ -325,6 +328,7 @@ function! s:get_vim_command_type(cmd_nam unmap var vim9script + while EOL " Required for original behavior " \ 'global', 'vglobal'
--- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -2,7 +2,7 @@ " Language: Vim script " Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com> " Doug Kearns <dougkearns@gmail.com> -" Last Change: 2024 Aug 30 +" Last Change: 2024 Sep 14 " Former Maintainer: Charles E. Campbell " DO NOT CHANGE DIRECTLY. @@ -688,7 +688,7 @@ if !exists("g:vimsyn_noerror") && !exist syn match vimBufnrWarn /\<bufnr\s*(\s*["']\.['"]\s*)/ endif -syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<retu\%[rn]\>\|\<while\>" skipwhite nextgroup=vimOper,vimOperParen,vimVar,vimFunc,vimNotation +syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<retu\%[rn]\>\|\<while\>" skipwhite nextgroup=@vimExprList,vimNotation " Match: {{{2 " =====
new file mode 100644 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim9_expr_00.dump @@ -0,0 +1,20 @@ +>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64 +|#+0#0000e05&| |V|i|m|9|-|s|c|r|i|p|t| |e|x|p|r|e|s@1|i|o|n|s| +0#0000000&@49 +@75 +@75 +|#+0#0000e05&| |C|o|m@1|a|n|d| |{|e|x|p|r|}| |a|r|g|u|m|e|n|t|s| +0#0000000&@48 +@75 +|i+0#af5f00255&|f| +0#0000000&|t+0#e000002&|r|u|e| +0#0000000&@67 +@2|e+0#af5f00255&|c|h|o| +0#0000000&|t+0#e000002&|r|u|e| +0#0000000&@63 +|e+0#af5f00255&|l|s|e|i|f| +0#0000000&|f+0#e000002&|a|l|s|e| +0#0000000&@62 +@2|e+0#af5f00255&|c|h|o| +0#0000000&|f+0#e000002&|a|l|s|e| +0#0000000&@62 +|e+0#af5f00255&|n|d|i|f| +0#0000000&@69 +@75 +|w+0#af5f00255&|h|i|l|e| +0#0000000&|t+0#e000002&|r|u|e| +0#0000000&@64 +@2|b+0#af5f00255&|r|e|a|k| +0#0000000&@67 +|e+0#af5f00255&|n|d|w|h|i|l|e| +0#0000000&@66 +@75 +|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)|:+0#0000000&| |b+0#00e0003&|o@1|l| +0#0000000&@59 +@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|t+0#e000002&|r|u|e| +0#0000000&@61 +|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68 +@57|1|,|1| @10|T|o|p|
new file mode 100644 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim9_expr_01.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@1|b+0#af5f00255&|r|e|a|k| +0#0000000&@67 +|e+0#af5f00255&|n|d|w|h|i|l|e| +0#0000000&@66 +@75 +|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)|:+0#0000000&| |b+0#00e0003&|o@1|l| +0#0000000&@59 +@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|t+0#e000002&|r|u|e| +0#0000000&@61 +>e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68 +@75 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@56|1|9|,|1| @9|B|o|t|
--- a/runtime/syntax/testdir/dumps/vim_object_methods_00.dump +++ b/runtime/syntax/testdir/dumps/vim_object_methods_00.dump @@ -13,7 +13,7 @@ @8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60 @75 @8|d+0#af5f00255&|e|f| +0#0000000&|e+0#0000001#ffff4012|m|p|t|y|(+0#e000e06#ffffff0|)|:+0#0000000&| |b+0#00e0003&|o@1|l| +0#0000000&@49 -@16|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|f+0#00e0e07&|a|l|s|e| +0#0000000&@46 +@16|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|f+0#e000002&|a|l|s|e| +0#0000000&@46 @8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60 @8|d+0#af5f00255&|e|f| +0#0000000&|l+0#0000001#ffff4012|e|n|(+0#e000e06#ffffff0|)|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&@49 @16|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|2+0#e000002&| +0#0000000&@50
--- a/runtime/syntax/testdir/dumps/vim_object_methods_01.dump +++ b/runtime/syntax/testdir/dumps/vim_object_methods_01.dump @@ -1,6 +1,6 @@ | +0&#ffffff0@74 @8|d+0#af5f00255&|e|f| +0#0000000&|e+0#0000001#ffff4012|m|p|t|y|(+0#e000e06#ffffff0|)|:+0#0000000&| |b+0#00e0003&|o@1|l| +0#0000000&@49 -@16|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|f+0#00e0e07&|a|l|s|e| +0#0000000&@46 +@16|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|f+0#e000002&|a|l|s|e| +0#0000000&@46 @8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60 @8|d+0#af5f00255&|e|f| +0#0000000&|l+0#0000001#ffff4012|e|n|(+0#e000e06#ffffff0|)|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&@49 @16>r+0#af5f00255&|e|t|u|r|n| +0#0000000&|2+0#e000002&| +0#0000000&@50
--- a/runtime/syntax/testdir/dumps/vim_object_methods_02.dump +++ b/runtime/syntax/testdir/dumps/vim_object_methods_02.dump @@ -1,5 +1,5 @@ | +0&#ffffff0@7|d+0#af5f00255&|e|f| +0#0000000&|e+0#0000001#ffff4012|m|p|t|y|(+0#e000e06#ffffff0|)|:+0#0000000&| |b+0#00e0003&|o@1|l| +0#0000000&@49 -@16|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|t+0#00e0e07&|r|u|e| +0#0000000&@47 +@16|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|t+0#e000002&|r|u|e| +0#0000000&@47 @8|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60 @8|d+0#af5f00255&|e|f| +0#0000000&|l+0#0000001#ffff4012|e|n|(+0#e000e06#ffffff0|)|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&@49 @16|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|0+0#e000002&| +0#0000000&@50
new file mode 100644 --- /dev/null +++ b/runtime/syntax/testdir/input/vim9_expr.vim @@ -0,0 +1,20 @@ +vim9script +# Vim9-script expressions + + +# Command {expr} arguments + +if true + echo true +elseif false + echo false +endif + +while true + break +endwhile + +def Foo(): bool + return true +enddef +
--- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -2,7 +2,7 @@ " Language: Vim script " Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com> " Doug Kearns <dougkearns@gmail.com> -" Last Change: 2024 Aug 30 +" Last Change: 2024 Sep 14 " Former Maintainer: Charles E. Campbell " DO NOT CHANGE DIRECTLY. @@ -28,11 +28,11 @@ syn cluster vimCommentGroup contains=vim " regular vim commands {{{2 " GEN_SYN_VIM: vimCommand normal, START_STR='syn keyword vimCommand contained', END_STR='' syn keyword vimCommand contained abo[veleft] abs[tract] al[l] ar[gs] arga[dd] argd[elete] argdo argded[upe] arge[dit] argg[lobal] argl[ocal] argu[ment] as[cii] b[uffer] bN[ext] ba[ll] bad[d] balt bd[elete] bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bo[tright] bp[revious] br[ewind] brea[k] breaka[dd] breakd[el] breakl[ist] bro[wse] buffers bufd[o] bun[load] bw[ipeout] c[hange] cN[ext] cNf[ile] cabo[ve] cad[dbuffer] cadde[xpr] caddf[ile] caf[ter] cb[uffer] cbe[fore] cbel[ow] cbo[ttom] cc ccl[ose] cd cdo ce[nter] cex[pr] cf[ile] cfd[o] cfir[st] cg[etfile] cgetb[uffer] cgete[xpr] chd[ir] changes che[ckpath] checkt[ime] chi[story] cl[ist] cla[st] class clo[se] cle[arjumps] cn[ext] cnew[er] cnf[ile] co[py] col[der] colo[rscheme] com[mand] comc[lear] comp[iler] -syn keyword vimCommand contained con[tinue] conf[irm] cons[t] cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cst[ag] cw[indow] d[elete] delm[arks] deb[ug] debugg[reedy] defc[ompile] defe[r] delf[unction] di[splay] dif[fupdate] diffg[et] diffo[ff] diffp[atch] diffpu[t] diffs[plit] difft[his] dig[raphs] disa[ssemble] dj[ump] dli[st] dr[op] ds[earch] dsp[lit] e[dit] ea[rlier] el[se] elsei[f] em[enu] en[dif] endin[terface] endc[lass] ende[num] endfo[r] endt[ry] endw[hile] ene[w] enu[m] ev[al] ex exi[t] exp[ort] exu[sage] f[ile] files filet[ype] filt[er] fin[d] finall[y] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] foldd[oopen] folddoc[losed] foldo[pen] g[lobal] go[to] gr[ep] grepa[dd] gu[i] gv[im] h[elp] helpc[lose] helpf[ind] helpg[rep] helpt[ags] ha[rdcopy] -syn keyword vimCommand contained hi[ghlight] hid[e] his[tory] ho[rizontal] if ij[ump] il[ist] imp[ort] int[ro] inte[rface] is[earch] isp[lit] j[oin] ju[mps] k kee[pmarks] keepj[umps] keepp[atterns] keepa[lt] l[ist] lN[ext] lNf[ile] la[st] lab[ove] lan[guage] lad[dexpr] laddb[uffer] laddf[ile] laf[ter] lat[er] lb[uffer] lbe[fore] lbel[ow] lbo[ttom] lc[d] lch[dir] lcl[ose] lcs[cope] ld[o] le[ft] lefta[bove] lex[pr] leg[acy] lf[ile] lfd[o] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lgr[ep] lgrepa[dd] lh[elpgrep] lhi[story] ll lla[st] lli[st] lmak[e] lne[xt] lnew[er] lnf[ile] lo[adview] loc[kmarks] lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lua luad[o] luaf[ile] lv[imgrep] lvimgrepa[dd] lw[indow] ls m[ove] ma[rk] mak[e] marks menut[ranslate] -syn keyword vimCommand contained mes[sages] mk[exrc] mks[ession] mksp[ell] mkv[imrc] mkvie[w] mod[e] mz[scheme] mzf[ile] n[ext] nb[key] nbc[lose] nbs[tart] noa[utocmd] noh[lsearch] nos[wapfile] nu[mber] o[pen] ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] pc[lose] pe[rl] perld[o] ped[it] po[p] pp[op] pre[serve] prev[ious] pro[mptfind] promptr[epl] prof[ile] profd[el] ps[earch] pt[ag] ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pub[lic] pw[d] py[thon] pyd[o] pyf[ile] py3 py3d[o] python3 py3f[ile] pyx pyxd[o] pythonx pyxf[ile] q[uit] quita[ll] qa[ll] r[ead] rec[over] red[o] redi[r] redr[aw] redraws[tatus] redrawt[abline] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] ru[ntime] -syn keyword vimCommand contained rub[y] rubyd[o] rubyf[ile] rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] san[dbox] sav[eas] sb[uffer] sbN[ext] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbp[revious] sbr[ewind] sc[riptnames] scripte[ncoding] scriptv[ersion] scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] si[malt] sig[n] sil[ent] sla[st] sn[ext] so[urce] sor[t] sp[lit] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellra[re] spellu[ndo] spellw[rong] spr[evious] sr[ewind] st[op] sta[g] star[tinsert] startg[replace] startr[eplace] stat[ic] stopi[nsert] stj[ump] sts[elect] sun[hide] sus[pend] sv[iew] sw[apname] synti[me] sync[bind] smi[le] t tN[ext] ta[g] tags tab tabc[lose] tabd[o] tabe[dit] tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew tabo[nly] -syn keyword vimCommand contained tabp[revious] tabN[ext] tabr[ewind] tabs tc[d] tch[dir] tcl tcld[o] tclf[ile] te[aroff] ter[minal] tf[irst] thi[s] tj[ump] tl[ast] tn[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] ty[pe] u[ndo] undoj[oin] undol[ist] unh[ide] unlo[ckvar] uns[ilent] up[date] v[global] ve[rsion] verb[ose] vert[ical] vi[sual] vie[w] vim[grep] vimgrepa[dd] vim9[cmd] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wh[ile] wi[nsize] winc[md] wind[o] winp[os] wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] xa[ll] xr[estore] y[ank] z dl dell delel deletl deletel dp dep delp delep deletp deletep a i +syn keyword vimCommand contained con[tinue] conf[irm] cons[t] cope[n] cp[revious] cpf[ile] cq[uit] cr[ewind] cs[cope] cst[ag] cw[indow] d[elete] delm[arks] deb[ug] debugg[reedy] defc[ompile] defe[r] delf[unction] di[splay] dif[fupdate] diffg[et] diffo[ff] diffp[atch] diffpu[t] diffs[plit] difft[his] dig[raphs] disa[ssemble] dj[ump] dli[st] dr[op] ds[earch] dsp[lit] e[dit] ea[rlier] el[se] em[enu] en[dif] endin[terface] endc[lass] ende[num] endfo[r] endt[ry] endw[hile] ene[w] enu[m] ev[al] ex exi[t] exp[ort] exu[sage] f[ile] files filet[ype] filt[er] fin[d] finall[y] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] foldd[oopen] folddoc[losed] foldo[pen] g[lobal] go[to] gr[ep] grepa[dd] gu[i] gv[im] h[elp] helpc[lose] helpf[ind] helpg[rep] helpt[ags] ha[rdcopy] hi[ghlight] +syn keyword vimCommand contained hid[e] his[tory] ho[rizontal] ij[ump] il[ist] imp[ort] int[ro] inte[rface] is[earch] isp[lit] j[oin] ju[mps] k kee[pmarks] keepj[umps] keepp[atterns] keepa[lt] l[ist] lN[ext] lNf[ile] la[st] lab[ove] lan[guage] lad[dexpr] laddb[uffer] laddf[ile] laf[ter] lat[er] lb[uffer] lbe[fore] lbel[ow] lbo[ttom] lc[d] lch[dir] lcl[ose] lcs[cope] ld[o] le[ft] lefta[bove] lex[pr] leg[acy] lf[ile] lfd[o] lfir[st] lg[etfile] lgetb[uffer] lgete[xpr] lgr[ep] lgrepa[dd] lh[elpgrep] lhi[story] ll lla[st] lli[st] lmak[e] lne[xt] lnew[er] lnf[ile] lo[adview] loc[kmarks] lockv[ar] lol[der] lop[en] lp[revious] lpf[ile] lr[ewind] lt[ag] lua luad[o] luaf[ile] lv[imgrep] lvimgrepa[dd] lw[indow] ls m[ove] ma[rk] mak[e] marks menut[ranslate] mes[sages] mk[exrc] +syn keyword vimCommand contained mks[ession] mksp[ell] mkv[imrc] mkvie[w] mod[e] mz[scheme] mzf[ile] n[ext] nb[key] nbc[lose] nbs[tart] noa[utocmd] noh[lsearch] nos[wapfile] nu[mber] o[pen] ol[dfiles] on[ly] opt[ions] ow[nsyntax] p[rint] pa[ckadd] packl[oadall] pc[lose] pe[rl] perld[o] ped[it] po[p] pp[op] pre[serve] prev[ious] pro[mptfind] promptr[epl] prof[ile] profd[el] ps[earch] pt[ag] ptN[ext] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pub[lic] pw[d] py[thon] pyd[o] pyf[ile] py3 py3d[o] python3 py3f[ile] pyx pyxd[o] pythonx pyxf[ile] q[uit] quita[ll] qa[ll] r[ead] rec[over] red[o] redi[r] redr[aw] redraws[tatus] redrawt[abline] reg[isters] res[ize] ret[ab] rew[ind] ri[ght] rightb[elow] ru[ntime] rub[y] rubyd[o] rubyf[ile] +syn keyword vimCommand contained rund[o] rv[iminfo] sN[ext] sa[rgument] sal[l] san[dbox] sav[eas] sb[uffer] sbN[ext] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbp[revious] sbr[ewind] sc[riptnames] scripte[ncoding] scriptv[ersion] scs[cope] setf[iletype] sf[ind] sfir[st] sh[ell] si[malt] sig[n] sil[ent] sla[st] sn[ext] so[urce] sor[t] sp[lit] spe[llgood] spelld[ump] spelli[nfo] spellr[epall] spellra[re] spellu[ndo] spellw[rong] spr[evious] sr[ewind] st[op] sta[g] star[tinsert] startg[replace] startr[eplace] stat[ic] stopi[nsert] stj[ump] sts[elect] sun[hide] sus[pend] sv[iew] sw[apname] synti[me] sync[bind] smi[le] t tN[ext] ta[g] tags tab tabc[lose] tabd[o] tabe[dit] tabf[ind] tabfir[st] tabm[ove] tabl[ast] tabn[ext] tabnew tabo[nly] tabp[revious] tabN[ext] +syn keyword vimCommand contained tabr[ewind] tabs tc[d] tch[dir] tcl tcld[o] tclf[ile] te[aroff] ter[minal] tf[irst] thi[s] tj[ump] tl[ast] tn[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] ty[pe] u[ndo] undoj[oin] undol[ist] unh[ide] unlo[ckvar] uns[ilent] up[date] v[global] ve[rsion] verb[ose] vert[ical] vi[sual] vie[w] vim[grep] vimgrepa[dd] vim9[cmd] viu[sage] vne[w] vs[plit] w[rite] wN[ext] wa[ll] wi[nsize] winc[md] wind[o] winp[os] wn[ext] wp[revious] wq wqa[ll] wu[ndo] wv[iminfo] x[it] xa[ll] xr[estore] y[ank] z dl dell delel deletl deletel dp dep delp delep deletp deletep a i " Lower priority for _new_ to distinguish constructors from the command. syn match vimCommand contained "\<new\>(\@!" @@ -734,7 +734,7 @@ if !exists("g:vimsyn_noerror") && !exist syn match vimBufnrWarn /\<bufnr\s*(\s*["']\.['"]\s*)/ endif -syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<retu\%[rn]\>\|\<while\>" skipwhite nextgroup=vimOper,vimOperParen,vimVar,vimFunc,vimNotation +syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<retu\%[rn]\>\|\<while\>" skipwhite nextgroup=@vimExprList,vimNotation " Match: {{{2 " =====