move path
This commit is contained in:
parent
c5d8a9b341
commit
369001615f
@ -690,7 +690,11 @@ fn match_leaf(lhs: &tt::Leaf, src: &mut TtIter) -> Result<(), ExpandError> {
|
||||
|
||||
fn match_meta_var(kind: &str, input: &mut TtIter) -> ExpandResult<Option<Fragment>> {
|
||||
let fragment = match kind {
|
||||
"path" => ParserEntryPoint::Path,
|
||||
"path" => {
|
||||
return input
|
||||
.expect_fragment2(parser::PrefixEntryPoint::Path)
|
||||
.map(|tt| tt.map(Fragment::Tokens));
|
||||
}
|
||||
"expr" => {
|
||||
return input
|
||||
.expect_fragment2(parser::PrefixEntryPoint::Expr)
|
||||
|
@ -72,6 +72,9 @@ pub(crate) fn ty(p: &mut Parser) {
|
||||
pub(crate) fn expr(p: &mut Parser) {
|
||||
let _ = expressions::expr(p);
|
||||
}
|
||||
pub(crate) fn path(p: &mut Parser) {
|
||||
let _ = paths::type_path(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,12 +88,6 @@ pub(crate) fn source_file(p: &mut Parser) {
|
||||
m.complete(p, SOURCE_FILE);
|
||||
}
|
||||
|
||||
pub(crate) use paths::type_path as path;
|
||||
|
||||
pub(crate) fn expr(p: &mut Parser) {
|
||||
let _ = expressions::expr(p);
|
||||
}
|
||||
|
||||
pub(crate) fn stmt_optional_semi(p: &mut Parser) {
|
||||
expressions::stmt(p, expressions::StmtWithSemi::Optional, false);
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ pub enum PrefixEntryPoint {
|
||||
Pat,
|
||||
Ty,
|
||||
Expr,
|
||||
Path,
|
||||
}
|
||||
|
||||
impl PrefixEntryPoint {
|
||||
@ -69,6 +70,7 @@ pub fn parse(&self, input: &Input) -> Output {
|
||||
PrefixEntryPoint::Pat => grammar::entry::prefix::pat,
|
||||
PrefixEntryPoint::Ty => grammar::entry::prefix::ty,
|
||||
PrefixEntryPoint::Expr => grammar::entry::prefix::expr,
|
||||
PrefixEntryPoint::Path => grammar::entry::prefix::path,
|
||||
};
|
||||
let mut p = parser::Parser::new(input);
|
||||
entry_point(&mut p);
|
||||
@ -112,8 +114,8 @@ pub fn parse_source_file(inp: &Input) -> Output {
|
||||
pub fn parse(inp: &Input, entry_point: ParserEntryPoint) -> Output {
|
||||
let entry_point: fn(&'_ mut parser::Parser) = match entry_point {
|
||||
ParserEntryPoint::SourceFile => grammar::entry_points::source_file,
|
||||
ParserEntryPoint::Path => grammar::entry_points::path,
|
||||
ParserEntryPoint::Expr => grammar::entry_points::expr,
|
||||
ParserEntryPoint::Path => grammar::entry::prefix::path,
|
||||
ParserEntryPoint::Expr => grammar::entry::prefix::expr,
|
||||
ParserEntryPoint::Type => grammar::entry::prefix::ty,
|
||||
ParserEntryPoint::Pattern => grammar::entry::prefix::pat,
|
||||
ParserEntryPoint::Item => grammar::entry_points::item,
|
||||
|
Loading…
Reference in New Issue
Block a user