diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-03-13 11:34:51 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2015-03-13 11:36:30 +0200 |
| commit | 9889aae13e14c306fce8cefd669841fa40f26ee9 (patch) | |
| tree | bbcd59c8ec0c1038956b9b8982f404c52311c4a8 /src/libsyntax/parse/mod.rs | |
| parent | 79dd393a4f144fa5e6f81c720c782de3175810d7 (diff) | |
| download | rust-9889aae13e14c306fce8cefd669841fa40f26ee9.tar.gz rust-9889aae13e14c306fce8cefd669841fa40f26ee9.zip | |
syntax: use lookahead to distinguish inner and outer attributes, instead of passing the latter around.
Diffstat (limited to 'src/libsyntax/parse/mod.rs')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index fae305f9551..3e02b4e0752 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -96,9 +96,7 @@ pub fn parse_crate_attrs_from_file( cfg: ast::CrateConfig, sess: &ParseSess ) -> Vec<ast::Attribute> { - let mut parser = new_parser_from_file(sess, cfg, input); - let (inner, _) = parser.parse_inner_attrs_and_next(); - inner + new_parser_from_file(sess, cfg, input).parse_inner_attributes() } pub fn parse_crate_from_source_str(name: String, @@ -122,8 +120,7 @@ pub fn parse_crate_attrs_from_source_str(name: String, cfg, name, source); - let (inner, _) = maybe_aborted(p.parse_inner_attrs_and_next(),p); - inner + maybe_aborted(p.parse_inner_attributes(), p) } pub fn parse_expr_from_source_str(name: String, @@ -141,7 +138,7 @@ pub fn parse_item_from_source_str(name: String, sess: &ParseSess) -> Option<P<ast::Item>> { let mut p = new_parser_from_source_str(sess, cfg, name, source); - maybe_aborted(p.parse_item_with_outer_attributes(),p) + maybe_aborted(p.parse_item(),p) } pub fn parse_meta_from_source_str(name: String, @@ -156,16 +153,15 @@ pub fn parse_meta_from_source_str(name: String, pub fn parse_stmt_from_source_str(name: String, source: String, cfg: ast::CrateConfig, - attrs: Vec<ast::Attribute> , sess: &ParseSess) - -> P<ast::Stmt> { + -> Option<P<ast::Stmt>> { let mut p = new_parser_from_source_str( sess, cfg, name, source ); - maybe_aborted(p.parse_stmt(attrs),p) + maybe_aborted(p.parse_stmt(), p) } // Note: keep in sync with `with_hygiene::parse_tts_from_source_str` |
