summaryrefslogtreecommitdiff
path: root/pest_consume_macros
diff options
context:
space:
mode:
authorNadrieril2019-09-09 22:42:46 +0200
committerNadrieril2019-09-09 22:42:46 +0200
commitaccaf45aa77099654f94319ed1fb12855dd568b4 (patch)
treea56ca7ee9fc2b7a5dc7bb7fb5451f8b0255129c3 /pest_consume_macros
parent595a52018e31126ecbf1be49794750f1a59a66b1 (diff)
Move pest_consume macros into their own crate
Diffstat (limited to '')
-rw-r--r--pest_consume_macros/Cargo.toml18
-rw-r--r--pest_consume_macros/src/lib.rs28
-rw-r--r--pest_consume_macros/src/make_parser.rs (renamed from dhall_proc_macros/src/make_parser.rs)0
-rw-r--r--pest_consume_macros/src/parse_children.rs (renamed from dhall_proc_macros/src/parse_children.rs)0
4 files changed, 46 insertions, 0 deletions
diff --git a/pest_consume_macros/Cargo.toml b/pest_consume_macros/Cargo.toml
new file mode 100644
index 0000000..dd65d95
--- /dev/null
+++ b/pest_consume_macros/Cargo.toml
@@ -0,0 +1,18 @@
+[package]
+name = "pest_consume_macros"
+version = "0.1.0" # remember to update html_root_url
+authors = ["Nadrieril <nadrieril@users.noreply.github.com>"]
+license = "MIT OR Apache-2.0"
+edition = "2018"
+description = "Macros for pest_consume"
+readme = "README.md"
+repository = "https://github.com/Nadrieril/dhall-rust"
+
+[lib]
+proc-macro = true
+doctest = false
+
+[dependencies]
+quote = "1.0.2"
+proc-macro2 = "1.0.2"
+syn = { version = "1.0.5", features = ["full", "extra-traits"] }
diff --git a/pest_consume_macros/src/lib.rs b/pest_consume_macros/src/lib.rs
new file mode 100644
index 0000000..dd437f6
--- /dev/null
+++ b/pest_consume_macros/src/lib.rs
@@ -0,0 +1,28 @@
+#![feature(drain_filter)]
+//! This crate contains the code-generation primitives for the [dhall-rust][dhall-rust] crate.
+//! This is highly unstable and breaks regularly; use at your own risk.
+//!
+//! [dhall-rust]: https://github.com/Nadrieril/dhall-rust
+
+extern crate proc_macro;
+
+mod make_parser;
+mod parse_children;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn make_parser(attrs: TokenStream, input: TokenStream) -> TokenStream {
+ TokenStream::from(match make_parser::make_parser(attrs, input) {
+ Ok(tokens) => tokens,
+ Err(err) => err.to_compile_error(),
+ })
+}
+
+#[proc_macro]
+pub fn parse_children(input: TokenStream) -> TokenStream {
+ TokenStream::from(match parse_children::parse_children(input) {
+ Ok(tokens) => tokens,
+ Err(err) => err.to_compile_error(),
+ })
+}
diff --git a/dhall_proc_macros/src/make_parser.rs b/pest_consume_macros/src/make_parser.rs
index c0594a5..c0594a5 100644
--- a/dhall_proc_macros/src/make_parser.rs
+++ b/pest_consume_macros/src/make_parser.rs
diff --git a/dhall_proc_macros/src/parse_children.rs b/pest_consume_macros/src/parse_children.rs
index d6474a7..d6474a7 100644
--- a/dhall_proc_macros/src/parse_children.rs
+++ b/pest_consume_macros/src/parse_children.rs