diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/control/parser/tree.lux | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/stdlib/source/lux/control/parser/tree.lux b/stdlib/source/lux/control/parser/tree.lux deleted file mode 100644 index ac824638a..000000000 --- a/stdlib/source/lux/control/parser/tree.lux +++ /dev/null @@ -1,59 +0,0 @@ -(.module: - [lux #* - [abstract - [monad (#+ do)]] - [control - ["." try (#+ Try)] - ["." exception (#+ exception:)]] - [data - [collection - [tree (#+ Tree) - ["." zipper (#+ Zipper)]]]]] - ["." //]) - -(type: #export (Parser t a) - (//.Parser (Zipper t) a)) - -(def: #export (run' parser zipper) - (All [t a] (-> (Parser t a) (Zipper t) (Try a))) - (do try.monad - [[zipper output] (//.run parser zipper)] - (wrap output))) - -(def: #export (run parser tree) - (All [t a] (-> (Parser t a) (Tree t) (Try a))) - (run' parser (zipper.zip tree))) - -(def: #export value - (All [t] (Parser t t)) - (function (_ zipper) - (#try.Success [zipper (zipper.value zipper)]))) - -(exception: #export cannot-move-further) - -(template [<name> <direction>] - [(def: #export <name> - (All [t] (Parser t [])) - (function (_ zipper) - (case (<direction> zipper) - #.None - (exception.throw ..cannot-move-further []) - - (#.Some next) - (#try.Success [next []]))))] - - [down zipper.down] - [up zipper.up] - - [right zipper.right] - [rightmost zipper.rightmost] - - [left zipper.left] - [leftmost zipper.leftmost] - - [next zipper.next] - [end zipper.end] - - [previous zipper.previous] - [start zipper.start] - ) |