Skip to content

Commit

Permalink
Expand docs on Macros By Example.
Browse files Browse the repository at this point in the history
The primary motivation here was to increase clarity and fully address the
scoping and naming details. The inclusion of RFC 550's formal specification is
to move it to the reference where it can be updated. I made several changes,
motivated by accommodating `?` and new fragment specifiers, but there are some
other things which need highlighting so that they can be double-checked for
correctness.

  * Permit the empty string to follow on in the first invariant; this is a
    technical oversight in the definition I believe.
  * Added a requirement that repetitions obey the follow rules; this was an
    oversight in the original RFC and currently planned for fix.
  * Rewrote the definition of FIRST for complex NTs to be more clear.
  * Added a case to LAST for `?` repetitions
  * Removed the last example of LAST, because it is wrong.
  * Rearranged the definition of FOLLOW to be more clear
  * Added Shl to FOLLOW(ty) and FOLLOW(path), as documented in the Reference
    already.
  * Added missing follow sets for newer fragment specifiers.

The scoping text is probably not completely accurate, but it's certainly much
better than what was there before (i.e. basically nothing).
  • Loading branch information
Alexis Hunt committed Feb 2, 2019
1 parent 62d4ff0 commit 5bf2d86
Show file tree
Hide file tree
Showing 5 changed files with 779 additions and 123 deletions.
10 changes: 5 additions & 5 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@

- [Constant Evaluation](const_eval.md)

[Appendix: Influences](influences.md)

[Appendix: As-yet-undocumented Features](undocumented.md)

[Appendix: Glossary](glossary.md)
- [Appendices](appendices.md)
- [Macro Follow-Set Ambiguity Formal Specification](macro-ambiguity.md)
- [Influences](influences.md)
- [As-Yet-Undocumented Features](undocumented.md)
- [Glossary](glossary.md)
1 change: 1 addition & 0 deletions src/appendices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Appendices
2 changes: 0 additions & 2 deletions src/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ which can be used to control type layout.
macros named. The `extern crate` must appear at the crate root, not inside
`mod`, which ensures proper function of the `$crate` macro variable.

- `macro_reexport` on an `extern crate` — re-export the named macros.

- `macro_export` - export a `macro_rules` macro for cross-crate usage.

- `no_link` on an `extern crate` — even if we load this crate for macros, don't
Expand Down
Loading

0 comments on commit 5bf2d86

Please sign in to comment.