All Projects → vim-jp → Go Vimlparser

vim-jp / Go Vimlparser

Licence: other
⚡️ Vim Script Parser written in Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Go Vimlparser

Vue Styleguide Generator
React inspired style guide generator for Vue.js
Stars: ✭ 123 (-6.82%)
Mutual labels:  parser
Typin
Declarative framework for interactive CLI applications
Stars: ✭ 126 (-4.55%)
Mutual labels:  parser
Php Zephir Parser
The Zephir Parser delivered as a C extension for the PHP language.
Stars: ✭ 129 (-2.27%)
Mutual labels:  parser
Black Widow
GUI based offensive penetration testing tool (Open Source)
Stars: ✭ 124 (-6.06%)
Mutual labels:  parser
Prowide Core
Model and parsers for all SWIFT MT (FIN) messages
Stars: ✭ 125 (-5.3%)
Mutual labels:  parser
Baba Core
Mini-language for creating random text generators.
Stars: ✭ 127 (-3.79%)
Mutual labels:  parser
Resume Parser
AWS Lambda function queried using AWS API Gateway to parse resumes using Lever API
Stars: ✭ 123 (-6.82%)
Mutual labels:  parser
Works For Me
Collection of developer toolkits
Stars: ✭ 131 (-0.76%)
Mutual labels:  parser
Gofeed
Parse RSS, Atom and JSON feeds in Go
Stars: ✭ 1,762 (+1234.85%)
Mutual labels:  parser
Snarkdown
😼 A snarky 1kb Markdown parser written in JavaScript
Stars: ✭ 1,813 (+1273.48%)
Mutual labels:  parser
Dan Jurafsky Chris Manning Nlp
My solution to the Natural Language Processing course made by Dan Jurafsky, Chris Manning in Winter 2012.
Stars: ✭ 124 (-6.06%)
Mutual labels:  parser
Zpa
A parser and source code analyzer for PL/SQL and Oracle SQL.
Stars: ✭ 124 (-6.06%)
Mutual labels:  parser
Md
A markdown parser and compiler. Built for speed.
Stars: ✭ 128 (-3.03%)
Mutual labels:  parser
Whois Parser
Go(Golang) module for domain whois information parsing.
Stars: ✭ 123 (-6.82%)
Mutual labels:  parser
Diff2html
Pretty diff to html javascript library (diff2html)
Stars: ✭ 1,867 (+1314.39%)
Mutual labels:  parser
Awesome Hungarian Nlp
A curated list of NLP resources for Hungarian
Stars: ✭ 121 (-8.33%)
Mutual labels:  parser
Phplrt
PHP Language Recognition Tool
Stars: ✭ 127 (-3.79%)
Mutual labels:  parser
React Json Schema
Configure and build views using JSON schemas mapped to React components
Stars: ✭ 131 (-0.76%)
Mutual labels:  parser
Csly
a C# embeddable lexer and parser generator (.Net core)
Stars: ✭ 129 (-2.27%)
Mutual labels:  parser
Tiny Json
The tiny-json is a versatile and easy to use json parser in C suitable for embedded systems. It is fast, robust and portable.
Stars: ✭ 127 (-3.79%)
Mutual labels:  parser

Vim Script Parser written in Go

CI Status codecov Sourcegraph GoDoc

This repository is the fork of https://github.com/ynkdir/vim-vimlparser and it provides Go-ish interface with performance improvement.

⚡️ The Fastest Vim Script Parser!

Benchmarks

$ pwd
/home/vim-jp/src/github.com/ynkdir/vim-vimlparser

$ git rev-parse HEAD
2fff43c58968a18bc01bc8304df68bde01af04d9

$ wc -l < autoload/vimlparser.vim
5195

$ time vim -u NONE -N --cmd "let &rtp .= ',' . getcwd()" --cmd "silent call vimlparser#test('autoload/vimlparser.vim')" -c ":q"
vim -u NONE -N --cmd "let &rtp .= ',' . getcwd()" --cmd  -c ":q"  48.88s user 0.05s system 99% cpu 48.942 total

$ python3 -V
Python 3.5.0

