Skip to content

Commit 1a6f551

Browse files
committed
---
yaml --- r: 38580 b: refs/heads/incoming c: bb4dd06 h: refs/heads/master v: v3
1 parent 6835707 commit 1a6f551

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: 140d16ac5803a0e7b61d0f901a82549c09e4411f
9+
refs/heads/incoming: bb4dd06307ecb29621416076963d3853e17e55bc
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/doc/rust.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,13 @@ only be invoked in expression position.
501501
any token other than a delimiter or `$`.)
502502

503503
Macro invocations are looked up by name, and each macro rule is tried in turn;
504-
the first successful match is transcribed. The matching and transcribing
504+
the first successful match is transcribed. The matching and transcription
505505
processes are closely related, and will be described together:
506506

507507
### Macro By Example
508508

509-
Everything that does not begin with a `$` is matched and transcirbed
510-
literally, including delimiters. For parsing reasons, they must be matched,
511-
but they are otherwise not special.
509+
The macro expander matches and transcribes every token that does not begin with a `$` literally, including delimiters.
510+
For parsing reasons, delimiters must be balanced, but they are otherwise not special.
512511

513512
In the matcher, `$` _name_ `:` _designator_ matches the nonterminal in the
514513
Rust syntax named by _designator_. Valid designators are `item`, `block`,
@@ -517,11 +516,11 @@ are the right-hand side and the left-hand side respectively of the `=>` in
517516
macro rules. In the transcriber, the designator is already known, and so only
518517
the name of a matched nonterminal comes after the dollar sign.
519518

520-
In bothe the matcher and transcriber, the Kleene star-like operator,
521-
consisting of `$` and parens, optionally followed by a separator token,
522-
followed by `*` or `+`, indicates repetition. (`*` means zero or more
523-
repetitions, `+` means at least one repetition. The parens are not matched or
524-
transcribed). On the matcher side, a name is bound to _all_ of the names it
519+
In both the matcher and transcriber, the Kleene star-like operator indicates repetition.
520+
The Kleene star operator consists of `$` and parens, optionally followed by a separator token, followed by `*` or `+`.
521+
`*` means zero or more repetitions, `+` means at least one repetition.
522+
The parens are not matched or transcribed.
523+
On the matcher side, a name is bound to _all_ of the names it
525524
matches, in a structure that mimics the structure of the repetition
526525
encountered on a successful match. The job of the transcriber is to sort that
527526
structure out.
@@ -550,19 +549,16 @@ Rust syntax is restricted in two ways:
550549
1. The parser will always parse as much as possible. If it attempts to match
551550
`$i:expr [ , ]` against `8 [ , ]`, it will attempt to parse `i` as an array
552551
index operation and fail. Adding a separator can solve this problem.
553-
2. The parser must have eliminated all ambiguity by the time it reaches a
554-
`$` _name_ `:` _designator_. This most often affects them when they occur in
555-
the beginning of, or immediately after, a `$(...)*`; requiring a distinctive
556-
token in front can solve the problem.
552+
2. The parser must have eliminated all ambiguity by the time it reaches a `$` _name_ `:` _designator_.
553+
This requirement most often affects name-designator pairs when they occur at the beginning of, or immediately after, a `$(...)*`; requiring a distinctive token in front can solve the problem.
557554

558555

559556
## Syntax extensions useful for the macro author
560557

561558
* `log_syntax!` : print out the arguments at compile time
562-
* `trace_macros!` : supply `true` or `false` to enable or disable printing
563-
of the macro expansion process.
564-
* `ident_to_str!` : turns the identifier argument into a string literal
565-
* `concat_idents!` : creates a new identifier by concatenating its arguments
559+
* `trace_macros!` : supply `true` or `false` to enable or disable printing of the macro expansion process.
560+
* `ident_to_str!` : turn the identifier argument into a string literal
561+
* `concat_idents!` : create a new identifier by concatenating the arguments
566562

567563

568564

0 commit comments

Comments
 (0)