-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add 'printer' feature: Restore source code string from AST #70
base: master
Are you sure you want to change the base?
Conversation
In go-vimlparser, I added ParenExpr which represents parenthesis expression, so we can handle the above cases. I have a plan to port it back to vim-vimlparser, but it's breaking changes, so I'm wondering how to do this. maybe flag ? |
ParenExpr sounds good!
👍 for flag argument of |
Implemented operator precedence, so |
How should I write printer tests of JS/Python? |
https://travis-ci.org/vim-jp/vim-vimlparser/jobs/305985385 |
How about |
I haven't checked the whole code, but I think |
@lesguillemets oh thanks! I'll give it a try. |
Without the above statement, cannot define print() method in Printer class
@lesguillemets thanks, it's all green now :) Now I'm wondering this feature should be in vim-vimlparser itself. I'll wait a few days to hear ideas, but maybe I'll create a new repository for printer. |
This is big change.
so I don't think I want this feature to get merged soon.
Disclaimer
This feature is not intended to restore full original source code.
This feature provides a way to get Vim script source code from AST which does same behavior as original source code.
What this feature provides?
Restore source code string from AST.
Here is the example.
Concern
[Todo] Currently1 + 2 * 3
becomes(1 + (2 * 3))
test/*.vimok
files which is same content asprinter.print(...)
, is it complicated?Reference
This is similar feature to printer of https://github.com/haya14busa/go-vimlparser , but as I said first, this PR aims to generate Vim script which does only same behavior, not literally generate same source code as original one.