summary refs log tree commit diff stats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index bda97f4..6d8a7e0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,6 +14,8 @@
 //!
 //! ## Syntax Elements of Datafu Expressions
 //!
+//! FIXME still need to update these...
+//!
 //! An arrow is `->` and indicates indexing/iteration. Whether indexing or
 //! iteration is used is defined by the elements that follow, with iteration
 //! being used by default.
@@ -89,7 +91,7 @@
 //! arg ::= parameter | literal | regex | keymatch
 //!
 //! arrow ::= '->'
-//! keymatch ::= '[' [name] expression ']'
+//! keymatch ::= '[' [name] expression ']' ['?']
 //! subvalue ::= '(' expression ')' ['?']
 //! ```
 //!
@@ -98,7 +100,27 @@
 //!
 //! # Examples
 //!
-//! <!-- TODO -->
+//! The Datafu pattern
+//!
+//! ```datafu
+//! :map
+//! ->['a'?]:map
+//!   ->[b:?str]:?map
+//!     (->['x'?]x:?bool)
+//!     (->['y'?]y:?bool)?
+//! ```
+//!
+//! When matched against the JSON
+//!
+//! ```json
+//! {"a": {"1": {"y": true}, "2": {"x": true, "y": true}}}
+//! ```
+//!
+//! Produces the results for the sub-JSON
+//!
+//! ```json
+//! {"a": {"2": {"x": true, "y": true}}}
+//! ```
 
 pub mod errors;
 //pub mod type_tree;