@@ -51,13 +51,23 @@ designator is already known, and so only the name of a matched nonterminal comes
51
51
after the dollar sign.
52
52
53
53
In both the matcher and transcriber, the Kleene star-like operator indicates
54
- repetition. The Kleene star operator consists of ` $ ` and parentheses, optionally
55
- followed by a separator token, followed by ` * ` or ` + ` . ` * ` means zero or more
56
- repetitions, ` + ` means at least one repetition. The parentheses are not matched or
57
- transcribed. On the matcher side, a name is bound to _ all_ of the names it
58
- matches, in a structure that mimics the structure of the repetition encountered
59
- on a successful match. The job of the transcriber is to sort that structure
60
- out.
54
+ repetition. The Kleene star operator consists of ` $ ` and parentheses,
55
+ optionally followed by a separator token, followed by ` * ` , ` + ` , or ` ? ` . ` * `
56
+ means zero or more repetitions; ` + ` means _ at least_ one repetition; ` ? ` means
57
+ at most one repetition. The parentheses are not matched or transcribed. On the
58
+ matcher side, a name is bound to _ all_ of the names it matches, in a structure
59
+ that mimics the structure of the repetition encountered on a successful match.
60
+ The job of the transcriber is to sort that structure out. Also, ` ? ` , unlike ` * `
61
+ and ` + ` , does _ not_ allow a separator, since one could never match against it
62
+ anyway.
63
+
64
+ > ** Edition Differences** : The ` ? ` Kleene operator did not exist before the
65
+ > 2018 edition.
66
+
67
+ > ** Edition Differences** : Prior to the 2018 Edition, ` ? ` was an allowed
68
+ > separator token, rather than a Kleene operator. It is no longer allowed as a
69
+ > separator as of the 2018 edition. This avoids ambiguity with the ` ? ` Kleene
70
+ > operator.
61
71
62
72
The rules for transcription of these repetitions are called "Macro By Example".
63
73
Essentially, one "layer" of repetition is discharged at a time, and all of them
0 commit comments