about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2021-12-27 16:17:29 +0300
committerAleksey Kladov <aleksey.kladov@gmail.com>2021-12-28 17:00:55 +0300
commitc5d8a9b341eee52ef5d83c61726700f42492ace9 (patch)
tree8e4bbb60f654b8b7ae55e2785fda8602797fe096
parent04ae18de295d997ad6ca0adf1de0f3efd4e1aa35 (diff)
downloadrust-c5d8a9b341eee52ef5d83c61726700f42492ace9.tar.gz
rust-c5d8a9b341eee52ef5d83c61726700f42492ace9.zip
move expr
-rw-r--r--crates/mbe/src/expander/matcher.rs6
-rw-r--r--crates/parser/src/grammar.rs3
-rw-r--r--crates/parser/src/lib.rs2
3 files changed, 10 insertions, 1 deletions
diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs
index c5c13590dd1..6cc655786cb 100644
--- a/crates/mbe/src/expander/matcher.rs
+++ b/crates/mbe/src/expander/matcher.rs
@@ -691,7 +691,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,
-        "expr" => ParserEntryPoint::Expr,
+        "expr" => {
+            return input
+                .expect_fragment2(parser::PrefixEntryPoint::Expr)
+                .map(|tt| tt.map(Fragment::Expr));
+        }
         "ty" => {
             return input
                 .expect_fragment2(parser::PrefixEntryPoint::Ty)
diff --git a/crates/parser/src/grammar.rs b/crates/parser/src/grammar.rs
index 539dc19b517..6789c61f4b3 100644
--- a/crates/parser/src/grammar.rs
+++ b/crates/parser/src/grammar.rs
@@ -69,6 +69,9 @@ pub(crate) mod entry {
         pub(crate) fn ty(p: &mut Parser) {
             types::type_(p);
         }
+        pub(crate) fn expr(p: &mut Parser) {
+            let _ = expressions::expr(p);
+        }
     }
 }
 
diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs
index ebb060a5639..6aeed8a2887 100644
--- a/crates/parser/src/lib.rs
+++ b/crates/parser/src/lib.rs
@@ -57,6 +57,7 @@ pub enum PrefixEntryPoint {
     Stmt,
     Pat,
     Ty,
+    Expr,
 }
 
 impl PrefixEntryPoint {
@@ -67,6 +68,7 @@ impl PrefixEntryPoint {
             PrefixEntryPoint::Stmt => grammar::entry::prefix::stmt,
             PrefixEntryPoint::Pat => grammar::entry::prefix::pat,
             PrefixEntryPoint::Ty => grammar::entry::prefix::ty,
+            PrefixEntryPoint::Expr => grammar::entry::prefix::expr,
         };
         let mut p = parser::Parser::new(input);
         entry_point(&mut p);