-
Notifications
You must be signed in to change notification settings - Fork 148
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
Custom attributes parser #198
Conversation
My newly added tests obviously can't be compiled on Rust 1.21.0, because the feature in question is supported in 1.34.0. I'm not sure how to proceed with those tests in the best way. The issue is similar to Perhaps I can |
We can just skip the tests on rust 1.21. If it compils, and tests are passing using latest stable rust, there is no reason that it would not work with 1.21 for the usable features. |
I may take a bit of time to review this PR as it's quite long. |
Ok, so we should update
Is it the right way to do it in Travis? If so, I can add that change to this PR. |
Ok, I've changed |
Yep, it's working. |
Note that 'full' version of A quote from
|
As noted in #200, v0.2.17 was a breaking change version. Thus, I've yanked the version, and updated the minimal rust version to 1.34. The plan is to put the new version in v0.3. v0.3 "need" a edition 2018 before publishing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! It will be a big improvement!
1fdbebf
to
bc0d76d
Compare
bc0d76d
to
7f4b61b
Compare
7605bc2
to
7afc374
Compare
I've implemented the requested changes, could you please take a look again? Thank you! |
I've improved the error messages from As a side note: this pull request is getting longer and longer (already at 18 commits!) and it's becoming harder to maintain: to rebase it or to merge the other changes in... |
Yes, sorry, that's the priority now. Will try to review it soon. No other PR will be merged before this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really great!
Just a small test to remove, and I merge this PR.
Thanks again!
raw attributes were removed in TeXitoi/structopt#198
this was approach was removed from structopt in TeXitoi/structopt#198
Closes #178
I've added a new module:
parse.rs
, which contains an intermediate representation forstructopt
attributes. This representation reflects domain-specific attributes ofstructopt
and is used instead of genericsyn.Meta
, which played a similar role in the previous version of the code. This allows parsing arbitrary expressions instead of String literals in attribute values. I tried to keep those intermediate structures low-level, i.e. closer to the token level, so that it's easy to writeParse
trait implementations for them. Later, they are converted to more high-level representation inattrs
module.I didn't change the parsing of doc-comments, since they are not affected by the introduction of arbitrary tokens in attributes in Rust 1.34. So
syn.Meta
is still used there.Please take a look at the code: if you like the approach, I'll add some notes to the documentation and the ChangeLog.
Thank you!