summaryrefslogtreecommitdiff
path: root/dhall/src/grammar_util.rs
blob: c546a13b6d5909c2878e7cbbbe1eceded5fb947b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::core::{Expr, X};
use crate::lexer::Builtin;

pub type ParsedExpr<'i> = Expr<'i, X, X>; // FIXME Parse paths and replace the second X with Path
pub type BoxExpr<'i> = Box<ParsedExpr<'i>>;
pub type ExprOpFn<'i> = fn(BoxExpr<'i>, BoxExpr<'i>) -> ParsedExpr<'i>;
pub type ExprListFn<'i> = fn(BoxExpr<'i>, Vec<ParsedExpr<'i>>) -> ParsedExpr<'i>;

pub fn builtin_expr<'i, S, A>(b: Builtin) -> Expr<'i, S, A> {
    match b {
        Builtin::Type(t)  => Expr::BuiltinType(t),
        Builtin::Value(v) => Expr::BuiltinValue(v),
    }
}