diff options
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 16 | ||||
| -rw-r--r-- | src/libsyntax/parse/obsolete.rs | 14 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 46 |
5 files changed, 46 insertions, 46 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 78fc1f0babc..1bc334f1140 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use codemap::{spanned, mk_sp}; +use codemap::{spanned, Spanned, mk_sp}; use parse::common::*; //resolve bug? use parse::token; use parse::parser::Parser; @@ -95,7 +95,7 @@ impl parser_attr for Parser { } else { ast::AttrOuter }; - return spanned { + return Spanned { span: span, node: ast::Attribute_ { style: style, diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index c7b247f2dd2..26d66cfcaab 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -9,7 +9,7 @@ // except according to those terms. use ast; -use codemap::{BytePos, CharPos, CodeMap, Pos, span}; +use codemap::{BytePos, CharPos, CodeMap, Pos, Span}; use codemap; use diagnostic::span_handler; use ext::tt::transcribe::{tt_next_token}; @@ -36,7 +36,7 @@ pub trait reader { #[deriving(Clone, Eq)] pub struct TokenAndSpan { tok: token::Token, - sp: span, + sp: Span, } pub struct StringReader { @@ -53,7 +53,7 @@ pub struct StringReader { filemap: @codemap::FileMap, /* cached: */ peek_tok: token::Token, - peek_span: span + peek_span: Span } pub fn new_string_reader(span_diagnostic: @mut span_handler, @@ -798,7 +798,7 @@ mod test { use super::*; use ast; - use codemap::{BytePos, CodeMap, span}; + use codemap::{BytePos, CodeMap, Span}; use diagnostic; use parse::token; use parse::token::{str_to_ident}; @@ -827,7 +827,7 @@ mod test { let tok1 = string_reader.next_token(); let tok2 = TokenAndSpan{ tok:token::IDENT(id, false), - sp:span {lo:BytePos(21),hi:BytePos(23),expn_info: None}}; + sp:Span {lo:BytePos(21),hi:BytePos(23),expn_info: None}}; assert_eq!(tok1,tok2); // the 'main' id is already read: assert_eq!(string_reader.last_pos.clone(), BytePos(28)); @@ -835,7 +835,7 @@ mod test { let tok3 = string_reader.next_token(); let tok4 = TokenAndSpan{ tok:token::IDENT(str_to_ident("main"), false), - sp:span {lo:BytePos(24),hi:BytePos(28),expn_info: None}}; + sp:Span {lo:BytePos(24),hi:BytePos(28),expn_info: None}}; assert_eq!(tok3,tok4); // the lparen is already read: assert_eq!(string_reader.last_pos.clone(), BytePos(29)) diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 61dcc6c1947..ea1c9ce9b1e 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -13,7 +13,7 @@ use ast::NodeId; use ast; -use codemap::{span, CodeMap, FileMap, FileSubstr}; +use codemap::{Span, CodeMap, FileMap, FileSubstr}; use codemap; use diagnostic::{span_handler, mk_span_handler, mk_handler, Emitter}; use parse::attr::parser_attr; @@ -247,7 +247,7 @@ pub fn new_sub_parser_from_file( sess: @mut ParseSess, cfg: ast::CrateConfig, path: &Path, - sp: span + sp: Span ) -> Parser { filemap_to_parser(sess,file_to_filemap(sess,path,Some(sp)),cfg) } @@ -272,7 +272,7 @@ pub fn new_parser_from_tts(sess: @mut ParseSess, /// Given a session and a path and an optional span (for error reporting), /// add the path to the session's codemap and return the new filemap. -pub fn file_to_filemap(sess: @mut ParseSess, path: &Path, spanopt: Option<span>) +pub fn file_to_filemap(sess: @mut ParseSess, path: &Path, spanopt: Option<Span>) -> @FileMap { match io::read_whole_file_str(path) { Ok(src) => string_to_filemap(sess, src.to_managed(), path.to_str().to_managed()), @@ -332,7 +332,7 @@ mod test { use extra::serialize::Encodable; use extra; use std::io; - use codemap::{span, BytePos, spanned}; + use codemap::{Span, BytePos, Spanned}; use opt_vec; use ast; use abi; @@ -357,8 +357,8 @@ mod test { } // produce a codemap::span - fn sp (a: uint, b: uint) -> span { - span{lo:BytePos(a),hi:BytePos(b),expn_info:None} + fn sp (a: uint, b: uint) -> Span { + Span{lo:BytePos(a),hi:BytePos(b),expn_info:None} } #[test] fn path_exprs_1() { @@ -463,7 +463,7 @@ mod test { #[test] fn parse_stmt_1 () { assert_eq!(string_to_stmt(@"b;"), - @spanned{ + @Spanned{ node: ast::stmt_expr(@ast::expr { id: 1, node: ast::expr_path(ast::Path { @@ -571,7 +571,7 @@ mod test { }, ast::Block { view_items: ~[], - stmts: ~[@spanned{ + stmts: ~[@Spanned{ node: ast::stmt_semi(@ast::expr{ id: 6, node: ast::expr_path( diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index ab1bde3a3b9..62cf856a2c8 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -19,7 +19,7 @@ removed. use ast::{expr, expr_lit, lit_nil, Attribute}; use ast; -use codemap::{span, respan}; +use codemap::{Span, respan}; use parse::parser::Parser; use parse::token::{keywords, Token}; use parse::token; @@ -76,12 +76,12 @@ impl to_bytes::IterBytes for ObsoleteSyntax { pub trait ParserObsoleteMethods { /// Reports an obsolete syntax non-fatal error. - fn obsolete(&self, sp: span, kind: ObsoleteSyntax); + fn obsolete(&self, sp: Span, kind: ObsoleteSyntax); // Reports an obsolete syntax non-fatal error, and returns // a placeholder expression - fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr; + fn obsolete_expr(&self, sp: Span, kind: ObsoleteSyntax) -> @expr; fn report(&self, - sp: span, + sp: Span, kind: ObsoleteSyntax, kind_str: &str, desc: &str); @@ -94,7 +94,7 @@ pub trait ParserObsoleteMethods { impl ParserObsoleteMethods for Parser { /// Reports an obsolete syntax non-fatal error. - fn obsolete(&self, sp: span, kind: ObsoleteSyntax) { + fn obsolete(&self, sp: Span, kind: ObsoleteSyntax) { let (kind_str, desc) = match kind { ObsoleteLet => ( "`let` in field declaration", @@ -263,13 +263,13 @@ impl ParserObsoleteMethods for Parser { // Reports an obsolete syntax non-fatal error, and returns // a placeholder expression - fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr { + fn obsolete_expr(&self, sp: Span, kind: ObsoleteSyntax) -> @expr { self.obsolete(sp, kind); self.mk_expr(sp.lo, sp.hi, expr_lit(@respan(sp, lit_nil))) } fn report(&self, - sp: span, + sp: Span, kind: ObsoleteSyntax, kind_str: &str, desc: &str) { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ea7a7540e36..ea3437820a1 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -62,7 +62,7 @@ use ast::visibility; use ast; use ast_util::{as_prec, operator_prec}; use ast_util; -use codemap::{span, BytePos, spanned, mk_sp}; +use codemap::{Span, BytePos, Spanned, spanned, mk_sp}; use codemap; use parse::attr::parser_attr; use parse::classify; @@ -321,9 +321,9 @@ pub struct Parser { // the current token: token: @mut token::Token, // the span of the current token: - span: @mut span, + span: @mut Span, // the span of the prior token: - last_span: @mut span, + last_span: @mut Span, // the previous token or None (only stashed sometimes). last_token: @mut Option<~token::Token>, buffer: @mut [TokenAndSpan, ..4], @@ -666,7 +666,7 @@ impl Parser { ket: &token::Token, sep: SeqSep, f: &fn(&Parser) -> T) - -> spanned<~[T]> { + -> Spanned<~[T]> { let lo = self.span.lo; self.expect(bra); let result = self.parse_seq_to_before_end(ket, sep, f); @@ -736,10 +736,10 @@ impl Parser { pub fn fatal(&self, m: &str) -> ! { self.sess.span_diagnostic.span_fatal(*self.span, m) } - pub fn span_fatal(&self, sp: span, m: &str) -> ! { + pub fn span_fatal(&self, sp: Span, m: &str) -> ! { self.sess.span_diagnostic.span_fatal(sp, m) } - pub fn span_note(&self, sp: span, m: &str) { + pub fn span_note(&self, sp: Span, m: &str) { self.sess.span_diagnostic.span_note(sp, m) } pub fn bug(&self, m: &str) -> ! { @@ -748,7 +748,7 @@ impl Parser { pub fn warn(&self, m: &str) { self.sess.span_diagnostic.span_warn(*self.span, m) } - pub fn span_err(&self, sp: span, m: &str) { + pub fn span_err(&self, sp: Span, m: &str) { self.sess.span_diagnostic.span_err(sp, m) } pub fn abort_if_errors(&self) { @@ -1349,7 +1349,7 @@ impl Parser { let lit = self.lit_from_token(&token); lit }; - codemap::spanned { node: lit, span: mk_sp(lo, self.last_span.hi) } + codemap::Spanned { node: lit, span: mk_sp(lo, self.last_span.hi) } } // matches '-' lit | lit @@ -1686,14 +1686,14 @@ impl Parser { pub fn mk_mac_expr(&self, lo: BytePos, hi: BytePos, m: mac_) -> @expr { @expr { id: self.get_id(), - node: expr_mac(codemap::spanned {node: m, span: mk_sp(lo, hi)}), + node: expr_mac(codemap::Spanned {node: m, span: mk_sp(lo, hi)}), span: mk_sp(lo, hi), } } pub fn mk_lit_u32(&self, i: u32) -> @expr { let span = self.span; - let lv_lit = @codemap::spanned { + let lv_lit = @codemap::Spanned { node: lit_uint(i as u64, ty_u32), span: *span }; @@ -2060,7 +2060,7 @@ impl Parser { ); let (s, z) = p.parse_sep_and_zerok(); let seq = match seq { - spanned { node, _ } => node, + Spanned { node, _ } => node, }; tt_seq( mk_sp(sp.lo, p.span.hi), @@ -2219,7 +2219,7 @@ impl Parser { hi = e.span.hi; // HACK: turn &[...] into a &-evec ex = match e.node { - expr_vec(*) | expr_lit(@codemap::spanned { + expr_vec(*) | expr_lit(@codemap::Spanned { node: lit_str(_), span: _ }) if m == m_imm => { @@ -2244,7 +2244,7 @@ impl Parser { expr_vec(*) | expr_repeat(*) if m == m_mutbl => expr_vstore(e, expr_vstore_mut_box), expr_vec(*) | - expr_lit(@codemap::spanned { node: lit_str(_), span: _}) | + expr_lit(@codemap::Spanned { node: lit_str(_), span: _}) | expr_repeat(*) if m == m_imm => expr_vstore(e, expr_vstore_box), _ => self.mk_unary(box(m), e) }; @@ -2261,7 +2261,7 @@ impl Parser { // HACK: turn ~[...] into a ~-evec ex = match e.node { expr_vec(*) | - expr_lit(@codemap::spanned { node: lit_str(_), span: _}) | + expr_lit(@codemap::Spanned { node: lit_str(_), span: _}) | expr_repeat(*) => expr_vstore(e, expr_vstore_uniq), _ => self.mk_unary(uniq, e) }; @@ -2789,7 +2789,7 @@ impl Parser { // HACK: parse @"..." as a literal of a vstore @str pat = match sub.node { pat_lit(e@@expr { - node: expr_lit(@codemap::spanned { + node: expr_lit(@codemap::Spanned { node: lit_str(_), span: _}), _ }) => { @@ -2817,7 +2817,7 @@ impl Parser { // HACK: parse ~"..." as a literal of a vstore ~str pat = match sub.node { pat_lit(e@@expr { - node: expr_lit(@codemap::spanned { + node: expr_lit(@codemap::Spanned { node: lit_str(_), span: _}), _ }) => { @@ -2846,7 +2846,7 @@ impl Parser { // HACK: parse &"..." as a literal of a borrowed str pat = match sub.node { pat_lit(e@@expr { - node: expr_lit(@codemap::spanned { + node: expr_lit(@codemap::Spanned { node: lit_str(_), span: _}), _ }) => { let vst = @expr { @@ -2884,7 +2884,7 @@ impl Parser { if *self.token == token::RPAREN { hi = self.span.hi; self.bump(); - let lit = @codemap::spanned { + let lit = @codemap::Spanned { node: lit_nil, span: mk_sp(lo, hi)}; let expr = self.mk_expr(lo, hi, expr_lit(lit)); @@ -3320,7 +3320,7 @@ impl Parser { match *self.token { token::SEMI => { self.bump(); - stmts.push(@codemap::spanned { + stmts.push(@codemap::Spanned { node: stmt_semi(e, stmt_id), span: stmt.span, }); @@ -3357,7 +3357,7 @@ impl Parser { if has_semi { self.bump(); - stmts.push(@codemap::spanned { + stmts.push(@codemap::Spanned { node: stmt_mac((*m).clone(), true), span: stmt.span, }); @@ -4125,7 +4125,7 @@ impl Parser { fn eval_src_mod(&self, id: ast::ident, outer_attrs: &[ast::Attribute], - id_sp: span) + id_sp: Span) -> (ast::item_, ~[ast::Attribute]) { let prefix = Path(self.sess.cm.span_to_filename(*self.span)); let prefix = prefix.dir_path(); @@ -4173,7 +4173,7 @@ impl Parser { fn eval_src_mod_from_path(&self, path: Path, outer_attrs: ~[ast::Attribute], - id_sp: span) -> (ast::item_, ~[ast::Attribute]) { + id_sp: Span) -> (ast::item_, ~[ast::Attribute]) { let full_path = path.normalize(); let maybe_i = do self.sess.included_mod_stack.iter().position |p| { *p == full_path }; @@ -4797,7 +4797,7 @@ impl Parser { }; // single-variant-enum... : let m = ast::mac_invoc_tt(pth, tts); - let m: ast::mac = codemap::spanned { node: m, + let m: ast::mac = codemap::Spanned { node: m, span: mk_sp(self.span.lo, self.span.hi) }; let item_ = item_mac(m); |
