Skip to content

Commit

Permalink
feat: implemented a parser combinator in Lua
Browse files Browse the repository at this point in the history
  • Loading branch information
lervag committed Nov 30, 2024
1 parent 44a2f12 commit 9f925fe
Show file tree
Hide file tree
Showing 11 changed files with 1,325 additions and 3 deletions.
12 changes: 12 additions & 0 deletions autoload/vimtex/parser/bib.vim
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,18 @@ endfunction

" }}}1

function! s:parse_with_luanew(file) abort " {{{1
if !has('nvim')
call vimtex#log#error(
\ 'bib parser backend "lua" only works with neovim!')
return []
endif

return luaeval('require("vimtex.parser.newbib").parse_file(_A)', a:file)
endfunction

" }}}1

function! s:parse_with_vim(file) abort " {{{1
" Adheres to the format description found here:
" http://www.bibtex.org/Format/
Expand Down
6 changes: 3 additions & 3 deletions autoload/vimtex/test.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

function! vimtex#test#finished() abort " {{{1
for l:error in v:errors
let l:match = matchlist(l:error, '\(.*\) line \(\d\+\): \(.*\)')
let l:match = matchlist(l:error, '\(.*\)\( line \(\d\+\)\)\?: \(.*\)')
let l:file = fnamemodify(l:match[1], ':.')
let l:lnum = l:match[2]
let l:msg = l:match[3]
let l:lnum = l:match[3]
let l:msg = l:match[4]

if l:msg =~# 'Expected .*but got'
call s:print_expected_but_got(l:file, l:lnum, l:msg)
Expand Down
Loading

0 comments on commit 9f925fe

Please sign in to comment.