summary refs log tree commit diff stats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2022-10-04 22:44:46 -0300
committerSoniEx2 <endermoneymod@gmail.com>2022-10-04 22:44:46 -0300
commitf0e944696144016ca59aaed02381f7ea9d1ef848 (patch)
treed9c3232b920e3cd2358c3d91ee5ec5d26cec26a1 /src/lib.rs
parent83d575f8a143ba031f1aa43995f6809470b8b15c (diff)
Initial VM work
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index f71d81c..bda97f4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -84,13 +84,13 @@
 //! Datafu Expressions follow the given syntax, in (pseudo-)extended BNF:
 //!
 //! ```text
-//! expression ::= {arrow tag} {subvalue}
-//! tag ::= identifier [arg] {predicate} | arg {predicate}
+//! expression ::= [type] [predicate] {arrow tag} {subvalue}
+//! tag ::= identifier [arg] [predicate] | arg [predicate]
 //! arg ::= parameter | literal | regex | keymatch
 //!
 //! arrow ::= '->'
-//! keymatch ::= '[' {tag} {predicate} expression ']'
-//! subvalue ::= '(' {predicate} expression ')' ['?']
+//! keymatch ::= '[' [name] expression ']'
+//! subvalue ::= '(' expression ')' ['?']
 //! ```
 //!
 //! For a description of the terminals "parameter", "literal", "regex" and
@@ -101,15 +101,16 @@
 //! <!-- TODO -->
 
 pub mod errors;
-pub mod type_tree;
+//pub mod type_tree;
 mod parser;
 mod pattern;
 mod vm;
 
 pub use pattern::Pattern;
+pub use pattern::PatternBuilder;
 
 /// A predicate.
-pub type Predicate = dyn (Fn(
+type Predicate = dyn (Fn(
     &mut dyn erased_serde::Deserializer<'_>
 ) -> bool) + Send + Sync;
 
@@ -133,7 +134,7 @@ pub type Predicate = dyn (Fn(
 ///
 /// let x = datafu::pred(|v| String::deserialize(v).is_ok());
 /// ```
-pub fn pred<F>(f: F) -> Box<Predicate>
+fn pred<F>(f: F) -> Box<Predicate>
 where
     F: (Fn(
         &mut dyn erased_serde::Deserializer<'_>