On Wed, Apr 25, 2012 at 04:27:38PM -0500, David Nicol wrote:
>
> Challenge: Can anyone come up with an ambiguous expression where it is
> not clear if the expression is supposed to be an R-value if-statement
> (were such things allowed) or a trailing conditional?
Yes and no.
Consider:
push @x => "foo", if (1) {"bar"} else {"baz"};
this isn't ambiguous if you look at it as a whole, but it is ambiguous
the moment the parser encounters the "if", and it cannot unambiguate it
by looking one token (or any fixed amount of tokens) ahead -- it actually
will have to look at the token past the ')' to do so.
Abigail
Thread Previous
|
Thread Next