about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2016-02-08 17:06:20 +0100
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2016-02-11 12:34:48 +0100
commit69072c4f5d18d7a1762fbfb007b0ba3d6b59ad33 (patch)
tree8c9a87b64cd8054e093c1c07f6c0b987cd00f9c3 /src/libsyntax/parse
parent05d4cefd630cd9ae104555e69ceb3b1566298a6a (diff)
downloadrust-69072c4f5d18d7a1762fbfb007b0ba3d6b59ad33.tar.gz
rust-69072c4f5d18d7a1762fbfb007b0ba3d6b59ad33.zip
[breaking-change] don't pub export ast::Lit_ variants
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/attr.rs2
-rw-r--r--src/libsyntax/parse/mod.rs18
-rw-r--r--src/libsyntax/parse/parser.rs27
3 files changed, 23 insertions, 24 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index 96ac9b83d2f..3f9f2ae44a3 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -175,7 +175,7 @@ impl<'a> Parser<'a> {
                 // FIXME #623 Non-string meta items are not serialized correctly;
                 // just forbid them for now
                 match lit.node {
-                    ast::LitStr(..) => {}
+                    ast::LitKind::Str(..) => {}
                     _ => {
                         self.span_err(lit.span,
                                       "non-string literals are not allowed in meta-items");
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index d467405e089..bfd3dea38ce 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -449,11 +449,11 @@ fn looks_like_width_suffix(first_chars: &[char], s: &str) -> bool {
 }
 
 fn filtered_float_lit(data: token::InternedString, suffix: Option<&str>,
-                      sd: &Handler, sp: Span) -> ast::Lit_ {
+                      sd: &Handler, sp: Span) -> ast::LitKind {
     debug!("filtered_float_lit: {}, {:?}", data, suffix);
     match suffix.as_ref().map(|s| &**s) {
-        Some("f32") => ast::LitFloat(data, ast::FloatTy::F32),
-        Some("f64") => ast::LitFloat(data, ast::FloatTy::F64),
+        Some("f32") => ast::LitKind::Float(data, ast::FloatTy::F32),
+        Some("f64") => ast::LitKind::Float(data, ast::FloatTy::F64),
         Some(suf) => {
             if suf.len() >= 2 && looks_like_width_suffix(&['f'], suf) {
                 // if it looks like a width, lets try to be helpful.
@@ -466,13 +466,13 @@ fn filtered_float_lit(data: token::InternedString, suffix: Option<&str>,
                   .emit();
             }
 
-            ast::LitFloatUnsuffixed(data)
+            ast::LitKind::FloatUnsuffixed(data)
         }
-        None => ast::LitFloatUnsuffixed(data)
+        None => ast::LitKind::FloatUnsuffixed(data)
     }
 }
 pub fn float_lit(s: &str, suffix: Option<InternedString>,
-                 sd: &Handler, sp: Span) -> ast::Lit_ {
+                 sd: &Handler, sp: Span) -> ast::LitKind {
     debug!("float_lit: {:?}, {:?}", s, suffix);
     // FIXME #2252: bounds checking float literals is deferred until trans
     let s = s.chars().filter(|&c| c != '_').collect::<String>();
@@ -576,7 +576,7 @@ pub fn integer_lit(s: &str,
                    suffix: Option<InternedString>,
                    sd: &Handler,
                    sp: Span)
-                   -> ast::Lit_ {
+                   -> ast::LitKind {
     // s can only be ascii, byte indexing is fine
 
     let s2 = s.chars().filter(|&c| c != '_').collect::<String>();
@@ -652,7 +652,7 @@ pub fn integer_lit(s: &str,
            string was {:?}, the original suffix was {:?}", ty, base, s, orig, suffix);
 
     match u64::from_str_radix(s, base) {
-        Ok(r) => ast::LitInt(r, ty),
+        Ok(r) => ast::LitKind::Int(r, ty),
         Err(_) => {
             // small bases are lexed as if they were base 10, e.g, the string
             // might be `0b10201`. This will cause the conversion above to fail,
@@ -665,7 +665,7 @@ pub fn integer_lit(s: &str,
             if !already_errored {
                 sd.span_err(sp, "int literal is too large");
             }
-            ast::LitInt(0, ty)
+            ast::LitKind::Int(0, ty)
         }
     }
 }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 1a8b1cbc374..d3b92ac0c0c 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -27,9 +27,8 @@ use ast::{Ident, Inherited, ImplItem, Item, Item_, ItemStatic};
 use ast::{ItemEnum, ItemFn, ItemForeignMod, ItemImpl, ItemConst};
 use ast::{ItemMac, ItemMod, ItemStruct, ItemTrait, ItemTy, ItemDefaultImpl};
 use ast::{ItemExternCrate, ItemUse};
-use ast::{Lit, Lit_, UintTy};
-use ast::{LitBool, LitChar, LitByte, LitByteStr};
-use ast::{LitStr, LitInt, Local};
+use ast::{Lit, LitKind, UintTy};
+use ast::Local;
 use ast::{MacStmtWithBraces, MacStmtWithSemicolon, MacStmtWithoutBraces};
 use ast::{MutImmutable, MutMutable, Mac_};
 use ast::{MutTy, Mutability};
@@ -1517,7 +1516,7 @@ impl<'a> Parser<'a> {
     }
 
     /// Matches token_lit = LIT_INTEGER | ...
-    pub fn lit_from_token(&self, tok: &token::Token) -> PResult<'a, Lit_> {
+    pub fn lit_from_token(&self, tok: &token::Token) -> PResult<'a, LitKind> {
         match *tok {
             token::Interpolated(token::NtExpr(ref v)) => {
                 match v.node {
@@ -1527,8 +1526,8 @@ impl<'a> Parser<'a> {
             }
             token::Literal(lit, suf) => {
                 let (suffix_illegal, out) = match lit {
-                    token::Byte(i) => (true, LitByte(parse::byte_lit(&i.as_str()).0)),
-                    token::Char(i) => (true, LitChar(parse::char_lit(&i.as_str()).0)),
+                    token::Byte(i) => (true, LitKind::Byte(parse::byte_lit(&i.as_str()).0)),
+                    token::Char(i) => (true, LitKind::Char(parse::char_lit(&i.as_str()).0)),
 
                     // there are some valid suffixes for integer and
                     // float literals, so all the handling is done
@@ -1548,20 +1547,20 @@ impl<'a> Parser<'a> {
 
                     token::Str_(s) => {
                         (true,
-                         LitStr(token::intern_and_get_ident(&parse::str_lit(&s.as_str())),
-                                ast::CookedStr))
+                         LitKind::Str(token::intern_and_get_ident(&parse::str_lit(&s.as_str())),
+                                      ast::CookedStr))
                     }
                     token::StrRaw(s, n) => {
                         (true,
-                         LitStr(
+                         LitKind::Str(
                             token::intern_and_get_ident(&parse::raw_str_lit(&s.as_str())),
                             ast::RawStr(n)))
                     }
                     token::ByteStr(i) =>
-                        (true, LitByteStr(parse::byte_str_lit(&i.as_str()))),
+                        (true, LitKind::ByteStr(parse::byte_str_lit(&i.as_str()))),
                     token::ByteStrRaw(i, _) =>
                         (true,
-                         LitByteStr(Rc::new(i.to_string().into_bytes()))),
+                         LitKind::ByteStr(Rc::new(i.to_string().into_bytes()))),
                 };
 
                 if suffix_illegal {
@@ -1579,9 +1578,9 @@ impl<'a> Parser<'a> {
     pub fn parse_lit(&mut self) -> PResult<'a, Lit> {
         let lo = self.span.lo;
         let lit = if self.eat_keyword(keywords::True) {
-            LitBool(true)
+            LitKind::Bool(true)
         } else if self.eat_keyword(keywords::False) {
-            LitBool(false)
+            LitKind::Bool(false)
         } else {
             let token = self.bump_and_get();
             let lit = try!(self.lit_from_token(&token));
@@ -2015,7 +2014,7 @@ impl<'a> Parser<'a> {
     pub fn mk_lit_u32(&mut self, i: u32, attrs: ThinAttributes) -> P<Expr> {
         let span = &self.span;
         let lv_lit = P(codemap::Spanned {
-            node: LitInt(i as u64, ast::UnsignedIntLit(UintTy::U32)),
+            node: LitKind::Int(i as u64, ast::UnsignedIntLit(UintTy::U32)),
             span: *span
         });