From e5d9aee00b0c775df1d8e2d8819aeb80dffa73c2 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 1 Mar 2019 17:28:19 +0100 Subject: Split abnf_to_pest and dhall into their own crates --- dhall/src/grammar_util.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 dhall/src/grammar_util.rs (limited to 'dhall/src/grammar_util.rs') diff --git a/dhall/src/grammar_util.rs b/dhall/src/grammar_util.rs new file mode 100644 index 0000000..c546a13 --- /dev/null +++ b/dhall/src/grammar_util.rs @@ -0,0 +1,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>; +pub type ExprOpFn<'i> = fn(BoxExpr<'i>, BoxExpr<'i>) -> ParsedExpr<'i>; +pub type ExprListFn<'i> = fn(BoxExpr<'i>, Vec>) -> 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), + } +} -- cgit v1.2.3