Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upmacro parser should back out of failed nonterminal parsing #3232
Comments
This comment has been minimized.
This comment has been minimized.
|
+1 |
This comment has been minimized.
This comment has been minimized.
|
Is there an option (3)---require that the grammar be LALR(k) or something like that? Or does that fundamentally not work? |
This comment has been minimized.
This comment has been minimized.
|
That said: we should do (2) anyway, because it's lame that we cannot recover what-so-ever from parse failures. |
This comment has been minimized.
This comment has been minimized.
|
The macro parser doesn't do any lookahead at all, and LR(0) is probably too |
This comment has been minimized.
This comment has been minimized.
|
non-critical for 0.6, de-milestoning |
This comment has been minimized.
This comment has been minimized.
|
nominating for backwards-compatible milestone. though if we agree to do (2) here maybe we can push this to production ready. |
This comment has been minimized.
This comment has been minimized.
|
Adding nominated label, since I assume @graydon intended to nominate it to change the milestone. |
This comment has been minimized.
This comment has been minimized.
|
accepted for production-ready milestone |
graydon
referenced this issue
Jul 18, 2013
Closed
macro with repeating arguments fails with ambiguous parse #5902
This comment has been minimized.
This comment has been minimized.
|
Option (4): Break parsing into a separate task and pass parse_sess to it unsafely. |
This comment has been minimized.
This comment has been minimized.
|
`accepted for P-low. |
paulstansifer
self-assigned this
May 11, 2014
paulstansifer
removed their assignment
Jun 16, 2014
vadimcn
added a commit
to vadimcn/rust
that referenced
this issue
Oct 7, 2014
vadimcn
added a commit
to vadimcn/rust
that referenced
this issue
Oct 7, 2014
paulstansifer
referenced this issue
Nov 5, 2014
Closed
Decide on our long term/ideal goals for macros #440
This comment has been minimized.
This comment has been minimized.
|
Given that this is mentioned in rust-lang/rfcs#440, I'm going to be closing as 'not a bug' at this time, anyway. If we decide to improve macros, this is something that'd be nice to fix, for sure, but that RFC issue will be where that happens. |
paulstansifer commentedAug 20, 2012
Currently, the following macro argument grammar will not successfully parse anything, complaining of a "local ambiguity":
The problem is that if it were to use the Rust parser to try to parse a type and fail, the whole task would be killed. This is easy to fix after that problem is resolved. There are two options:
parse_sess, which is mutable state, and can't be shared. So the second option is probably more doable:do, and the parser would be able to stay in the standard imperative style.