You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use library for vimscript parsing instead of regexes #110
I did a little poking around here and it doesn't look too promising so far. It seems to parse expressions only, not commands, and doesn't seem to handle comments or line continuations either.
Here are some samples of output I got invoking it from inside vim
I did find that https://github.com/vim-jp/vim-vimlparser does a pretty good job parsing arbitrary vimscript. We'd probably want to use that instead, but I can't figure out how to declare a dependency on it for fetch it from pypi yet (vim-jp/vim-vimlparser#170).
changed the title [-]Use libnvim for vimscript parsing instead of regexes[/-][+]Use library for vimscript parsing instead of regexes[/+]on Mar 31, 2020
It looks like the treesitter parser and presumably nvim_parse_expression don't support Vim 9 script (#144). vim-jp/vim-vimlparser does handle vim9. The latter also has a Vim implementation (Python and JS code is generated from the authoritative Vim code), so it would be possible to rewrite vimdoc in vimscript itself, simplifying the release distribution story.
Activity
dbarnett commentedon Mar 31, 2020
I did a little poking around here and it doesn't look too promising so far. It seems to parse expressions only, not commands, and doesn't seem to handle comments or line continuations either.
Here are some samples of output I got invoking it from inside vim
dbarnett commentedon Mar 31, 2020
I did find that https://github.com/vim-jp/vim-vimlparser does a pretty good job parsing arbitrary vimscript. We'd probably want to use that instead, but I can't figure out how to declare a dependency on it for fetch it from pypi yet (vim-jp/vim-vimlparser#170).
[-]Use libnvim for vimscript parsing instead of regexes[/-][+]Use library for vimscript parsing instead of regexes[/+]martindemello commentedon Mar 20, 2022
there's a treesitter parser for viml and python bindings to treesitter - might be worth exploring.
flwyd commentedon Oct 19, 2026
It looks like the treesitter parser and presumably
nvim_parse_expressiondon't support Vim 9 script (#144). vim-jp/vim-vimlparser does handle vim9. The latter also has a Vim implementation (Python and JS code is generated from the authoritative Vim code), so it would be possible to rewrite vimdoc in vimscript itself, simplifying the release distribution story.