> Any idea why? () could be considered an expression, but it's not in an
> expression position, and a lot of things could be considered expressions
> and don't do this.
>
The local ambiguity errors exist for the internal reason that the Rust
parser `fail`s (I guess now it `die!`s) when it gets a parse error.
Therefore, the macro system refuses to start parsing a nonterminal (in this
case, expr), unless it can conclusively rule out all other options (in this
case, I think, the token ")", which occurs if there are 0 exprs in that
sequence), using one character of lookahead. And it isn't aware what
nonterminals can and can't start with, so the fact that ")" isn't the
beginning of an expression isn't useful to it (hm. It'd be a bit of a hack,
since we'd need to manually generate a table of acceptable start tokens,
but maybe adding that feature would make macro writing easier.). The
general solution is to make sure that the first thing inside a `$(...)*`
isn't a `$name:nt`. I think the macro tutorial (or possible the reference
guide) may have more information.

Paul
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to