diff options
| author | bors <bors@rust-lang.org> | 2014-11-18 23:51:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-11-18 23:51:43 +0000 |
| commit | e09d98603e608c9e47d4c89f7b4dca87a4b56da3 (patch) | |
| tree | 830bdec7e6fc4c19726398108bbf760a64ba0131 /src/libsyntax/util/parser_testing.rs | |
| parent | 1628b98183bfec13e9407a905324dda047c3a550 (diff) | |
| parent | 2293a04b4936a11fc3e09f3df8a8ab591e034f29 (diff) | |
| download | rust-e09d98603e608c9e47d4c89f7b4dca87a4b56da3.tar.gz rust-e09d98603e608c9e47d4c89f7b4dca87a4b56da3.zip | |
auto merge of #19044 : murarth/rust/libsyntax-view-item, r=alexcrichton
Allows parsing view items (`use` and `extern crate`) individually. Does not change behavior of any existing functions. Closes #19024
Diffstat (limited to 'src/libsyntax/util/parser_testing.rs')
| -rw-r--r-- | src/libsyntax/util/parser_testing.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index d0faa3c6820..c1ea8f60b82 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -67,6 +67,13 @@ pub fn string_to_stmt(source_str : String) -> P<ast::Stmt> { }) } +/// Parse a string, return a view item +pub fn string_to_view_item (source_str : String) -> ast::ViewItem { + with_error_checking_parse(source_str, |p| { + p.parse_view_item(Vec::new()) + }) +} + /// Parse a string, return a pat. Uses "irrefutable"... which doesn't /// (currently) affect parsing. pub fn string_to_pat(source_str: String) -> P<ast::Pat> { |
