diff options
author | Eduardo Julian | 2021-07-29 19:23:23 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-07-29 19:23:23 -0400 |
commit | 54b28c1caeda08965c258411a32229be1766d47f (patch) | |
tree | ee0eecd3a009f80e716f2c3c07095bc80d3b70bb /stdlib/source/library/lux/control/parser | |
parent | 5d4583aebd00adced10275b32ff1a93ab418be50 (diff) |
Switched from the "from to" convention to the "minimum additional" convention.
Diffstat (limited to 'stdlib/source/library/lux/control/parser')
-rw-r--r-- | stdlib/source/library/lux/control/parser/text.lux | 20 | ||||
-rw-r--r-- | stdlib/source/library/lux/control/parser/tree.lux | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux index aa4858f66..ce3aacdaf 100644 --- a/stdlib/source/library/lux/control/parser/text.lux +++ b/stdlib/source/library/lux/control/parser/text.lux @@ -322,7 +322,9 @@ [(def: #export (<name> amount parser) {#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " N characters (as a slice)."))} (-> Nat (Parser Text) (Parser Text)) - (|> parser (<base> amount) (\ //.monad map /.concat)))] + (|> parser + (<base> amount) + (\ //.monad map /.concat)))] [exactly //.exactly "exactly"] [at_most //.at_most "at most"] @@ -333,22 +335,24 @@ [(def: #export (<name> amount parser) {#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " N characters (as a slice)."))} (-> Nat (Parser Slice) (Parser Slice)) - (with_slices (<base> amount parser)))] + (with_slices + (<base> amount parser)))] [exactly! //.exactly "exactly"] [at_most! //.at_most "at most"] [at_least! //.at_least "at least"] ) -(def: #export (between from to parser) - {#.doc "Yields between N and M characters."} +(def: #export (between minimum additional parser) (-> Nat Nat (Parser Text) (Parser Text)) - (|> parser (//.between from to) (\ //.monad map /.concat))) + (|> parser + (//.between minimum additional) + (\ //.monad map /.concat))) -(def: #export (between! from to parser) - {#.doc "Yields between N and M characters (as a slice)."} +(def: #export (between! minimum additional parser) (-> Nat Nat (Parser Slice) (Parser Slice)) - (with_slices (//.between from to parser))) + (with_slices + (//.between minimum additional parser))) (def: #export (enclosed [start end] parser) (All [a] (-> [Text Text] (Parser a) (Parser a))) diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux index 11673474c..ad2015624 100644 --- a/stdlib/source/library/lux/control/parser/tree.lux +++ b/stdlib/source/library/lux/control/parser/tree.lux @@ -26,7 +26,7 @@ (def: #export (run parser tree) {#.doc (doc "Applies the parser against a tree.")} (All [t a] (-> (Parser t a) (Tree t) (Try a))) - (run' parser (zipper.zip tree))) + (run' parser (zipper.zipper tree))) (def: #export value {#.doc (doc "Yields the value inside the current tree node.")} |