Prepare parser for function definitions

This commit is contained in:
Joscha 2022-11-19 18:58:39 +01:00
parent 86006933d7
commit 9a1bb92dfe
4 changed files with 22 additions and 2 deletions

View file

@ -6,6 +6,7 @@ use crate::ast::{BinOp, Expr};
use crate::span::HasSpan;
use super::basic::{space, Error};
use super::func_defs::func_def;
use super::lit::lit;
use super::prefix::prefixed;
use super::suffix::suffixed;
@ -36,9 +37,16 @@ fn atom(
let var = var(expr.clone()).map(Expr::Var);
let table_constr = table_constr(expr.clone()).map(Expr::TableConstr);
let table_destr = table_destr(expr.clone()).map(Expr::TableDestr);
let func_def = func_def(expr.clone()).map(Expr::FuncDef);
let paren = atom_paren(expr.clone());
let base = lit.or(paren).or(table_destr).or(table_constr).or(var);
let base = lit
.or(paren)
.or(table_destr)
.or(table_constr)
.or(func_def)
.or(var);
prefixed(suffixed(base, expr))
}