diff --git a/src/librustsyntax/ast_util.rs b/src/librustsyntax/ast_util.rs index ddfb9e6de16e..a440041acd3e 100644 --- a/src/librustsyntax/ast_util.rs +++ b/src/librustsyntax/ast_util.rs @@ -1,6 +1,10 @@ import codemap::span; import ast::*; +fn spanned(lo: uint, hi: uint, t: T) -> spanned { + ret respan(mk_sp(lo, hi), t); +} + fn respan(sp: span, t: T) -> spanned { ret {node: t, span: sp}; } diff --git a/src/librustsyntax/parse/attr.rs b/src/librustsyntax/parse/attr.rs index b7caa00a2af0..969aa03d9026 100644 --- a/src/librustsyntax/parse/attr.rs +++ b/src/librustsyntax/parse/attr.rs @@ -1,9 +1,9 @@ import either::{either, left, right}; +import ast_util::spanned; import common::{parse_seq, seq_sep, expect, - parse_ident, - spanned}; + parse_ident}; import parser::{parse_lit, parse_syntax_ext_naked}; diff --git a/src/librustsyntax/parse/common.rs b/src/librustsyntax/parse/common.rs index ba0d4530cffa..2f95a65dbd6f 100644 --- a/src/librustsyntax/parse/common.rs +++ b/src/librustsyntax/parse/common.rs @@ -1,5 +1,5 @@ import std::map::{hashmap}; -import ast::spanned; +import ast_util::spanned; import parser::parser; fn token_to_str(reader: reader, token: token::token) -> str { @@ -27,10 +27,6 @@ fn expect(p: parser, t: token::token) { } } -fn spanned(lo: uint, hi: uint, node: T) -> spanned { - ret {node: node, span: ast_util::mk_sp(lo, hi)}; -} - fn parse_ident(p: parser) -> ast::ident { alt p.token { token::IDENT(i, _) { p.bump(); ret p.get_str(i); } diff --git a/src/librustsyntax/parse/parser.rs b/src/librustsyntax/parse/parser.rs index 2a8e683dee59..8340fa2f6e7c 100644 --- a/src/librustsyntax/parse/parser.rs +++ b/src/librustsyntax/parse/parser.rs @@ -4,8 +4,7 @@ import std::map::{hashmap, str_hash}; import token::{can_begin_expr, is_ident, is_plain_ident}; import codemap::{span,fss_none}; import util::interner; -import ast::spanned; -import ast_util::{mk_sp, ident_to_path}; +import ast_util::{spanned, mk_sp, ident_to_path}; import lexer::reader; import prec::{op_spec, as_prec}; import attr::{parse_outer_attrs_or_ext,