Skip to content
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

Parse box pattern syntax #95

Merged
merged 3 commits into from
Oct 7, 2017
Merged

Parse box pattern syntax #95

merged 3 commits into from
Oct 7, 2017

Conversation

matprec
Copy link
Contributor

@matprec matprec commented Oct 7, 2017

Fixes #93

Copy link
Owner

@shepmaster shepmaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful, thank you! Just some small tweaks, if you don't mind.

src/lib.rs Outdated
@@ -2855,6 +2865,7 @@ shims! [
(asterisk, Token::into_asterisk, Error::ExpectedAsterisk),
(at, Token::into_at, Error::ExpectedAt),
(bang, Token::into_bang, Error::ExpectedBang),
(box_pattern, Token::into_box, Error::ExpectedBox),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just reuse kw_box, defined above (kw_ is to avoid conflict with the real keyword) :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah dang, i knew it would be there but must have missed it! :D

src/lib.rs Outdated
@@ -5337,6 +5361,12 @@ mod test {
}

#[test]
fn fn_with_arguments_with_box_pattern() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's safe to remove this test; we already cover that functions use the general set of "pattern" above. The presence of this test makes it look like there's something extra-special about box patterns in function arguments, which there isn't.

src/lib.rs Outdated
@@ -1631,6 +1631,7 @@ pub enum PatternKind {
String(PatternString),
Struct(PatternStruct),
Tuple(PatternTuple),
Box(PatternBox)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and place this alphabetically in the list, please.

@matprec matprec force-pushed the master branch 2 times, most recently from 3fdff39 to 0233796 Compare October 7, 2017 16:00
@matprec
Copy link
Contributor Author

matprec commented Oct 7, 2017

Addressed your comments, should be fine now :) Thanks!

@shepmaster shepmaster merged commit 827a792 into shepmaster:master Oct 7, 2017
@shepmaster
Copy link
Owner

Superb! Thanks again!

If you don't mind me asking, how have you found using this library? Are you using it for anything exciting you want to share?

@matprec
Copy link
Contributor Author

matprec commented Oct 7, 2017

Exams are over and i finally have time to rewrite explain-rs. (Rewrite because syntex is no longer maintained).

Why i didn't choose syn / choose yours:

  • Span support is somewhat unstable and tied to the compiler
  • Error messages, somewhat similar to the compiler
  • Since your crate is tailored for analysis, i hope to benefit from overall more ergnomic things. I've experienced a few papercuts when using syn, but that makes sense, considering that syns main usecase is deriving

Your crate is mentioned though strata-rust several times in the issues of syn, mostly as a "this is how it should be done" example.

@shepmaster
Copy link
Owner

Cool! As far as I know, I'm the only other user of this crate, so I'm probably blind to my own set of papercuts. Feel free to file an issue if you find any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants