Repository navigation
Add scope hack for compiler - #55
Conversation
|
Cannot say anything about it, sorry. |
| let node.value = curly_parts | ||
| endif | ||
| return node | ||
| endif |
There was a problem hiding this comment.
add indent space into previous line?
|
@haya14busa Ah, I just understand what you want to fix. |
| if (token.type != TOKEN_SQCLOSE) { | ||
| throw Err(viml_printf("unexpected token: %s", token.value), token.pos); | ||
| } | ||
| var left = node; |
There was a problem hiding this comment.
yes? Maybe I just don't understand what you asked?
It's exactly translated as I expected.
There was a problem hiding this comment.
Maybe, you don't expect var here, I guess.
There was a problem hiding this comment.
It works because it's "var", not "let".
Ideally, we may want to drop "var" here but it's not this p-r scope.
There was a problem hiding this comment.
Ah, right. hopefully we will fix this.
There was a problem hiding this comment.
VIm script's "let" ≒ JavaScript "var"
Cool! Easy to translate! Happy variable scope life! 😇 😇 😇
|
I think that this can not be maintained continuously. |
This change allow us to translate vimlparser.vim to other language (e.g. Go) which creates scope in "if" block.
5097858 to
a76da1c
Compare
|
Hmm... to be honest... I agree with you. This change is the most hackly one to create go-vimlparser and it's indeed hard to maintain. |
|
As I mentioned in this issue, #61 (comment) We can't fix this problem, I guess. To fix this issue, we must change current newer i.e. We can't use |
|
Hmmm... maybe there is miscommunication. If you talk about this problem as general vimltranslator, yes, we have to care about "exists()", but I think as far as the translater in this repository is for translating autoload/vimlparser.vim, we should not use "exist()" in the first place. It's indeed a problem if you want to create general Vim script (to JavaScript) translators, but it's not so high priority problem if you don't have plan to create it. |
|
@haya14busa I don't think your changes in this PR still have some problem. I just want to say that we can't make perfect compiler since specification of Vim scripts have ambiguous for that |
|
Oh, thank you for merging this. I was about to close this p-r and solve the problem by go-vimlparser side. Let's revert this p-r if there are maintainability problem. Feel free to revert it. Hopefully we can enjoy benefit, called "static type-check" by adding gocompiler.vim into this repository soom by including this p-r! |
|
Okay, I agree with your suggestion. looking forward your p-r. Or you will develop go version separated? |
Follow up of vim-jp#55 I forgot to change this function.
This change allow us to translate vimlparser.vim to
other language (e.g. Go) which creates scope in "if" block.