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.
This commit is contained in:
parent
7b5c3d2b20
commit
a2566301e1
6 changed files with 46 additions and 10 deletions
|
@ -418,9 +418,13 @@ fn inner_parse_loop(sess: &ParseSess,
|
|||
Success(())
|
||||
}
|
||||
|
||||
pub fn parse(sess: &ParseSess, tts: TokenStream, ms: &[TokenTree], directory: Option<Directory>)
|
||||
pub fn parse(sess: &ParseSess,
|
||||
tts: TokenStream,
|
||||
ms: &[TokenTree],
|
||||
directory: Option<Directory>,
|
||||
recurse_into_modules: bool)
|
||||
-> NamedParseResult {
|
||||
let mut parser = Parser::new(sess, tts, directory, true);
|
||||
let mut parser = Parser::new(sess, tts, directory, recurse_into_modules, true);
|
||||
let mut cur_eis = SmallVector::one(initial_matcher_pos(ms.to_owned(), parser.span.lo));
|
||||
let mut next_eis = Vec::new(); // or proceed normally
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue