> Hello,
> 
> Is the Vim Script grammar documented anywhere? I'd like to write a parser.
> 
> (Searching for "vim script grammar/parser" brings up grammars/parsers
> written _in_ vim script, unfortunately...)
> 
> 
> Thanks!
> 
> -Charles

I've never seen a Vim script parser except for the one included in the
Vim sources and not to discourage you (I myself like a good challenge
;-) but I suspect that writing a parser for Vim script will turn ugly
very quickly:

 - Vim script commands determine how their arguments are parsed so there
doesn't seem to be a universal way to parse Vim script code -- it
depends on the commands involved (e.g. normally you can use | to begin a
new command on the same line but this does not work if the line starts
with any of the :map commands)

 - Every command can be abbreviated (:function can be shortened to :fu,
:fun, :func, :funct, you get the point) and some abbreviated commands
have priority over other commands (:e always means :edit, no matter
which commands starting with :e have been defined)

Good luck if you decide to go through with writing a Vim script parser!
I suspect that your best starting point would be :help eval.txt.

 - Peter Odding

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to