Permalink
Browse files

Use an impl to access parse/common.rs

  • Loading branch information...
1 parent 829c983 commit 09652c8f5f0f12913396898afd4fb382ae90a448 @paulstansifer paulstansifer committed May 24, 2012
Showing with 447 additions and 437 deletions.
  1. +2 −1 src/librustsyntax/parse.rs
  2. +7 −10 src/librustsyntax/parse/attr.rs
  3. +170 −159 src/librustsyntax/parse/common.rs
  4. +268 −267 src/librustsyntax/parse/parser.rs
@@ -13,6 +13,7 @@ export parse_item_from_source_str;
export parse_from_source_str;
import parser::parser;
+import common::parser_common;
import ast::node_id;
import util::interner;
import lexer::reader;
@@ -56,7 +57,7 @@ fn parse_crate_from_crate_file(input: str, cfg: ast::crate_cfg,
let (m, attrs) = eval::eval_crate_directives_to_mod(
cx, cdirs, prefix, option::some(companionmod));
let mut hi = p.span.hi;
- parser::expect(p, token::EOF);
+ p.expect(token::EOF);
ret @ast_util::respan(ast_util::mk_sp(lo, hi),
{directives: cdirs,
module: m,
@@ -1,9 +1,6 @@
import either::{either, left, right};
import ast_util::spanned;
-import common::{parse_seq,
- seq_sep,
- expect,
- parse_ident};
+import common::{parser_common, seq_sep};
export attr_or_ext;
export parse_outer_attributes;
@@ -45,15 +42,15 @@ fn parse_outer_attributes(p: parser) -> [ast::attribute] {
fn parse_attribute(p: parser, style: ast::attr_style) -> ast::attribute {
let lo = p.span.lo;
- expect(p, token::POUND);
+ p.expect(token::POUND);
ret parse_attribute_naked(p, style, lo);
}
fn parse_attribute_naked(p: parser, style: ast::attr_style, lo: uint) ->
ast::attribute {
- expect(p, token::LBRACKET);
+ p.expect(token::LBRACKET);
let meta_item = parse_meta_item(p);
- expect(p, token::RBRACKET);
+ p.expect(token::RBRACKET);
let mut hi = p.span.hi;
ret spanned(lo, hi, {style: style, value: *meta_item});
}
@@ -91,7 +88,7 @@ fn parse_inner_attrs_and_next(p: parser) ->
fn parse_meta_item(p: parser) -> @ast::meta_item {
let lo = p.span.lo;
- let ident = parse_ident(p);
+ let ident = p.parse_ident();
alt p.token {
token::EQ {
p.bump();
@@ -112,8 +109,8 @@ fn parse_meta_item(p: parser) -> @ast::meta_item {
}
fn parse_meta_seq(p: parser) -> [@ast::meta_item] {
- ret parse_seq(token::LPAREN, token::RPAREN, seq_sep(token::COMMA),
- p, {|p| parse_meta_item(p)}).node;
+ ret p.parse_seq(token::LPAREN, token::RPAREN, seq_sep(token::COMMA),
+ {|p| parse_meta_item(p)}).node;
}
fn parse_optional_meta(p: parser) -> [@ast::meta_item] {
Oops, something went wrong.

0 comments on commit 09652c8

Please sign in to comment.