grasp
grasp copied to clipboard
add test case for nested typed expression
This change adds a test case for #62. Stepping through in the debugger
suggests that both selectors are run against the same AST. Since the
_str$s
variable matches an AST nested inside the $e
expression and
the $e
expression appears first, the intended _str$s
is not found.
Not to be merged until a fix is found, since this will break the build.
I'd be interested to see if this problem can be solved while keeping the existing replacement algorithm using String.prototype.replace
. One way I could see trying to do it would be to replace AST nodes that have already been matched against with some special marker, so that the replacement algorithm can ignore them as they have already been matched against.
Another way to do it would be to compile the search and replacement strings and have a function to match against the AST all at once, but this would likely require an overhaul of the existing algorithm.
Thanks for looking into this. I'm focused on getting the next version of LiveScript out, but after that I'll take a look at the various Grasp issues.