restore some rustc_parse visibilities
This commit is contained in:
parent
1389494ac1
commit
ed039e8f84
2 changed files with 17 additions and 8 deletions
|
@ -2,6 +2,7 @@ pub mod attr;
|
||||||
mod expr;
|
mod expr;
|
||||||
mod item;
|
mod item;
|
||||||
mod module;
|
mod module;
|
||||||
|
pub use module::{ModulePath, ModulePathSuccess};
|
||||||
mod pat;
|
mod pat;
|
||||||
mod path;
|
mod path;
|
||||||
mod ty;
|
mod ty;
|
||||||
|
@ -117,7 +118,8 @@ pub struct Parser<'a> {
|
||||||
/// Used to determine the path to externally loaded source files.
|
/// Used to determine the path to externally loaded source files.
|
||||||
pub(super) directory: Directory<'a>,
|
pub(super) directory: Directory<'a>,
|
||||||
/// `true` to parse sub-modules in other files.
|
/// `true` to parse sub-modules in other files.
|
||||||
pub(super) recurse_into_file_modules: bool,
|
// Public for rustfmt usage.
|
||||||
|
pub recurse_into_file_modules: bool,
|
||||||
/// Name of the root module this parser originated from. If `None`, then the
|
/// Name of the root module this parser originated from. If `None`, then the
|
||||||
/// name is not known. This does not change while the parser is descending
|
/// name is not known. This does not change while the parser is descending
|
||||||
/// into modules, and sub-parsers have new values for this name.
|
/// into modules, and sub-parsers have new values for this name.
|
||||||
|
@ -126,7 +128,8 @@ pub struct Parser<'a> {
|
||||||
token_cursor: TokenCursor,
|
token_cursor: TokenCursor,
|
||||||
desugar_doc_comments: bool,
|
desugar_doc_comments: bool,
|
||||||
/// `true` we should configure out of line modules as we parse.
|
/// `true` we should configure out of line modules as we parse.
|
||||||
cfg_mods: bool,
|
// Public for rustfmt usage.
|
||||||
|
pub cfg_mods: bool,
|
||||||
/// This field is used to keep track of how many left angle brackets we have seen. This is
|
/// This field is used to keep track of how many left angle brackets we have seen. This is
|
||||||
/// required in order to detect extra leading left angle brackets (`<` characters) and error
|
/// required in order to detect extra leading left angle brackets (`<` characters) and error
|
||||||
/// appropriately.
|
/// appropriately.
|
||||||
|
@ -483,7 +486,8 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_ident(&mut self) -> PResult<'a, ast::Ident> {
|
// Public for rustfmt usage.
|
||||||
|
pub fn parse_ident(&mut self) -> PResult<'a, ast::Ident> {
|
||||||
self.parse_ident_common(true)
|
self.parse_ident_common(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,7 +544,8 @@ impl<'a> Parser<'a> {
|
||||||
|
|
||||||
/// If the next token is the given keyword, eats it and returns `true`.
|
/// If the next token is the given keyword, eats it and returns `true`.
|
||||||
/// Otherwise, returns `false`. An expectation is also added for diagnostics purposes.
|
/// Otherwise, returns `false`. An expectation is also added for diagnostics purposes.
|
||||||
fn eat_keyword(&mut self, kw: Symbol) -> bool {
|
// Public for rustfmt usage.
|
||||||
|
pub fn eat_keyword(&mut self, kw: Symbol) -> bool {
|
||||||
if self.check_keyword(kw) {
|
if self.check_keyword(kw) {
|
||||||
self.bump();
|
self.bump();
|
||||||
true
|
true
|
||||||
|
|
|
@ -14,13 +14,15 @@ use syntax::token::{self, TokenKind};
|
||||||
use std::path::{self, Path, PathBuf};
|
use std::path::{self, Path, PathBuf};
|
||||||
|
|
||||||
/// Information about the path to a module.
|
/// Information about the path to a module.
|
||||||
pub(super) struct ModulePath {
|
// Public for rustfmt usage.
|
||||||
|
pub struct ModulePath {
|
||||||
name: String,
|
name: String,
|
||||||
path_exists: bool,
|
path_exists: bool,
|
||||||
pub result: Result<ModulePathSuccess, Error>,
|
pub result: Result<ModulePathSuccess, Error>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) struct ModulePathSuccess {
|
// Public for rustfmt usage.
|
||||||
|
pub struct ModulePathSuccess {
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
pub directory_ownership: DirectoryOwnership,
|
pub directory_ownership: DirectoryOwnership,
|
||||||
}
|
}
|
||||||
|
@ -177,7 +179,8 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn submod_path_from_attr(attrs: &[Attribute], dir_path: &Path) -> Option<PathBuf> {
|
// Public for rustfmt usage.
|
||||||
|
pub fn submod_path_from_attr(attrs: &[Attribute], dir_path: &Path) -> Option<PathBuf> {
|
||||||
if let Some(s) = attr::first_attr_value_str_by_name(attrs, sym::path) {
|
if let Some(s) = attr::first_attr_value_str_by_name(attrs, sym::path) {
|
||||||
let s = s.as_str();
|
let s = s.as_str();
|
||||||
|
|
||||||
|
@ -194,7 +197,8 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a path to a module.
|
/// Returns a path to a module.
|
||||||
pub(super) fn default_submod_path(
|
// Public for rustfmt usage.
|
||||||
|
pub fn default_submod_path(
|
||||||
id: ast::Ident,
|
id: ast::Ident,
|
||||||
relative: Option<ast::Ident>,
|
relative: Option<ast::Ident>,
|
||||||
dir_path: &Path,
|
dir_path: &Path,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue