Uh oh!
There was an error while loading. Please reload this page.
Add 'printer' feature: Restore source code string from AST - #70
Conversation
haya14busa
commented
Nov 21, 2017
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 ? |
tyru
commented
Nov 21, 2017
ParenExpr sounds good!
👍 for flag argument of |
tyru
commented
Nov 22, 2017
Implemented operator precedence, so |
tyru
commented
Nov 22, 2017
How should I write printer tests of JS/Python? |
tyru
commented
Nov 22, 2017
https://travis-ci.org/vim-jp/vim-vimlparser/jobs/305985385 |
tyru
commented
Nov 22, 2017
How about |
lesguillemets
commented
Nov 23, 2017
I haven't checked the whole code, but I think |
tyru
commented
Nov 23, 2017
@lesguillemets oh thanks! I'll give it a try. |
Without the above statement, cannot define print() method in Printer class
tyru
commented
Nov 23, 2017
@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 * 3becomes(1 + (2 * 3))test/*.vimokfiles 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.