Skip to content

Expand and clarify tokens. #390

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

Merged
merged 1 commit into from
Aug 15, 2018
Merged

Expand and clarify tokens. #390

merged 1 commit into from
Aug 15, 2018

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Aug 5, 2018

No description provided.

@ehuss
Copy link
Contributor Author

ehuss commented Aug 5, 2018

I'm open to feedback on this. I felt like tokens were underdocumented and widely dispersed.

Notes:

  • I kinda like the cross-referencing, but I'm not sure if it is a good idea.
  • The cross references include some potentially confusing parsing situations. For example, the token >>= is normally for shift right assignment, but could also be nested generics followed by assignment. I'm not sure if I covered every situation where rust splits the tokens based on context. Perhaps this should be explicitly described?
  • The symbol names are otherwise unused, so I'm not sure if they serve a purpose.
  • This also introduces some new terminology (punctuation, delimiters) which doesn't have much precedent.
  • I renamed :: to PathSep from ModSep since it can be used in much more than just modules and I felt that could be confusing.
  • I noticed some parts of the reference grammar do not make token separation clear. For example an inner attribute is made of separate tokens #, !, [,..., ]. I could in a separate PR attempt to make that clearer?
  • I think I got everything correct, but there were a few tricky bits. For example, underscore isn't really mentioned anywhere as a token, and in rustc internally it is parsed as a keyword, but I think it makes more sense to keep it as a punctuation token since keywords are typically actual words.
  • I couldn't find _ used in inferred types documented anywhere.
  • I left out deprecated/unused/unstable tokens.

@Havvy
Copy link
Contributor

Havvy commented Aug 6, 2018

A first pass look over this and it looks good to me.

@Havvy Havvy merged commit e606d63 into rust-lang:master Aug 15, 2018
@Havvy
Copy link
Contributor

Havvy commented Aug 15, 2018

💟 Thanks! The table is definitely much more useful than just linking to the operands page.

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