Close parens are not required?
mitchellwrosen opened this issue · 1 comments
This expression seems to be valid (and parses as if the )
was there):
a = 5 * (6
At the moment, the parser doesn't distinguish among closing tokens. So the layout block inserts closing tokens which closes the parens. It's conceptually no different than languages that use the keyword end
to terminate multiple kinds of expressions. You could think of this as a feature - you can be a little sloppier when writing the code (it will still get printed with parens correctly) and mismatched parens don't generally result in crazy errors way later in the file.
Anyway, it's a bit weird but it hasn't really bothered me too much.
If we wanted to change the behavior, I'd change the Close
token to Close String
to indicate the closing token type.
I am curious if anyone has strong feelings about it.