diff options
| author | John Clements <clements@racket-lang.org> | 2013-01-30 09:56:33 -0800 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2013-01-31 23:05:12 -0800 |
| commit | 53688addaa4484f1a317bb0938cf453381810427 (patch) | |
| tree | 2c025b1dc64129e4651df886918a07af9896a14f /src/libsyntax/parse | |
| parent | e343abd0ed11227425eca16e186367eced39cd82 (diff) | |
| download | rust-53688addaa4484f1a317bb0938cf453381810427.tar.gz rust-53688addaa4484f1a317bb0938cf453381810427.zip | |
test cases, cleanup
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/classify.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/common.rs | 11 | ||||
| -rw-r--r-- | src/libsyntax/parse/eval.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 113 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/parse/obsolete.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 56 |
9 files changed, 133 insertions, 68 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 3ed31c0953c..e6ba543cf79 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -11,7 +11,7 @@ use core::prelude::*; use ast; -use ast_util::spanned; +use codemap::spanned; use codemap::BytePos; use parse::common::*; //resolve bug? use parse::token; diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index afe6823e76d..4ceb04c55d0 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -13,6 +13,7 @@ */ use ast; +use codemap; use ast_util::operator_prec; pub fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool { @@ -31,7 +32,8 @@ pub fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool { pub fn expr_is_simple_block(e: @ast::expr) -> bool { match e.node { ast::expr_block( - ast::spanned { node: ast::blk_ { rules: ast::default_blk, _ }, _ } + codemap::spanned { + node: ast::blk_ { rules: ast::default_blk, _ }, _ } ) => true, _ => false } diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 8ed10fb138d..d7640ce3a23 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -14,7 +14,7 @@ use ast; use codemap::{BytePos, CharPos, CodeMap, FileMap, Pos}; use diagnostic; use parse::lexer::{is_whitespace, get_str_from, reader}; -use parse::lexer::{string_reader, bump, is_eof, nextch}; +use parse::lexer::{string_reader, bump, is_eof, nextch, TokenAndSpan}; use parse::lexer; use parse::token; use parse; @@ -334,7 +334,7 @@ pub fn gather_comments_and_literals(span_diagnostic: diagnostic::span_handler, let bstart = rdr.pos; rdr.next_token(); //discard, and look ahead; we're working with internal state - let {tok: tok, sp: sp} = rdr.peek(); + let TokenAndSpan {tok: tok, sp: sp} = rdr.peek(); if token::is_lit(tok) { let s = get_str_from(rdr, bstart); literals.push({lit: s, pos: sp.lo}); diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 583ad982000..48ef6b873ec 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -11,8 +11,7 @@ use core::prelude::*; use ast; -use ast_util::spanned; -use codemap::BytePos; +use codemap::{BytePos, spanned}; use parse::lexer::reader; use parse::parser::Parser; use parse::token; @@ -190,7 +189,9 @@ pub impl Parser { if self.token == token::GT { self.bump(); } else if self.token == token::BINOP(token::SHR) { - self.swap(token::GT, self.span.lo + BytePos(1u), self.span.hi); + self.replace_token(token::GT, + self.span.lo + BytePos(1u), + self.span.hi); } else { let mut s: ~str = ~"expected `"; s += token_to_str(self.reader, token::GT); @@ -229,7 +230,7 @@ pub impl Parser { } fn parse_seq_lt_gt<T: Copy>(sep: Option<token::Token>, - f: fn(Parser) -> T) -> ast::spanned<~[T]> { + f: fn(Parser) -> T) -> spanned<~[T]> { let lo = self.span.lo; self.expect(token::LT); let result = self.parse_seq_to_before_gt::<T>(sep, f); @@ -277,7 +278,7 @@ pub impl Parser { // NB: Do not use this function unless you actually plan to place the // spanned list in the AST. fn parse_seq<T: Copy>(bra: token::Token, ket: token::Token, sep: seq_sep, - f: fn(Parser) -> T) -> ast::spanned<~[T]> { + f: fn(Parser) -> T) -> spanned<~[T]> { let lo = self.span.lo; self.expect(bra); let result = self.parse_seq_to_before_end::<T>(ket, sep, f); diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs index caab03afb76..5decb2351e3 100644 --- a/src/libsyntax/parse/eval.rs +++ b/src/libsyntax/parse/eval.rs @@ -10,8 +10,7 @@ use parser::Parser; use attr::parser_attr; -use ast_util::mk_sp; -use codemap::span; +use codemap::{span, mk_sp}; type ctx = @{sess: parse::parse_sess, @@ -75,7 +74,7 @@ fn parse_companion_mod(cx: ctx, prefix: &Path, suffix: &Option<Path>) // XXX: Using a dummy span, but this code will go away soon let p0 = new_sub_parser_from_file(cx.sess, cx.cfg, modpath, - ast_util::dummy_sp()); + codemap::dummy_sp()); let inner_attrs = p0.parse_inner_attrs_and_next(); let m0 = p0.parse_mod_items(token::EOF, inner_attrs.next); return (m0.view_items, m0.items, inner_attrs.inner); diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 65fc86a106a..71e96699c3d 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -30,14 +30,17 @@ use std; pub trait reader { fn is_eof() -> bool; - fn next_token() -> {tok: token::Token, sp: span}; + fn next_token() -> TokenAndSpan; fn fatal(~str) -> !; fn span_diag() -> span_handler; pure fn interner() -> @token::ident_interner; - fn peek() -> {tok: token::Token, sp: span}; + fn peek() -> TokenAndSpan; fn dup() -> reader; } +#[deriving_eq] +pub struct TokenAndSpan {tok: token::Token, sp: span} + pub type string_reader = @{ span_diagnostic: span_handler, src: @~str, @@ -79,11 +82,14 @@ pub fn new_low_level_string_reader(span_diagnostic: span_handler, filemap: filemap, interner: itr, /* dummy values; not read */ mut peek_tok: token::EOF, - mut peek_span: ast_util::dummy_sp()}; + mut peek_span: codemap::dummy_sp()}; bump(r); return r; } +// duplicating the string reader is probably a bad idea, in +// that using them will cause interleaved pushes of line +// offsets to the underlying filemap... fn dup_string_reader(&&r: string_reader) -> string_reader { @{span_diagnostic: r.span_diagnostic, src: r.src, mut pos: r.pos, @@ -95,8 +101,9 @@ fn dup_string_reader(&&r: string_reader) -> string_reader { impl string_reader: reader { fn is_eof() -> bool { is_eof(self) } - fn next_token() -> {tok: token::Token, sp: span} { - let ret_val = {tok: self.peek_tok, sp: self.peek_span}; + // return the next token. EFFECT: advances the string_reader. + fn next_token() -> TokenAndSpan { + let ret_val = TokenAndSpan {tok: self.peek_tok, sp: self.peek_span}; string_advance_token(self); return ret_val; } @@ -105,15 +112,15 @@ impl string_reader: reader { } fn span_diag() -> span_handler { self.span_diagnostic } pure fn interner() -> @token::ident_interner { self.interner } - fn peek() -> {tok: token::Token, sp: span} { - {tok: self.peek_tok, sp: self.peek_span} + fn peek() -> TokenAndSpan { + TokenAndSpan {tok: self.peek_tok, sp: self.peek_span} } fn dup() -> reader { dup_string_reader(self) as reader } } pub impl tt_reader: reader { fn is_eof() -> bool { self.cur_tok == token::EOF } - fn next_token() -> {tok: token::Token, sp: span} { + fn next_token() -> TokenAndSpan { /* weird resolve bug: if the following `if`, or any of its statements are removed, we get resolution errors */ if false { @@ -127,27 +134,29 @@ pub impl tt_reader: reader { } fn span_diag() -> span_handler { self.sp_diag } pure fn interner() -> @token::ident_interner { self.interner } - fn peek() -> {tok: token::Token, sp: span} { - { tok: self.cur_tok, sp: self.cur_span } + fn peek() -> TokenAndSpan { + TokenAndSpan { tok: self.cur_tok, sp: self.cur_span } } fn dup() -> reader { dup_tt_reader(self) as reader } } +// EFFECT: advance peek_tok and peek_span to refer to the next token. fn string_advance_token(&&r: string_reader) { - for consume_whitespace_and_comments(r).each |comment| { - r.peek_tok = comment.tok; - r.peek_span = comment.sp; - return; + match (consume_whitespace_and_comments(r)) { + Some(comment) => { + r.peek_tok = comment.tok; + r.peek_span = comment.sp; + }, + None => { + if is_eof(r) { + r.peek_tok = token::EOF; + } else { + let start_bytepos = r.last_pos; + r.peek_tok = next_token_inner(r); + r.peek_span = codemap::mk_sp(start_bytepos, r.last_pos); + }; + } } - - if is_eof(r) { - r.peek_tok = token::EOF; - } else { - let start_bytepos = r.last_pos; - r.peek_tok = next_token_inner(r); - r.peek_span = ast_util::mk_sp(start_bytepos, r.last_pos); - }; - } fn byte_offset(rdr: string_reader) -> BytePos { @@ -163,6 +172,8 @@ pub fn get_str_from(rdr: string_reader, start: BytePos) -> ~str { } } +// EFFECT: advance the StringReader by one character. If a newline is +// discovered, add it to the FileMap's list of line start offsets. pub fn bump(rdr: string_reader) { rdr.last_pos = rdr.pos; let current_byte_offset = byte_offset(rdr).to_uint();; @@ -233,16 +244,19 @@ fn is_hex_digit(c: char) -> bool { fn is_bin_digit(c: char) -> bool { return c == '0' || c == '1'; } -// might return a sugared-doc-attr +// EFFECT: eats whitespace and comments. +// returns a Some(sugared-doc-attr) if one exists, None otherwise. fn consume_whitespace_and_comments(rdr: string_reader) - -> Option<{tok: token::Token, sp: span}> { + -> Option<TokenAndSpan> { while is_whitespace(rdr.curr) { bump(rdr); } return consume_any_line_comment(rdr); } -// might return a sugared-doc-attr +// PRECONDITION: rdr.curr is not whitespace +// EFFECT: eats any kind of comment. +// returns a Some(sugared-doc-attr) if one exists, None otherwise fn consume_any_line_comment(rdr: string_reader) - -> Option<{tok: token::Token, sp: span}> { + -> Option<TokenAndSpan> { if rdr.curr == '/' { match nextch(rdr) { '/' => { @@ -256,9 +270,9 @@ fn consume_any_line_comment(rdr: string_reader) str::push_char(&mut acc, rdr.curr); bump(rdr); } - return Some({ + return Some(TokenAndSpan{ tok: token::DOC_COMMENT(rdr.interner.intern(@acc)), - sp: ast_util::mk_sp(start_bpos, rdr.pos) + sp: codemap::mk_sp(start_bpos, rdr.pos) }); } else { while rdr.curr != '\n' && !is_eof(rdr) { bump(rdr); } @@ -285,7 +299,7 @@ fn consume_any_line_comment(rdr: string_reader) // might return a sugared-doc-attr fn consume_block_comment(rdr: string_reader) - -> Option<{tok: token::Token, sp: span}> { + -> Option<TokenAndSpan> { // block comments starting with "/**" or "/*!" are doc-comments if rdr.curr == '*' || rdr.curr == '!' { @@ -301,9 +315,9 @@ fn consume_block_comment(rdr: string_reader) acc += ~"*/"; bump(rdr); bump(rdr); - return Some({ + return Some(TokenAndSpan{ tok: token::DOC_COMMENT(rdr.interner.intern(@acc)), - sp: ast_util::mk_sp(start_bpos, rdr.pos) + sp: codemap::mk_sp(start_bpos, rdr.pos) }); } } else { @@ -702,6 +716,41 @@ fn consume_whitespace(rdr: string_reader) { while is_whitespace(rdr.curr) && !is_eof(rdr) { bump(rdr); } } +#[cfg(test)] +pub mod test { + + use super::*; + use util::interner; + use diagnostic; + use util::testing::{check_equal, check_equal_ptr}; + #[test] fn t1 () { + let teststr = + @~"/* my source file */ +fn main() { io::println(~\"zebra\"); }\n"; + let cm = CodeMap::new(); + let fm = cm.new_filemap(~"zebra.rs",teststr); + let ident_interner = token::mk_ident_interner(); // interner::mk(); + let id = ident_interner.intern(@~"fn"); + let span_handler = + diagnostic::mk_span_handler(diagnostic::mk_handler(None),@cm); + let string_reader = new_string_reader(span_handler,fm,ident_interner); + 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}}; + check_equal (tok1,tok2); + // the 'main' id is already read: + check_equal (string_reader.last_pos,BytePos(28)); + // read another token: + let tok3 = string_reader.next_token(); + let tok4 = TokenAndSpan{ + tok:token::IDENT(ident_interner.intern (@~"main"), false), + sp:span {lo:BytePos(24),hi:BytePos(28),expn_info: None}}; + check_equal (tok3,tok4); + // the lparen is already read: + check_equal (string_reader.last_pos,BytePos(29)) + } +} // // Local Variables: diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index f9088bfd635..6169233c1b7 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -10,6 +10,7 @@ //! The main parser interface + use ast::node_id; use ast; use codemap::{span, CodeMap, FileMap, CharPos, BytePos}; @@ -33,6 +34,7 @@ pub mod token; pub mod comments; pub mod attr; + /// Common routines shared by parser mods pub mod common; @@ -215,3 +217,4 @@ pub fn new_parser_from_tts(sess: parse_sess, cfg: ast::crate_cfg, None, tts); return Parser(sess, cfg, trdr as reader) } + diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 7dad15f9dfc..0c7a202dcd6 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -21,8 +21,7 @@ use core::prelude::*; use ast::{expr, expr_lit, lit_nil}; use ast; -use ast_util::{respan}; -use codemap::span; +use codemap::{span, respan}; use parse::parser::Parser; use parse::token::Token; use parse::token; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 51acf76ac30..2917ce43358 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -55,15 +55,16 @@ use ast::{view_path, view_path_glob, view_path_list, view_path_simple}; use ast::{visibility, vstore, vstore_box, vstore_fixed, vstore_slice}; use ast::{vstore_uniq}; use ast; -use ast_util::{spanned, respan, mk_sp, ident_to_path, operator_prec}; +use ast_util::{ident_to_path, operator_prec}; use ast_util; use classify; -use codemap::{span,FssNone, BytePos}; +use codemap::{span,FssNone, BytePos, spanned, respan, mk_sp}; use codemap; use parse::attr::parser_attr; use parse::common::{seq_sep_none, token_to_str}; use parse::common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed}; use parse::lexer::reader; +use parse::lexer::TokenAndSpan; use parse::obsolete::{ObsoleteClassTraits, ObsoleteModeInFnType}; use parse::obsolete::{ObsoleteLet, ObsoleteFieldTerminator}; use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove}; @@ -193,7 +194,7 @@ pub fn Parser(sess: parse_sess, token: tok0.tok, span: span0, last_span: span0, - buffer: [mut {tok: tok0.tok, sp: span0}, ..4], + buffer: [mut TokenAndSpan {tok: tok0.tok, sp: span0}, ..4], buffer_start: 0, buffer_end: 0, tokens_consumed: 0u, @@ -213,7 +214,7 @@ pub struct Parser { mut token: token::Token, mut span: span, mut last_span: span, - mut buffer: [mut {tok: token::Token, sp: span} * 4], + mut buffer: [mut TokenAndSpan * 4], mut buffer_start: int, mut buffer_end: int, mut tokens_consumed: uint, @@ -234,6 +235,7 @@ pub struct Parser { } pub impl Parser { + // advance the parser by one token fn bump() { self.last_span = self.span; let next = if self.buffer_start == self.buffer_end { @@ -247,7 +249,8 @@ pub impl Parser { self.span = next.sp; self.tokens_consumed += 1u; } - fn swap(next: token::Token, +lo: BytePos, +hi: BytePos) { + // EFFECT: replace the current token and span with the given one + fn replace_token(next: token::Token, +lo: BytePos, +hi: BytePos) { self.token = next; self.span = mk_sp(lo, hi); } @@ -800,7 +803,7 @@ pub impl Parser { self.bump(); self.lit_from_token(tok) }; - ast::spanned { node: lit, span: mk_sp(lo, self.last_span.hi) } + codemap::spanned { node: lit, span: mk_sp(lo, self.last_span.hi) } } fn parse_path_without_tps() -> @path { @@ -875,7 +878,7 @@ pub impl Parser { self.parse_seq_lt_gt(Some(token::COMMA), |p| p.parse_ty(false)) } else { - ast::spanned {node: ~[], span: path.span} + codemap::spanned {node: ~[], span: path.span} } }; @@ -917,14 +920,14 @@ pub impl Parser { @expr { id: self.get_id(), callee_id: self.get_id(), - node: expr_mac(ast::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), } } fn mk_lit_u32(i: u32) -> @expr { let span = self.span; - let lv_lit = @ast::spanned { node: lit_uint(i as u64, ty_u32), + let lv_lit = @codemap::spanned { node: lit_uint(i as u64, ty_u32), span: span }; @expr { @@ -1404,7 +1407,7 @@ pub impl Parser { hi = e.span.hi; // HACK: turn &[...] into a &-evec ex = match e.node { - expr_vec(*) | expr_lit(@ast::spanned { + expr_vec(*) | expr_lit(@codemap::spanned { node: lit_str(_), span: _ }) if m == m_imm => { @@ -1429,7 +1432,7 @@ pub impl Parser { expr_vec(*) if m == m_mutbl => expr_vstore(e, expr_vstore_mut_box), expr_vec(*) if m == m_imm => expr_vstore(e, expr_vstore_box), - expr_lit(@ast::spanned { + expr_lit(@codemap::spanned { node: lit_str(_), span: _}) if m == m_imm => expr_vstore(e, expr_vstore_box), _ => expr_unary(box(m), e) @@ -1442,7 +1445,7 @@ pub impl Parser { hi = e.span.hi; // HACK: turn ~[...] into a ~-evec ex = match e.node { - expr_vec(*) | expr_lit(@ast::spanned { + expr_vec(*) | expr_lit(@codemap::spanned { node: lit_str(_), span: _}) if m == m_imm => expr_vstore(e, expr_vstore_uniq), _ => expr_unary(uniq(m), e) @@ -1496,6 +1499,7 @@ pub impl Parser { return lhs; } + // parse an arbitrary expression. fn parse_assign_expr() -> @expr { let lo = self.span.lo; let lhs = self.parse_binops(); @@ -1794,7 +1798,7 @@ pub impl Parser { self.eat(token::COMMA); } - let blk = ast::spanned { + let blk = codemap::spanned { node: ast::blk_ { view_items: ~[], stmts: ~[], @@ -1812,10 +1816,12 @@ pub impl Parser { return self.mk_expr(lo, hi, expr_match(discriminant, arms)); } + // parse an expression fn parse_expr() -> @expr { return self.parse_expr_res(UNRESTRICTED); } + // parse an expression, subject to the given restriction fn parse_expr_res(r: restriction) -> @expr { let old = self.restriction; self.restriction = r; @@ -1943,7 +1949,9 @@ pub impl Parser { // HACK: parse @"..." as a literal of a vstore @str pat = match sub.node { pat_lit(e@@expr { - node: expr_lit(@ast::spanned {node: lit_str(_), span: _}), _ + node: expr_lit(@codemap::spanned { + node: lit_str(_), + span: _}), _ }) => { let vst = @expr { id: self.get_id(), @@ -1963,7 +1971,9 @@ pub impl Parser { // HACK: parse ~"..." as a literal of a vstore ~str pat = match sub.node { pat_lit(e@@expr { - node: expr_lit(@ast::spanned {node: lit_str(_), span: _}), _ + node: expr_lit(@codemap::spanned { + node: lit_str(_), + span: _}), _ }) => { let vst = @expr { id: self.get_id(), @@ -1985,7 +1995,7 @@ pub impl Parser { // HACK: parse &"..." as a literal of a borrowed str pat = match sub.node { pat_lit(e@@expr { - node: expr_lit(@ast::spanned { + node: expr_lit(@codemap::spanned { node: lit_str(_), span: _}), _ }) => { let vst = @expr { @@ -2011,7 +2021,9 @@ pub impl Parser { if self.token == token::RPAREN { hi = self.span.hi; self.bump(); - let lit = @ast::spanned {node: lit_nil, span: mk_sp(lo, hi)}; + let lit = @codemap::spanned { + node: lit_nil, + span: mk_sp(lo, hi)}; let expr = self.mk_expr(lo, hi, expr_lit(lit)); pat = pat_lit(expr); } else { @@ -2381,7 +2393,7 @@ pub impl Parser { match self.token { token::SEMI => { self.bump(); - stmts.push(@ast::spanned { + stmts.push(@codemap::spanned { node: stmt_semi(e, stmt_id), .. *stmt}); } @@ -2406,7 +2418,7 @@ pub impl Parser { match self.token { token::SEMI => { self.bump(); - stmts.push(@ast::spanned { + stmts.push(@codemap::spanned { node: stmt_mac((*m), true), .. *stmt}); } @@ -2940,7 +2952,7 @@ pub impl Parser { let actual_dtor = do the_dtor.map |dtor| { let (d_body, d_attrs, d_s) = *dtor; - ast::spanned { node: ast::struct_dtor_ { id: self.get_id(), + codemap::spanned { node: ast::struct_dtor_ { id: self.get_id(), attrs: d_attrs, self_id: self.get_id(), body: d_body}, @@ -3445,7 +3457,7 @@ pub impl Parser { self.bump(); let mut actual_dtor = do the_dtor.map |dtor| { let (d_body, d_attrs, d_s) = *dtor; - ast::spanned { node: ast::struct_dtor_ { id: self.get_id(), + codemap::spanned { node: ast::struct_dtor_ { id: self.get_id(), attrs: d_attrs, self_id: self.get_id(), body: d_body }, @@ -3737,7 +3749,7 @@ pub impl Parser { _ => self.fatal(~"expected open delimiter") }; let m = ast::mac_invoc_tt(pth, tts); - let m: ast::mac = ast::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); |
