diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/control/parser/cli.lux | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/stdlib/source/library/lux/control/parser/cli.lux b/stdlib/source/library/lux/control/parser/cli.lux index df59dbd44..b4051eb43 100644 --- a/stdlib/source/library/lux/control/parser/cli.lux +++ b/stdlib/source/library/lux/control/parser/cli.lux @@ -10,11 +10,11 @@ ["%" format (#+ format)]]]]] ["." //]) -(type: #export (Parser a) +(type: .public (Parser a) {#.doc "A command-line interface parser."} (//.Parser (List Text) a)) -(def: #export (run parser inputs) +(def: .public (run parser inputs) {#.doc (doc "Executes the parser and verifies that all inputs are processed.")} (All [a] (-> (Parser a) (List Text) (Try a))) (case (//.run parser inputs) @@ -29,7 +29,7 @@ (#try.Failure try) (#try.Failure try))) -(def: #export any +(def: .public any {#.doc "Just returns the next input without applying any logic."} (Parser Text) (function (_ inputs) @@ -40,7 +40,7 @@ _ (#try.Failure "Cannot parse empty arguments.")))) -(def: #export (parse parser) +(def: .public (parse parser) {#.doc "Parses the next input with a parsing function."} (All [a] (-> (-> Text (Try a)) (Parser a))) (function (_ inputs) @@ -49,7 +49,7 @@ output (parser raw)] (in [remaining output])))) -(def: #export (this reference) +(def: .public (this reference) {#.doc "Checks that a token is in the inputs."} (-> Text (Parser Any)) (function (_ inputs) @@ -59,7 +59,7 @@ (in [remaining []]) (#try.Failure (format "Missing token: '" reference "'")))))) -(def: #export (somewhere cli) +(def: .public (somewhere cli) {#.doc "Given a parser, tries to parse it somewhere in the inputs (i.e. not necessarily parsing the immediate inputs)."} (All [a] (-> (Parser a) (Parser a))) (function (_ inputs) @@ -79,7 +79,7 @@ (in [(#.Item to_omit remaining) output]))))))) -(def: #export end +(def: .public end {#.doc "Ensures there are no more inputs."} (Parser Any) (function (_ inputs) @@ -87,14 +87,14 @@ #.End (#try.Success [inputs []]) _ (#try.Failure (format "Unknown parameters: " (text.join_with " " inputs)))))) -(def: #export (named name value) +(def: .public (named name value) {#.doc (doc "Parses a named parameter and yields its value.")} (All [a] (-> Text (Parser a) (Parser a))) (|> value (//.after (..this name)) ..somewhere)) -(def: #export (parameter [short long] value) +(def: .public (parameter [short long] value) {#.doc (doc "Parses a parameter that can have either a short or a long name.")} (All [a] (-> [Text Text] (Parser a) (Parser a))) (|> value |