diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2022-11-13 12:30:11 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2022-11-13 12:30:11 -0300 |
commit | 72397506c3529f4878b5a1cf8205599764ac4088 (patch) | |
tree | f8fe6ece751cff882a3e6f8331206726d3736eea /src/lib.rs | |
parent | 44a6ee680308a3d756ef7c17db2f64518bb2b493 (diff) |
Finish most "core" VM functionality
Still need to do lists
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 26 |
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; |