Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 977 Bytes

File metadata and controls

38 lines (26 loc) · 977 Bytes

VimL Parsers

Build Status codecov

This is Vim script (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:vimlparser = vimlparser#import()
let code = [
\ 'let s:message = printf("hello %d", 1+(2*3))'
\]
let r = s:StringReader.new(code)
let p = s:VimLParser.new()
let c = s:Compiler.new()
echo join(c.compile(p.parse(r)), "\n")

This above code output following.

(let = s:message (printf "hello %d" (+ 1 (* 2 3))))