@@ -710,6 +710,7 @@ A *placeholder* may occur in circumstances where a type or const value is not re
710
710
[mut - ptr- type ]: #mut - ptr- type
711
711
[fn - type ]: #fn - type
712
712
[dyn - trait - type ]: #dyn - trait - type
713
+ [pattern- type ]: #pattern- type
713
714
714
715
> type → \
715
716
> & nbsp;& nbsp ;& nbsp ;& nbsp ;& nbsp ; * [basic - type ]* \
@@ -722,6 +723,7 @@ A *placeholder* may occur in circumstances where a type or const value is not re
722
723
> & nbsp ;& nbsp ; | * [mut - ptr - type ]* \
723
724
> & nbsp ;& nbsp ; | * [fn - type ]* \
724
725
> & nbsp ;& nbsp ; | * [dyn - trait - type ]* \
726
+ > & nbsp ;& nbsp ; | * [pattern - type ]* \
725
727
> & nbsp ;& nbsp ; | * [path ]* \
726
728
> & nbsp ;& nbsp ; | * [backref ]*
727
729
@@ -830,6 +832,23 @@ Remaining primitives are encoded as a crate production, e.g. `C4f128`.
830
832
[fn - sig ]: #fn - sig
831
833
[abi ]: #abi
832
834
835
+ * `W ` — A [pattern - type ][pattern - tpye ] `u32 is 0 .. 100 `.
836
+ > <span id = " pattern-type" >pattern - type </ span > → `W ` * [pattern - kind ]*
837
+ >
838
+ > <span id = " pattern-kind" >pattern - kind </ span > → \
839
+ > & nbsp ;& nbsp ;& nbsp ;& nbsp ;& nbsp ; * [range - pattern - kind ]* \
840
+ > & nbsp ;& nbsp ; * [or - pattern - kind ]*
841
+ >
842
+ > <span id = " range-pattern-kind" >range - pattern - kind </ span > → `R ` * [const ]* * [const ]*
843
+ >
844
+ > <span id = " or-pattern-kind" >or - pattern - kind </ span > → `O ` * [pattern - kind ]* `E `
845
+
846
+ While or patterns can be nested in theory , in practice this does not happen and they are instead flattened .
847
+
848
+ Range patterns have a start and end constant that are both included in the range .
849
+ The end must be larger than the start (there can be no wraparound ). To emulate wraparound ,
850
+ you need to use an or pattern of the two ranges to the upper limit and from the lower limit.
851
+
833
852
* `D ` — A [trait object][reference- trait - object] `dyn Trait <Assoc = X > + Send + 'a`.
834
853
835
854
> <span id= "dyn - trait - type ">dyn - trait - type </ span> → `D ` * [dyn - bounds]* * [lifetime]*
@@ -1139,6 +1158,7 @@ The following is a summary of all of the productions of the symbol grammar.
1139
1158
> & nbsp ;& nbsp ; | * [mut - ptr - type ]* \
1140
1159
> & nbsp ;& nbsp ; | * [fn - type ]* \
1141
1160
> & nbsp ;& nbsp ; | * [dyn - trait - type ]* \
1161
+ > & nbsp ;& nbsp ; | * [pattern - type ]* \
1142
1162
> & nbsp ;& nbsp ; | * [path ]* \
1143
1163
> & nbsp ;& nbsp ; | * [backref ]*
1144
1164
>
@@ -1152,6 +1172,14 @@ The following is a summary of all of the productions of the symbol grammar.
1152
1172
> [mut - ptr - type ] → `O ` * [type ]* \
1153
1173
> [fn - type ] → `F ` * [fn - sig ]* \
1154
1174
> [dyn - trait - type ] → `D ` * [dyn - bounds ]* * [lifetime ]*
1175
+ > [pattern - type ] → `W ` * [pattern - kind ]*
1176
+ >
1177
+ > [pattern - kind ] → \
1178
+ > & nbsp ;& nbsp ;& nbsp ;& nbsp ;& nbsp ; * [range - pattern - kind ]* \
1179
+ > & nbsp ;& nbsp ; * [or - pattern - kind ]*
1180
+ >
1181
+ > [range - pattern - kind ] -> `R ` * [const ]* * [const ]* \
1182
+ > [or - pattern - kind ] -> `O ` * [pattern - kind ]* `E ` \
1155
1183
>
1156
1184
> [namespace ] → * [lower ]* | * [upper ]*
1157
1185
>
0 commit comments