From 897b7c3e5a96c3c4d3fecb58a2a3fd5f3b0f97ae Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 12 Jun 2024 03:12:48 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20(parser):=20Add=20`expect?= =?UTF-8?q?=5Fstatement`=20and=20`expect=5Fexpression`=20macros?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit semver: chore --- src/parser/macros.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/parser/macros.rs b/src/parser/macros.rs index 85efeca..b699cf0 100644 --- a/src/parser/macros.rs +++ b/src/parser/macros.rs @@ -1,3 +1,15 @@ +macro_rules! expect_statement { + ($parser:expr, $cursor:expr) => {{ + crate::parser::statement::parse($parser, $cursor) + }}; +} + +macro_rules! expect_expression { + ($parser:expr, $cursor:expr, $binding_power:expr) => {{ + crate::parser::expression::parse($parser, $cursor, &$binding_power) + }}; +} + macro_rules! expect_token { ($parser:expr, $cursor:expr, $token_type:expr) => {{ let lexeme = crate::parser::macros::expect_tokens!($parser, $cursor, ($token_type)) @@ -44,5 +56,7 @@ macro_rules! expect_tokens { }}; } +pub(crate) use expect_expression; +pub(crate) use expect_statement; pub(crate) use expect_token; pub(crate) use expect_tokens;