Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in parsing #18

Open
junkblocker opened this issue Sep 27, 2016 · 6 comments
Open

Errors in parsing #18

junkblocker opened this issue Sep 27, 2016 · 6 comments

Comments

@junkblocker
Copy link

Thanks for making viml parsing super fast! I have a bug: For the following code from vim-go, the following issue with parsing is seen:

/Users/xxxxxxxx/.vim/neobundles/vim-go/autoload/go/coverage.vim:92:1: vimlparser: E171: Missing :endif:    ENDFUNCTION
" Clear clears and resets the buffer annotation matches
function! go#coverage#Clear()
  " only reset the syntax if the user has syntax enabled
  if !empty(&syntax)
    if exists("g:syntax_on") | syntax enable | endif
  endif

  if exists("s:toggle") | let s:toggle = 0 | endif

  " remove the autocmd we defined 
  if exists("#BufWinLeave#<buffer>") 
    autocmd! BufWinLeave <buffer>
  endif

  call clearmatches()
endfunction
@haya14busa
Copy link
Member

This is a vimlparser problem.

It fails to parse if 1 | syntax enable | endif.
If you change syntax enable to let x = 1 or something, vimlparser can parse it, so it might be the problem of parsing syntax command with if and |.

@haya14busa
Copy link
Member

I fixed it by #21 (it's somewhat workaround though...)

@junkblocker
Copy link
Author

junkblocker commented Sep 27, 2016

Thanks, @haya14busa, it does seem to cause or detect newer issues.

syn match pythonError       "[&|]\{2,}" display
.vim/syntax/python.vim:135:28: vimlparser: E492: Not an editor command: ]\{2,}" display
  syntax match qfFileName /^\zs\S[^|]\+\/\ze[^|\/]\+\/[^|\/]\+|/ conceal cchar=+
.vim/after/ftplugin/qf.vim:124:37: vimlparser: E492: Not an editor command: ]\+\/\ze[^|\/]\+\/[^|\/]\+|/ conceal cchar=+

are a couple of examples. I am doing quick tests (thanks to go-vimlparser 's speed) like so

vimlparser .vim/**/*.vim 2>&1 | grep -E ':\d+:\d+: vimlparser:' | vim -

@haya14busa
Copy link
Member

haya14busa commented Sep 27, 2016

Thanks! hmm... it seems to fail to handle | in string or //.

@haya14busa
Copy link
Member

I fixed it. #22

Can you please update and try again?

I also runs vimlparser commands for all vim script under .vim and it worked.

@junkblocker
Copy link
Author

Thanks for the quick turnaround! Seems most of the problems are gone and only syn region is slightly broken. May I suggest running it on any vim plugin manager bundle directories you have (and try not to be sad when you see all the broken code go-vimlparser detects in so many plugins :( :) ) for more coverage? Here are some issues on some of the plugins I use:

From HybridText:

syn region txtBlock start=+^ *|+ end=+$+
.vim/neobundles/HybridText/syntax/hybrid.vim:213:34: vimlparser: E580: :endif without :if

From jedi-vim:

    syn region rstPythonRegion start=/^\v {4}/ end=/\v^( {4}|\n)@!/ contains=@rstPythonScript
.vim/neobundles/jedi-vim/autoload/jedi.vim:312:62: vimlparser: E10: \\ should be followed by /, ? or &

From vim-go a very interesting expression:

      % | " Couldn't detect gofmt error format, output errors
.vim/neobundles/vim-go/autoload/go/fmt.vim:185:9: vimlparser: E492: Not an editor command: | " Couldn't detect gofmt error format, output errors

However that runs fine in vim, just cat'ing the current source file.

There is a different issue with embedded python code but that probably should be dealt with in a separate bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants