Merge remote-tracking branch 'brson/codemap'

Conflicts:
	src/libsyntax/ext/source_util.rs
This commit is contained in:
Brian Anderson
2012-11-16 18:54:48 -08:00
41 changed files with 717 additions and 525 deletions

View File

@@ -5,7 +5,7 @@ use either::{Either, Left, Right};
use std::map::HashMap;
use token::{can_begin_expr, is_ident, is_ident_or_path, is_plain_ident,
INTERPOLATED, special_idents};
use codemap::{span,fss_none};
use codemap::{span,FssNone, BytePos};
use util::interner::Interner;
use ast_util::{spanned, respan, mk_sp, ident_to_path, operator_prec};
use lexer::reader;
@@ -244,7 +244,7 @@ impl Parser {
self.token = next.tok;
self.span = next.sp;
}
fn swap(next: token::Token, lo: uint, hi: uint) {
fn swap(next: token::Token, +lo: BytePos, +hi: BytePos) {
self.token = next;
self.span = mk_sp(lo, hi);
}
@@ -906,12 +906,12 @@ impl Parser {
return spanned(lo, e.span.hi, {mutbl: m, ident: i, expr: e});
}
fn mk_expr(lo: uint, hi: uint, +node: expr_) -> @expr {
fn mk_expr(+lo: BytePos, +hi: BytePos, +node: expr_) -> @expr {
return @{id: self.get_id(), callee_id: self.get_id(),
node: node, span: mk_sp(lo, hi)};
}
fn mk_mac_expr(lo: uint, hi: uint, m: mac_) -> @expr {
fn mk_mac_expr(+lo: BytePos, +hi: BytePos, m: mac_) -> @expr {
return @{id: self.get_id(),
callee_id: self.get_id(),
node: expr_mac({node: m, span: mk_sp(lo, hi)}),
@@ -1141,7 +1141,7 @@ impl Parser {
return self.mk_expr(lo, hi, ex);
}
fn parse_block_expr(lo: uint, blk_mode: blk_check_mode) -> @expr {
fn parse_block_expr(lo: BytePos, blk_mode: blk_check_mode) -> @expr {
self.expect(token::LBRACE);
let blk = self.parse_block_tail(lo, blk_mode);
return self.mk_expr(blk.span.lo, blk.span.hi, expr_block(blk));
@@ -1153,7 +1153,7 @@ impl Parser {
return self.parse_syntax_ext_naked(lo);
}
fn parse_syntax_ext_naked(lo: uint) -> @expr {
fn parse_syntax_ext_naked(lo: BytePos) -> @expr {
match self.token {
token::IDENT(_, _) => (),
_ => self.fatal(~"expected a syntax expander name")
@@ -2287,11 +2287,11 @@ impl Parser {
// I guess that also means "already parsed the 'impure'" if
// necessary, and this should take a qualifier.
// some blocks start with "#{"...
fn parse_block_tail(lo: uint, s: blk_check_mode) -> blk {
fn parse_block_tail(lo: BytePos, s: blk_check_mode) -> blk {
self.parse_block_tail_(lo, s, ~[])
}
fn parse_block_tail_(lo: uint, s: blk_check_mode,
fn parse_block_tail_(lo: BytePos, s: blk_check_mode,
+first_item_attrs: ~[attribute]) -> blk {
let mut stmts = ~[];
let mut expr = None;
@@ -2589,7 +2589,7 @@ impl Parser {
return {ident: id, tps: ty_params};
}
fn mk_item(lo: uint, hi: uint, +ident: ident,
fn mk_item(+lo: BytePos, +hi: BytePos, +ident: ident,
+node: item_, vis: visibility,
+attrs: ~[attribute]) -> @item {
return @{ident: ident,
@@ -3041,7 +3041,7 @@ impl Parser {
items: items};
}
fn parse_item_foreign_mod(lo: uint,
fn parse_item_foreign_mod(lo: BytePos,
visibility: visibility,
attrs: ~[attribute],
items_allowed: bool)
@@ -3096,7 +3096,7 @@ impl Parser {
});
}
fn parse_type_decl() -> {lo: uint, ident: ident} {
fn parse_type_decl() -> {lo: BytePos, ident: ident} {
let lo = self.last_span.lo;
let id = self.parse_ident();
return {lo: lo, ident: id};
@@ -3425,9 +3425,8 @@ impl Parser {
};
let m = ast::mac_invoc_tt(pth, tts);
let m: ast::mac = {node: m,
span: {lo: self.span.lo,
hi: self.span.hi,
expn_info: None}};
span: mk_sp(self.span.lo,
self.span.hi)};
let item_ = item_mac(m);
return iovi_item(self.mk_item(lo, self.last_span.hi, id, item_,
visibility, attrs));