summaryrefslogtreecommitdiff
path: root/src/grammar_util.rs
blob: 49b7fb805b616a644e4eb24f3e194c1281798ce7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use core::{Expr, X};
use 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),
    }
}