about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
diff options
context:
space:
mode:
authorAlex Burka <aburka@seas.upenn.edu>2016-01-13 01:23:31 -0500
committerAlex Burka <aburka@seas.upenn.edu>2016-02-27 02:01:41 -0500
commit5daf13cae371ce4ee90450a1d3006b53395a40d7 (patch)
tree6849c2db6354ec908cf1f51e9e9e3b5b33e58851 /src/libsyntax/ast.rs
parentc5d58de665819f7330b3d64bdd084d25a412830a (diff)
downloadrust-5daf13cae371ce4ee90450a1d3006b53395a40d7.tar.gz
rust-5daf13cae371ce4ee90450a1d3006b53395a40d7.zip
libsyntax: parse inclusive ranges
Diffstat (limited to 'src/libsyntax/ast.rs')
-rw-r--r--src/libsyntax/ast.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 23bb6fd141a..0dbfb2c7be6 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -886,6 +886,15 @@ impl fmt::Debug for Expr {
     }
 }
 
+/// Limit types of a range (inclusive or exclusive)
+#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
+pub enum RangeLimits {
+    /// Inclusive at the beginning, exclusive at the end
+    HalfOpen,
+    /// Inclusive at the beginning and end
+    Closed,
+}
+
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
 pub enum ExprKind {
     /// A `box x` expression.
@@ -974,8 +983,8 @@ pub enum ExprKind {
     TupField(P<Expr>, Spanned<usize>),
     /// An indexing operation (`foo[2]`)
     Index(P<Expr>, P<Expr>),
-    /// A range (`1..2`, `1..`, or `..2`)
-    Range(Option<P<Expr>>, Option<P<Expr>>),
+    /// A range (`1..2`, `1..`, `..2`, `1...2`, `1...`, `...2`)
+    Range(Option<P<Expr>>, Option<P<Expr>>, RangeLimits),
 
     /// Variable reference, possibly containing `::` and/or type
     /// parameters, e.g. foo::bar::<baz>.