mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-17 10:05:23 +00:00
Remove parse_program_tokens
This commit is contained in:
parent
452d28719f
commit
efad01d976
1 changed files with 2 additions and 14 deletions
|
@ -5,11 +5,10 @@
|
||||||
//! parse a whole program, a single statement, or a single
|
//! parse a whole program, a single statement, or a single
|
||||||
//! expression.
|
//! expression.
|
||||||
|
|
||||||
use std::iter;
|
|
||||||
|
|
||||||
use crate::lexer::LexResult;
|
use crate::lexer::LexResult;
|
||||||
pub use crate::mode::Mode;
|
pub use crate::mode::Mode;
|
||||||
use crate::{ast, error::ParseError, lexer, python};
|
use crate::{ast, error::ParseError, lexer, python};
|
||||||
|
use std::iter;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse python code.
|
* Parse python code.
|
||||||
|
@ -25,17 +24,6 @@ pub fn parse_program(source: &str, source_path: &str) -> Result<ast::Suite, Pars
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse the token stream for a full python program.
|
|
||||||
pub fn parse_program_tokens(
|
|
||||||
lxr: impl IntoIterator<Item=LexResult>,
|
|
||||||
source_path: &str,
|
|
||||||
) -> Result<ast::Suite, ParseError> {
|
|
||||||
parse_tokens(lxr, Mode::Module, source_path).map(|top| match top {
|
|
||||||
ast::Mod::Module { body, .. } => body,
|
|
||||||
_ => unreachable!(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Parses a python expression
|
/// Parses a python expression
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue