Repository navigation
feat(parser): support === and !== operators - #1500
pkozlowski-opensource wants to merge 1 commit into
Conversation
|
@vicb I was a bit surprised to see that |
|
Dart doesn't support |
|
Oh, good - we should be fine then! |
There was a problem hiding this comment.
Doesn't this only work because by luck '=' = '=' ? (ie should we add three ?)
There was a problem hiding this comment.
@vicb not sure I got you here. We are getting a right token out of lexer: pkozlowski-opensource@8d58892#diff-97c47bfad039c045846c9d65a42b72f9R161
I'm pushing even more tests :-)
There was a problem hiding this comment.
I haven't looked at the details but you do str += two multiple times, is that right or does this happen to work because the tokens end with a doubled symbol (2*=) ?
There was a problem hiding this comment.
and what if ======================
There was a problem hiding this comment.
It works since both !== and === and with the same two (=) token. And at the end we do verify that what got built is a real operator, see: pkozlowski-opensource@9e5c882#diff-64a5b021a00571a4aa77bbc3c3c08057R311
So I guess there is some kind of back-tracking mechanism (?). But even if there would, I guess it would be less efficient than just introducing 3rd arg. Let me change the code.
There was a problem hiding this comment.
@vicb actually I think we are fine with the current impl. I was trying to break it with many use cases but can't. For example, if you do ====================== you will just get an invalid operator ====================== with the current impl. If we are more explicit we would get several tokens with the === which would be an invalid expression anyway. So we would just do more work for nothing....
8d58892 to
9e5c882
Compare
|
@vicb I've pushed an update with more tests. I'm still not sure about your comment. Can you think of a test that would show it breaking? |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Closes #1496