diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2017-05-18 10:37:24 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2017-05-18 11:03:07 +1200 |
| commit | a2566301e12364e227f0b72b51bb09698e1cb9dc (patch) | |
| tree | fa4d5dcdc8ee58dc843018f8ecc599a5b733596d /src/libsyntax/ext/tt/macro_rules.rs | |
| parent | 7b5c3d2b208f47b0750ea6c39f6f3f97cb1ca1bb (diff) | |
| download | rust-a2566301e12364e227f0b72b51bb09698e1cb9dc.tar.gz rust-a2566301e12364e227f0b72b51bb09698e1cb9dc.zip | |
Add an option to the parser to avoid parsing out of line modules
This is useful if parsing from stdin or a String and don't want to try and read in a module from another file. Instead we just leave a stub in the AST.
Diffstat (limited to 'src/libsyntax/ext/tt/macro_rules.rs')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index a208f530602..73494d47fee 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -121,7 +121,7 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt, path: cx.current_expansion.module.directory.clone(), ownership: cx.current_expansion.directory_ownership, }; - let mut p = Parser::new(cx.parse_sess(), tts, Some(directory), false); + let mut p = Parser::new(cx.parse_sess(), tts, Some(directory), true, false); p.root_module_name = cx.current_expansion.module.mod_path.last() .map(|id| id.name.as_str().to_string()); @@ -192,7 +192,7 @@ pub fn compile(sess: &ParseSess, features: &RefCell<Features>, def: &ast::Item) ast::ItemKind::MacroDef(ref body) => body.clone().into(), _ => unreachable!(), }; - let argument_map = match parse(sess, body, &argument_gram, None) { + let argument_map = match parse(sess, body, &argument_gram, None, true) { Success(m) => m, Failure(sp, tok) => { let s = parse_failure_msg(tok); |
