vim-vimlparser icon indicating copy to clipboard operation
vim-vimlparser copied to clipboard

Introduce parentheses expression node

Open haya14busa opened this issue 8 years ago • 6 comments
trafficstars

This p-r indroduces s:NODE_PARENEXPR node which represents (...) expression.

Prior to this change, vimlparser completely dropped (...) data, so we cannot know binary expression is surrouneded with () or not. For exampele, if we want to write printer of Vim AST, 1 + 2 * 3 becomes (1 + (2 * 3)) ref: #70

One big problem is that it's breaking feature. Existing vimlparser users have to update to handle new node.

At first i thought we can add a flag to enable it, but on second thought, it's not good to change how vimlparser works by flag and it will slows down future development.

Instead, maybe we can notify vimlparser users to update script and/or make p-r for this change. Fortunately, it will be really easy changes.

What do you think?

haya14busa avatar Nov 23 '17 12:11 haya14busa

it's good to change how vimlparser works by flag

👍

tyru avatar Nov 23 '17 12:11 tyru

Oh, i'm sorry, i mistyped. I mean it's not good (≒ bad) to use flag to change the behavior. I edited the original comment.

haya14busa avatar Nov 23 '17 13:11 haya14busa

oh, okay.

it's not good to change how vimlparser works by flag and it will slows down future development.

What "it will slows down future development" mean? Are you concerned about parsing time gets slow?

Hmm, I have no idea yet to tell vimlparser to parse differently.

tyru avatar Nov 23 '17 15:11 tyru

Hmm, I have no idea yet to tell vimlparser to parse differently.

I mean, "parsing differently" itself is bad idea. What will we do when adding another node in the future? adding yet another flag? How about tests? Do we have to test all possible option set? Maybe not.

Instead, I propose that we give up preserving backward compatibility. and notify vimlparser users to change their code or/and I'll make pull-request to their repository. (vim-lint, vint, etc...)

In addition to it, I propose that making vimlparser https://github.com/vim-jp/vital.vim compatible interface to avoid compatibility issues.

haya14busa avatar Nov 23 '17 23:11 haya14busa

hmm, I see.

I'm just planning to vitalize vimlparser. Fortunately, vimlparser code is well organized so it's not difficult to generate vital interface, I think.

However, I cannot understand why creating vimlparser interface in vital avoids compatibility issue. The vital interface modifies AST to keep backward compatibility after parsing?

tyru avatar Nov 24 '17 04:11 tyru

for example, vim-vimlint uses vim-jp/vimlparser and once we push this change, vimlint will break instantly. A lot of users uses vim-vimlint in CI service and it suddenly fails.

If vimlint use vimlparser through vital.vim, this problem won't happen.

haya14busa avatar Nov 24 '17 08:11 haya14busa