Replies: 1 comment 1 reply
-
It works if you inline it into one rule: #[cache_left_rec]
pub rule expression() -> TestExpression =
callee:expression() lparen() arg:(expression() ** ",") rparen() {
TestExpression::FunctionCall { callee: Box::new(callee), arguments: arg }
}
/ identifier() I think the issue is the mutual recursion with Here, that injected failure of |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm having some issues using the
#[cache_left_rec]
attribute.Here's my code:
When I try to match the string
abc()
with the rulefunction_call
it works fine, returningOk(FunctionCall { callee: Identifier("abc"), arguments: [] })
.But when I try to match the same string with the
expression
rule it doesn't work.Here's the trace:
It looks as if it just discards the possibility of the
expression
being afunction_call
at the very beginning and just matchesabc
as anidentifier
, leaving()
which then causes the error.I would really appreciate some help, as I have banged my head against this for like 2 days.
Beta Was this translation helpful? Give feedback.
All reactions