mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
internal: move visibility to a prefix entry point
This commit is contained in:
parent
abc658aad0
commit
350d5dc152
4 changed files with 62 additions and 8 deletions
|
@ -49,12 +49,13 @@ pub use crate::{
|
|||
/// `Option<Output>`. The way MBE work, by the time we *try* to parse `$e:expr`
|
||||
/// we already commit to expression. In other words, this API by design can't be
|
||||
/// used to implement "rollback and try another alternative" logic.
|
||||
#[derive(Debug)]
|
||||
pub enum PrefixEntryPoint {
|
||||
Vis,
|
||||
}
|
||||
|
||||
impl PrefixEntryPoint {
|
||||
pub fn parse(self, input: &Input) -> Output {
|
||||
pub fn parse(&self, input: &Input) -> Output {
|
||||
let entry_point: fn(&'_ mut parser::Parser) = match self {
|
||||
PrefixEntryPoint::Vis => grammar::entry::prefix::vis,
|
||||
};
|
||||
|
@ -80,7 +81,7 @@ pub enum ParserEntryPoint {
|
|||
Pattern,
|
||||
Item,
|
||||
Block,
|
||||
Visibility,
|
||||
// Visibility,
|
||||
MetaItem,
|
||||
Items,
|
||||
Statements,
|
||||
|
@ -109,7 +110,7 @@ pub fn parse(inp: &Input, entry_point: ParserEntryPoint) -> Output {
|
|||
ParserEntryPoint::Pattern => grammar::entry_points::pattern,
|
||||
ParserEntryPoint::Item => grammar::entry_points::item,
|
||||
ParserEntryPoint::Block => grammar::entry_points::block_expr,
|
||||
ParserEntryPoint::Visibility => grammar::entry_points::visibility,
|
||||
// ParserEntryPoint::Visibility => grammar::entry_points::visibility,
|
||||
ParserEntryPoint::MetaItem => grammar::entry_points::meta_item,
|
||||
ParserEntryPoint::Statement => grammar::entry_points::stmt,
|
||||
ParserEntryPoint::StatementOptionalSemi => grammar::entry_points::stmt_optional_semi,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue