about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs37
-rw-r--r--src/libsyntax/parse/token.rs40
2 files changed, 39 insertions, 38 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c174e35d93b..d6d0a35f2ce 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -13,13 +13,13 @@ pub use self::PathParsingMode::*;
 use abi;
 use ast::BareFnTy;
 use ast::{RegionTyParamBound, TraitTyParamBound, TraitBoundModifier};
-use ast::{Public, Unsafety, UnOp};
-use ast::{Mod, BiAdd, Arg, Arm, Attribute, BindingMode};
-use ast::{BiBitAnd, BiBitOr, BiBitXor, BiRem, BiLt, Block};
+use ast::{Public, Unsafety};
+use ast::{Mod, Arg, Arm, Attribute, BindingMode};
+use ast::Block;
 use ast::{BlockCheckMode, CaptureByRef, CaptureByValue, CaptureClause};
 use ast::{Constness, ConstTraitItem, Crate, CrateConfig};
 use ast::{Decl, DeclItem, DeclLocal, DefaultBlock, DefaultReturn};
-use ast::{BiDiv, EMPTY_CTXT, EnumDef, ExplicitSelf};
+use ast::{EMPTY_CTXT, EnumDef, ExplicitSelf};
 use ast::{Expr, Expr_, ExprAddrOf, ExprMatch, ExprAgain};
 use ast::{ExprAssign, ExprAssignOp, ExprBinary, ExprBlock, ExprBox};
 use ast::{ExprBreak, ExprCall, ExprCast, ExprInPlace};
@@ -38,14 +38,14 @@ use ast::{LitBool, LitChar, LitByte, LitByteStr};
 use ast::{LitStr, LitInt, Local};
 use ast::{MacStmtWithBraces, MacStmtWithSemicolon, MacStmtWithoutBraces};
 use ast::{MutImmutable, MutMutable, Mac_};
-use ast::{MutTy, BiMul, Mutability};
+use ast::{MutTy, Mutability};
 use ast::{NamedField, NoReturn};
 use ast::{Pat, PatBox, PatEnum, PatIdent, PatLit, PatQPath, PatMac, PatRange};
 use ast::{PatRegion, PatStruct, PatTup, PatVec, PatWild};
 use ast::{PolyTraitRef, QSelf};
-use ast::{Return, BiShl, BiShr, Stmt, StmtDecl};
+use ast::{Return, Stmt, StmtDecl};
 use ast::{StmtExpr, StmtSemi, StmtMac, VariantData, StructField};
-use ast::{BiSub, StrStyle};
+use ast::StrStyle;
 use ast::{SelfExplicit, SelfRegion, SelfStatic, SelfValue};
 use ast::{Delimited, SequenceRepetition, TokenTree, TraitItem, TraitRef};
 use ast::{Ty, Ty_, TypeBinding, TyMac};
@@ -57,6 +57,7 @@ use ast::{UnnamedField, UnsafeBlock};
 use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
 use ast::{Visibility, WhereClause};
 use attr::{ThinAttributes, ThinAttributesExt, AttributesExt};
+use ast::{BinOpKind, UnOp};
 use ast;
 use ast_util::{self, ident_to_path};
 use codemap::{self, Span, BytePos, Spanned, spanned, mk_sp, CodeMap};
