grasp icon indicating copy to clipboard operation
grasp copied to clipboard

add test case for nested typed expression

Open ksheedlo opened this issue 9 years ago • 3 comments

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.

ksheedlo avatar May 02 '15 19:05 ksheedlo

Not to be merged until a fix is found, since this will break the build.

ksheedlo avatar May 02 '15 19:05 ksheedlo

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.

ksheedlo avatar May 02 '15 20:05 ksheedlo

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.

gkz avatar May 03 '15 06:05 gkz