Ⅰ. 插件描述
Vim script parserⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'ynkdir/vim-vimlparser'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'ynkdir/vim-vimlparser'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'ynkdir/vim-vimlparser'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/ynkdir/vim-vimlparser
Ⅳ. 文档说明
# Vim script parsers
This is Vim script language (a.k.a. VimL) parsers.
Features
The parser to make AST (Abstract Syntax Tree)
Supported languages
This parser provide same feature for following languages.
- Vim script
- Python
- Javascript
Example
All of interfaces are provided from vimlparser module. VimLParser parse into AST using StringReader, and Compiler to compile nodes.
let s:VP = vimlparser#import()
let code = [
\ 'let s:message = printf("hello %d", 1+(2*3))'
\]
let r = s:VP.StringReader.new(code)
let p = s:VP.VimLParser.new()
let c = s:VP.Compiler.new()
echo join(c.compile(p.parse(r)), "\n")This above code output following.
(let = s:message (printf "hello %d" (+ 1 (* 2 3))))About project name
We know a name "VimL" is not the common short form of "Vim scripting language".
But we choice "VimL" for historical and practical reasons and compatibility.