vim-jp / vim-vimlparser

Vim script parser
Other
165 stars 25 forks source link

allow leading spaces for heredoc end marker #190

Closed lehmacdj closed 1 year ago

lehmacdj commented 2 years ago

The extra test cases that I include in test_heredoc.vim are accepted by vim (you can check by doing :source test/test_heredoc.vim but aren't accepted by this library and result in a parse error.

This was annoying me by making it impossible to lint a file in my vim config that extensively uses the let =<< heredocs with vint.

Fixes #188. let =<< was already supported, but I thought it wasn't because the correct behavior for trim wasn't implemented.

lehmacdj commented 2 years ago

sorry for the excessive force pushes, realized I forgot to handle trim and non-trim heredocs separately, but should be good to go now

lehmacdj commented 2 years ago

Is this ready to be merged or do I need to add more coverage? The codecov result is misleading because it's counting the python parser as a newly added file for some reason:

Screen Shot 2022-07-12 at 7 55 35 PM
lehmacdj commented 2 years ago

I added some more test coverage that should bring the patch coverage to 100% and prevent decreasing the overall test coverage percentage.

I also had added some negative test cases, unfortunately the line numbers returned in the errors are off by one between the javascript and the python/vim (which are consistent with each other). For example, I got the following result for one of my tests:

--- test/test_heredoc_fail_on_too_little_indent.out 2022-08-06 22:38:48.000000000 -0700
+++ test/test_heredoc_fail_on_too_little_indent.ok  2022-08-06 22:34:27.000000000 -0700
@@ -1 +1 @@
-vimlparser: E990: Missing end marker 'EOS': line 6 col 0
+vimlparser: E990: Missing end marker 'EOS': line 5 col 0
lehmacdj commented 1 year ago

@mattn is there anything that is blocking this change (other than merge conflicts)? Would be happy to make a revision if you would accept this patch with some revisions.

mattn commented 1 year ago

Thank you. Looks good to me. Could you please resolve conflicts?

lehmacdj commented 1 year ago

@mattn merged master rerunning make to regenerate the js and py parsers to resolve the conflicts!

mattn commented 1 year ago

Thank you.