@@ -2925,16 +2926,16 @@ impl<'a> Parser<'a> {
                     self.mk_expr(lhs_span.lo, rhs.span.hi, ExprInPlace(lhs, rhs), None),
                 AssocOp::AssignOp(k) => {
                     let aop = match k {
-                        token::Plus =>    BiAdd,
-                        token::Minus =>   BiSub,
-                        token::Star =>    BiMul,
-                        token::Slash =>   BiDiv,
-                        token::Percent => BiRem,
-                        token::Caret =>   BiBitXor,
-                        token::And =>     BiBitAnd,
-                        token::Or =>      BiBitOr,
-                        token::Shl =>     BiShl,
-                        token::Shr =>     BiShr
+                        token::Plus =>    BinOpKind::Add,
+                        token::Minus =>   BinOpKind::Sub,
+                        token::Star =>    BinOpKind::Mul,
+                        token::Slash =>   BinOpKind::Div,
+                        token::Percent => BinOpKind::Rem,
+                        token::Caret =>   BinOpKind::BitXor,
+                        token::And =>     BinOpKind::BitAnd,
+                        token::Or =>      BinOpKind::BitOr,
+                        token::Shl =>     BinOpKind::Shl,
+                        token::Shr =>     BinOpKind::Shr,
                     };
                     let (lhs_span, rhs_span) = (lhs_span, rhs.span);
                     let aopexpr = self.mk_assign_op(codemap::respan(cur_op_span, aop), lhs, rhs);
@@ -2961,7 +2962,7 @@ impl<'a> Parser<'a> {
                 let op_span = mk_sp(op.span.lo, self.span.hi);
                 let mut err = self.diagnostic().struct_span_err(op_span,
                     "chained comparison operators require parentheses");
-                if op.node == BiLt && *outer_op == AssocOp::Greater {
+                if op.node == BinOpKind::Lt && *outer_op == AssocOp::Greater {
                     err.fileline_help(op_span,
                         "use `::<...>` instead of `<...>` if you meant to specify type arguments");
                 }
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 220d0aff2e3..7d1b78b632f 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -15,7 +15,7 @@ pub use self::IdentStyle::*;
 pub use self::Lit::*;
 pub use self::Token::*;
 
-use ast;
+use ast::{self, BinOpKind};
 use ext::mtwt;
 use ptr::P;
 use util::interner::{RcStr, StrInterner};
@@ -264,26 +264,26 @@ impl Token {
     }
 
     /// Maps a token to its corresponding binary operator.
-    pub fn to_binop(&self) -> Option<ast::BinOp_> {
+    pub fn to_binop(&self) -> Option<BinOpKind> {
         match *self {
-            BinOp(Star)     => Some(ast::BiMul),
-            BinOp(Slash)    => Some(ast::BiDiv),
-            BinOp(Percent)  => Some(ast::BiRem),
-            BinOp(Plus)     => Some(ast::BiAdd),
-            BinOp(Minus)    => Some(ast::BiSub),
-            BinOp(Shl)      => Some(ast::BiShl),
-            BinOp(Shr)      => Some(ast::BiShr),
-            BinOp(And)      => Some(ast::BiBitAnd),
-            BinOp(Caret)    => Some(ast::BiBitXor),
-            BinOp(Or)       => Some(ast::BiBitOr),
-            Lt              => Some(ast::BiLt),
-            Le              => Some(ast::BiLe),
-            Ge              => Some(ast::BiGe),
-            Gt              => Some(ast::BiGt),
-            EqEq            => Some(ast::BiEq),
-            Ne              => Some(ast::BiNe),
-            AndAnd          => Some(ast::BiAnd),
-            OrOr            => Some(ast::BiOr),
+            BinOp(Star)     => Some(BinOpKind::Mul),
+            BinOp(Slash)    => Some(BinOpKind::Div),
+            BinOp(Percent)  => Some(BinOpKind::Rem),
+            BinOp(Plus)     => Some(BinOpKind::Add),
+            BinOp(Minus)    => Some(BinOpKind::Sub),
+            BinOp(Shl)      => Some(BinOpKind::Shl),
+            BinOp(Shr)      => Some(BinOpKind::Shr),
+            BinOp(And)      => Some(BinOpKind::BitAnd),
+            BinOp(Caret)    => Some(BinOpKind::BitXor),
+            BinOp(Or)       => Some(BinOpKind::BitOr),
+            Lt              => Some(BinOpKind::Lt),
+            Le              => Some(BinOpKind::Le),
+            Ge              => Some(BinOpKind::Ge),
+            Gt              => Some(BinOpKind::Gt),
+            EqEq            => Some(BinOpKind::Eq),
+            Ne              => Some(BinOpKind::Ne),
+            AndAnd          => Some(BinOpKind::And),
+            OrOr            => Some(BinOpKind::Or),
             _               => None,
         }
     }