Okay, now that I have a better understanding of the limitations on macros,
I have a couple more questions.
First, the first limitation stated in the tutorial says that the parser is
greedy. However, a lot of the ambiguities referred to in the second
limitation would be eliminated if the parser
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
Alternation already exists, at least at the outer level:
macro_rules! alt_example(
( cons($e1:expr, $e2:expr) ) = ( ... )
( mt() ) = ( ... )
)
Of course, making use of it for something other than a whole macro
invocation requires the use of a helper macro, which can be tricky if the
On Tue, Feb 19, 2013 at 6:43 PM, Paul Stansifer paul.stansi...@gmail.comwrote:
Alternation already exists, at least at the outer level:
macro_rules! alt_example(
( cons($e1:expr, $e2:expr) ) = ( ... )
( mt() ) = ( ... )
)
Of course, making use of it for something other than a
It's just a matter of not having implemented it yet. Each new macro
invocation location unfortunately requires modifying the AST, which affects
all the code that is interested in that part of the AST. It's not a huge
amount of work, but it does inflict lots of can't happen error cases on
unrelated