Add information about the syntax used in ranges

... or ..=
This commit is contained in:
Badel2
2017-09-21 12:13:26 +02:00
parent 4737c5a068
commit 7aabf57278
4 changed files with 19 additions and 9 deletions

View File

@@ -538,10 +538,16 @@ pub enum BindingMode {
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum RangeEnd {
Included,
Included(RangeSyntax),
Excluded,
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum RangeSyntax {
DotDotDot,
DotDotEq,
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum PatKind {
/// Represents a wildcard pattern (`_`)
@@ -578,7 +584,7 @@ pub enum PatKind {
Ref(P<Pat>, Mutability),
/// A literal
Lit(P<Expr>),
/// A range pattern, e.g. `1...2` or `1..2`
/// A range pattern, e.g. `1...2`, `1..=2` or `1..2`
Range(P<Expr>, P<Expr>, RangeEnd),
/// `[a, b, ..i, y, z]` is represented as:
/// `PatKind::Slice(box [a, b], Some(i), box [y, z])`