summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNadrieril2019-03-06 12:19:26 +0100
committerNadrieril2019-03-06 12:19:26 +0100
commit564a5f37b106c69d8ebe9aec2f665f5222b3dfda (patch)
tree21779d5ea3bc5daaec7fa214402868cde101cfce
parent5b32c5bdea80a0bdf19240f3cc2b8e2ae251d51a (diff)
Split-off core into its own crate
-rw-r--r--Cargo.lock11
-rw-r--r--dhall/Cargo.toml8
-rw-r--r--dhall/src/lib.rs7
-rw-r--r--dhall/src/main.rs1
-rw-r--r--dhall/src/typecheck.rs14
-rw-r--r--dhall/tests/macros.rs1
-rw-r--r--dhall_core/Cargo.toml18
-rw-r--r--dhall_core/build.rs (renamed from dhall/build.rs)0
-rw-r--r--dhall_core/src/core.rs (renamed from dhall/src/core.rs)0
-rw-r--r--dhall_core/src/grammar.lalrpop (renamed from dhall/src/grammar.lalrpop)0
-rw-r--r--dhall_core/src/grammar_util.rs (renamed from dhall/src/grammar_util.rs)0
-rw-r--r--dhall_core/src/lexer.rs (renamed from dhall/src/lexer.rs)0
-rw-r--r--dhall_core/src/lib.rs10
-rw-r--r--dhall_core/src/parser.rs (renamed from dhall/src/parser.rs)0
14 files changed, 49 insertions, 21 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e5cd07f..58fdd1c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -135,6 +135,17 @@ name = "dhall"
version = "0.1.0"
dependencies = [
"bytecount 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "dhall_core 0.1.0",
+ "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "term-painter 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "dhall_core"
+version = "0.1.0"
+dependencies = [
+ "bytecount 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dhall_parser 0.1.0",
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lalrpop 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/dhall/Cargo.toml b/dhall/Cargo.toml
index d44324a..db62d5b 100644
--- a/dhall/Cargo.toml
+++ b/dhall/Cargo.toml
@@ -3,16 +3,10 @@ name = "dhall"
version = "0.1.0"
authors = ["NanoTech <nanotech@nanotechcorp.net>", "Nadrieril <nadrieril@users.noreply.github.com>"]
edition = "2018"
-build = "build.rs"
-
-[build-dependencies]
-lalrpop = "0.16.3"
[dependencies]
bytecount = "0.5.1"
itertools = "0.8.0"
lalrpop-util = "0.16.3"
-nom = "3.0.0"
term-painter = "0.2.3"
-pest = { git = "https://github.com/pest-parser/pest" }
-dhall_parser = { path = "../dhall_parser" }
+dhall_core = { path = "../dhall_core" }
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs
index 7cc96e1..902df53 100644
--- a/dhall/src/lib.rs
+++ b/dhall/src/lib.rs
@@ -2,11 +2,4 @@
#![feature(trace_macros)]
pub mod context;
-mod core;
-pub use crate::core::*;
-use lalrpop_util::lalrpop_mod;
-lalrpop_mod!(pub grammar);
-mod grammar_util;
-pub mod lexer;
-pub mod parser;
pub mod typecheck;
diff --git a/dhall/src/main.rs b/dhall/src/main.rs
index 78a2905..3e8aca4 100644
--- a/dhall/src/main.rs
+++ b/dhall/src/main.rs
@@ -3,6 +3,7 @@ use std::io::{self, Read};
use term_painter::ToStyle;
use dhall::*;
+use dhall_core::*;
const ERROR_STYLE: term_painter::Color = term_painter::Color::Red;
const BOLD: term_painter::Attr = term_painter::Attr::Bold;
diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs
index 976293d..61a83e7 100644
--- a/dhall/src/typecheck.rs
+++ b/dhall/src/typecheck.rs
@@ -4,12 +4,12 @@ use std::collections::HashSet;
use std::fmt;
use crate::context::Context;
-use crate::core;
-use crate::core::Builtin::*;
-use crate::core::Const::*;
-use crate::core::Expr::*;
-use crate::core::{app, pi};
-use crate::core::{bx, normalize, shift, subst, Expr, V, X};
+use dhall_core::core;
+use dhall_core::core::Builtin::*;
+use dhall_core::core::Const::*;
+use dhall_core::core::Expr::*;
+use dhall_core::core::{app, pi};
+use dhall_core::core::{bx, normalize, shift, subst, Expr, V, X};
use self::TypeMessage::*;
@@ -184,7 +184,7 @@ pub fn type_with<'i, S>(
where
S: Clone + ::std::fmt::Debug + 'i,
{
- use crate::BinOp::*;
+ use dhall_core::BinOp::*;
match *e {
Const(c) => axiom(c).map(Const), //.map(Cow::Owned),
Var(V(x, n)) => {
diff --git a/dhall/tests/macros.rs b/dhall/tests/macros.rs
index 66b9dbf..777a2f6 100644
--- a/dhall/tests/macros.rs
+++ b/dhall/tests/macros.rs
@@ -91,6 +91,7 @@ macro_rules! make_spec_test {
#[allow(unused_imports)]
fn $name() {
use dhall::*;
+ use dhall_core::*;
use std::thread;
thread::Builder::new()
diff --git a/dhall_core/Cargo.toml b/dhall_core/Cargo.toml
new file mode 100644
index 0000000..943e300
--- /dev/null
+++ b/dhall_core/Cargo.toml
@@ -0,0 +1,18 @@
+[package]
+name = "dhall_core"
+version = "0.1.0"
+authors = ["NanoTech <nanotech@nanotechcorp.net>", "Nadrieril <nadrieril@users.noreply.github.com>"]
+edition = "2018"
+build = "build.rs"
+
+[build-dependencies]
+lalrpop = "0.16.3"
+
+[dependencies]
+bytecount = "0.5.1"
+itertools = "0.8.0"
+lalrpop-util = "0.16.3"
+nom = "3.0.0"
+term-painter = "0.2.3"
+pest = { git = "https://github.com/pest-parser/pest" }
+dhall_parser = { path = "../dhall_parser" }
diff --git a/dhall/build.rs b/dhall_core/build.rs
index 946841a..946841a 100644
--- a/dhall/build.rs
+++ b/dhall_core/build.rs
diff --git a/dhall/src/core.rs b/dhall_core/src/core.rs
index 340cb04..340cb04 100644
--- a/dhall/src/core.rs
+++ b/dhall_core/src/core.rs
diff --git a/dhall/src/grammar.lalrpop b/dhall_core/src/grammar.lalrpop
index 1ffe2ff..1ffe2ff 100644
--- a/dhall/src/grammar.lalrpop
+++ b/dhall_core/src/grammar.lalrpop
diff --git a/dhall/src/grammar_util.rs b/dhall_core/src/grammar_util.rs
index ce73444..ce73444 100644
--- a/dhall/src/grammar_util.rs
+++ b/dhall_core/src/grammar_util.rs
diff --git a/dhall/src/lexer.rs b/dhall_core/src/lexer.rs
index 5fc0f05..5fc0f05 100644
--- a/dhall/src/lexer.rs
+++ b/dhall_core/src/lexer.rs
diff --git a/dhall_core/src/lib.rs b/dhall_core/src/lib.rs
new file mode 100644
index 0000000..e1d0f7d
--- /dev/null
+++ b/dhall_core/src/lib.rs
@@ -0,0 +1,10 @@
+#![feature(box_patterns)]
+#![feature(trace_macros)]
+
+pub mod core;
+pub use crate::core::*;
+use lalrpop_util::lalrpop_mod;
+lalrpop_mod!(pub grammar);
+mod grammar_util;
+pub mod lexer;
+pub mod parser;
diff --git a/dhall/src/parser.rs b/dhall_core/src/parser.rs
index 6b20c01..6b20c01 100644
--- a/dhall/src/parser.rs
+++ b/dhall_core/src/parser.rs