Created by: natefaubion
To elaborate: In order to use an infix macro, like a => a + 1 where => is the macro, we have to be greedy about enforesting expressions in get_expression. The first a is an expression itself, but what the user intuitively wants is for the whole thing to be a single expression. So we have to try enforesting the next token afterwards, and see if it extends the original expression. With semicolons, it just gets a punctuator back and stops. Without the semicolon, it hits another const which kicks off a nested call to enforestVarStatement which kicks off let renaming. It then gets back to the original get_expression and it decides it has not extended the original expression. So in my example in #207 (closed), the bar const is actually enforested twice. Once to see if it extends 1 as an expression, and again afterwards.
The problem results from get_expression. When we get to the end, we need to return the peek which contains the correctly renamed rest, instead of just returning next. It's very subtle. I also put a guard on the loop to only keep enforesting if the next token is a macro. All we are looking for is to see if the next token is a macro that extends the expression, so it's guarding what we are looking for anyway.