diff options
| author | Haitao Li <lihaitao@gmail.com> | 2011-11-22 12:31:09 +0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-11-24 15:31:18 -0800 |
| commit | 3e303af86b5380c7d53a8879d883cd36ad2a69a6 (patch) | |
| tree | 342981fb73a0039355f343a2210dbedb95e7c970 /src/comp/syntax/parse/parser.rs | |
| parent | 547ec241bd50e86752e4c39047b417550f655349 (diff) | |
| download | rust-3e303af86b5380c7d53a8879d883cd36ad2a69a6.tar.gz rust-3e303af86b5380c7d53a8879d883cd36ad2a69a6.zip | |
rustc: Add a path attribute for crate directives
The path information was an optional "filename" component of crate directive AST. It is now replaced by an attribute with metadata named "path". With this commit, a directive mod foo = "foo.rs"; should be written as: #[path = "foo.rs"] mod foo; Closes issue #906.
Diffstat (limited to 'src/comp/syntax/parse/parser.rs')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 4f81a1dfe73..82c477a7d96 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -2475,19 +2475,12 @@ fn parse_crate_directive(p: parser, first_outer_attr: [ast::attribute]) -> if expect_mod || is_word(p, "mod") { expect_word(p, "mod"); let id = parse_ident(p); - let file_opt = - alt p.peek() { - token::EQ. { p.bump(); some(parse_str(p)) } - _ { - attr::get_meta_item_value_str_by_name(outer_attrs, "path") - } - }; alt p.peek() { // mod x = "foo.rs"; token::SEMI. { let hi = p.get_hi_pos(); p.bump(); - ret spanned(lo, hi, ast::cdir_src_mod(id, file_opt, outer_attrs)); + ret spanned(lo, hi, ast::cdir_src_mod(id, outer_attrs)); } // mod x = "foo_dir" { ...directives... } token::LBRACE. { @@ -2500,7 +2493,7 @@ fn parse_crate_directive(p: parser, first_outer_attr: [ast::attribute]) -> let hi = p.get_hi_pos(); expect(p, token::RBRACE); ret spanned(lo, hi, - ast::cdir_dir_mod(id, file_opt, cdirs, mod_attrs)); + ast::cdir_dir_mod(id, cdirs, mod_attrs)); } t { unexpected(p, t); } } |