$ time python3 py/vimlparser.py autoload/vimlparser.vim > /dev/null
python3 py/vimlparser.py autoload/vimlparser.vim > /dev/null  4.17s user 0.04s system 99% cpu 4.236 total

$ pypy3 -V
Python 3.2.5 (b2091e973da69152b3f928bfaabd5d2347e6df46, Mar 04 2016, 07:08:30)
[PyPy 2.4.0 with GCC 5.3.0]

$ time pypy3 py/vimlparser.py autoload/vimlparser.vim > /dev/null
pypy3 py/vimlparser.py autoload/vimlparser.vim > /dev/null  2.63s user 0.06s system 99% cpu 2.694 total

$ node --version
v4.2.3

$ time node js/vimlparser.js autoload/vimlparser.vim > /dev/null
node js/vimlparser.js autoload/vimlparser.vim > /dev/null  0.77s user 0.04s system 125% cpu 0.644 total

$ go get github.com/vim-jp/go-vimlparser/cmd/vimlparser
$ time vimlparser autoload/vimlparser.vim > /dev/null
vimlparser autoload/vimlparser.vim > /dev/null  0.25s user 0.03s system 114% cpu 0.244 total
Language Time (sec)
Vim script 48.88s
Python3 4.17s
pypy3 2.63s
node 0.77s
Go 0.25s

Note that, in addition to the Go lang speed, I added performance improvement for Go implementation.

Rich interface compared to other implementation

go-vimlparser is written in Go which is typed language and I added Go-ish interface, so you can see each node fields. e.g. https://godoc.org/github.com/vim-jp/go-vimlparser/ast#Function

package doc
go-vimlparser GoDoc
go-vimlparser/ast GoDoc
go-vimlparser/token GoDoc

CLI tool

Installation

go get github.com/vim-jp/go-vimlparser/cmd/vimlparser

Usage

$ echo 'let x = 1' | vimlparser
(let = x 1)
$ vimlparser autoload/vimlparser.vim | head -n 5
; vim:set ts=8 sts=2 sw=2 tw=0 et:
;
; VimL parser - Vim Script Parser
;
; License: This file is placed in the public domain.

As a Lint Tool

You can use it to detect syntax error. It doesn't check much things compared to existing lint tool for Vim script, but it runs fast even if you pass lots of files to it.

$ vimlparser **/*.vim > /dev/null
test/test_err_funcarg_duplicate.vim:1:20: vimlparser: E853: Duplicate argument name: b
test/test_err_funcarg_firstline.vim:1:14: vimlparser: E125: Illegal argument: firstline
test/test_err_funcarg_lastline.vim:1:14: vimlparser: E125: Illegal argument: lastline
test/test_err_funcarg.vim:1:44: vimlparser: E125: Illegal argument: a:bar
test/test_err_funcname.vim:11:10: vimlparser: E128: Function name must start with a capital or contain a colon: foo
test/test_err_toomanyarg.vim:1:9: vimlparser: E740: Too many arguments for function
test/test_err_varname.vim:1:5: vimlparser: E461: Illegal variable name: foo:bar
test/test_issue16_err_line_continuation_lnum2.vim:3:9: vimlparser: E488: Trailing characters: z
test/test_issue16_err_line_continuation_lnum.vim:2:9: vimlparser: E488: Trailing characters: z
test/test_neo_tnoremap.vim:1:1: vimlparser: E492: Not an editor command: tnoremap <Esc> <C-\><C-N>
test/test_noneo_tnoremap.vim:1:1: vimlparser: E492: Not an editor command: tnoremap <Esc> <C-\><C-N>
test/test_xxx_colonsharp.vim:2:6: vimlparser: unexpected token: :
test/test_xxx_err_funcarg_space_comma.vim:19:14: vimlparser: E475: Invalid argument: White space is not allowed before comma
" sample
command! LintVimLParser :silent cexpr system('vimlparser ' . expand('%') . ' > /dev/null')
augroup lint-vimlparser
  autocmd!
  autocmd BufWritePost *.vim LintVimLParser
augroup END

Credit

@ynkdir for https://github.com/ynkdir/vim-vimlparser

🐦 Author

Original Author: haya14busa (https://github.com/haya14busa)

Maintenance Author: vim-jp

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].