Don't use the word "parse" for lexing operations.
Lexing converts source text into a token stream. Parsing converts a token stream into AST fragments. This commit renames several lexing operations that have "parse" in the name. I think these names have been subtly confusing me for years. This is just a `s/parse/lex/` on function names, with one exception: `parse_stream_from_source_str` becomes `source_str_to_stream`, to make it consistent with the existing `source_file_to_stream`. The commit also moves that function's location in the file to be just above `source_file_to_stream`. The commit also cleans up a few comments along the way.
This commit is contained in:
parent
e1ae0fa055
commit
d1215da26e
5 changed files with 41 additions and 49 deletions
|
@ -13,7 +13,7 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{Diag, ErrorGuaranteed, MultiSpan, PResult};
|
||||
use rustc_parse::lexer::nfc_normalize;
|
||||
use rustc_parse::parse_stream_from_source_str;
|
||||
use rustc_parse::source_str_to_stream;
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::def_id::CrateNum;
|
||||
use rustc_span::symbol::{self, sym, Symbol};
|
||||
|
@ -538,7 +538,7 @@ impl server::TokenStream for Rustc<'_, '_> {
|
|||
}
|
||||
|
||||
fn from_str(&mut self, src: &str) -> Self::TokenStream {
|
||||
parse_stream_from_source_str(
|
||||
source_str_to_stream(
|
||||
FileName::proc_macro_source_code(src),
|
||||
src.to_string(),
|
||||
self.psess(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue