Closed flying-sheep closed 8 years ago
:+1:. This is how I did it in the CoffeeScriptRedux compiler.
IIRC, that would also help out with some other tricky issues. Like the old implicit call rewriter kludge.
@jashkenas I think that particular issue was fixed in commit 76c076db555c9ac7c325c3b285cd74644a9bf0d2 ;) But I do agree that information is lost in many places in the parser.
string interpolation like
"A #{a} B #{b}"
is lexed as if it was'A '+a+' B '+b
Just a FYI: this is not true. But it is true that the AST looks the same. grammar.coffee:150.
awesomesauce! This would be super helpful
@juliankrispel I'm working on this (and have come very far, all tests are currently passing): https://github.com/lydell/coffee-script/tree/node-types
@lydell omg this is amazing. Tbh I'm not sure what I'm looking at but it's amazing nonetheless :D
i hope you’re looking at lydell/coffee-script@5e54fc478f95a8a133c7d88f20600b7caf2fdee0, which is mostly new, more specific Node classes.
one of which being StringWithInterpolations
, i.e. what we need.
changes like this tell me that doing the other stuff also is a very good idea!
It should also fix some other long-standing bugs like this
Hi, as seen in #3831, string interpolation like
"A #{a} B #{b}"
is lexed as if it was'A '+a+' B '+b
.as mentioned in juliankrispel/decaf#2, there are use cases for having the semantic information survive lexing.
Therefore it would be awesome if we could introduce a new
StringInterpolation
AST node which is later converted to a concatenation expression.