diff --git a/src/parser.rs b/src/parser.rs index 567d7b5..3fd16f6 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -194,7 +194,15 @@ fn table_constr( }) } -pub fn parser() -> impl Parser { - let expr = recursive(|expr| lit(expr).map(Expr::Lit)); - table_constr(expr).padded().then_ignore(end()) +fn expr( + expr: impl Parser + Clone, +) -> impl Parser { + let lit = lit(expr.clone()).map(Expr::Lit); + let table_constr = table_constr(expr.clone()).map(Expr::TableConstr); + + lit.or(table_constr) +} + +pub fn parser() -> impl Parser { + recursive(expr).padded().then_ignore(end()) }