-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macro parser should back out of failed nonterminal parsing #3232
Comments
+1 |
Is there an option (3)---require that the grammar be LALR(k) or something like that? Or does that fundamentally not work? |
That said: we should do (2) anyway, because it's lame that we cannot recover what-so-ever from parse failures. |
The macro parser doesn't do any lookahead at all, and LR(0) is probably too |
non-critical for 0.6, de-milestoning |
nominating for backwards-compatible milestone. though if we agree to do (2) here maybe we can push this to production ready. |
Adding nominated label, since I assume @graydon intended to nominate it to change the milestone. |
accepted for production-ready milestone |
Option (4): Break parsing into a separate task and pass parse_sess to it unsafely. |
`accepted for P-low. |
…g options..." error in macros, which often occurs when trying to match parts of Rust syntax. For example, this matcher: `fn $name:ident( $($param:ident : $pty:ty),* )` would fail when parsing `fn foo()`, because macro parser wouldn't realize that an ident cannot start with `)`. This resolves rust-lang#5902, and at least partially mitigates rust-lang#9364 and rust-lang#3232.
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. |
Fix formatting in Configurations.md
Add support for History Expressions. This allows an ensures clause to evaluate expressions before the function runs, bing them to anonymous variables and use them after calculating the result to be able to compare to the state before the function evaluation. Resolves rust-lang#2803 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --------- Co-authored-by: Matias Scharager <[email protected]> Co-authored-by: Justus Adam <[email protected]> Co-authored-by: Felipe R. Monteiro <[email protected]>
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.The text was updated successfully, but these errors were encountered: