diff options
Diffstat (limited to 'stdlib/source/library/lux/control/parser')
9 files changed, 37 insertions, 36 deletions
diff --git a/stdlib/source/library/lux/control/parser/analysis.lux b/stdlib/source/library/lux/control/parser/analysis.lux index 42bffc310..27caea2af 100644 --- a/stdlib/source/library/lux/control/parser/analysis.lux +++ b/stdlib/source/library/lux/control/parser/analysis.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Variant Tuple nat int rev local) + [lux (#- Tuple Variant nat int rev local) [abstract [monad (#+ do)]] [control @@ -36,7 +36,7 @@ (-> (List Analysis) Text) (format text.new_line "Remaining input: " (|> asts - (list\map /.%analysis) + (list\each /.%analysis) (text.interposed " ")))) (exception: .public (cannot_parse {input (List Analysis)}) diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index 4fd9d15f5..220dd5ea2 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -99,7 +99,7 @@ (def: .public frac (Parser Frac) - (//\map frac.of_bits ..bits/64)) + (//\each frac.of_bits ..bits/64)) (exception: .public (invalid_tag {range Nat} {byte Nat}) (exception.report @@ -112,7 +112,7 @@ ..bits/8)] (`` (case flag (^template [<number> <tag> <parser>] - [<number> (\ ! map (|>> <tag>) <parser>)]) + [<number> (\ ! each (|>> <tag>) <parser>)]) ((~~ (template.spliced <case>+))) _ (//.lifted (exception.except ..invalid_tag [(~~ (template.amount <case>+)) flag])))))]) @@ -153,13 +153,13 @@ 0 (#try.Success [[offset binary] (/.empty 0)]) _ (|> binary (/.slice offset size) - (\ try.monad map (|>> [[(n.+ size offset) binary]])))))) + (\ try.monad each (|>> [[(n.+ size offset) binary]])))))) (template [<size> <name> <bits>] [(`` (def: .public <name> (Parser Binary) (do //.monad - [size (//\map .nat <bits>)] + [size (//\each .nat <bits>)] (..segment size))))] [08 binary/8 ..bits/8] diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux index 1a3bbc5a7..9b83d835a 100644 --- a/stdlib/source/library/lux/control/parser/code.lux +++ b/stdlib/source/library/lux/control/parser/code.lux @@ -32,9 +32,9 @@ (def: remaining_inputs (-> (List Code) Text) - (|>> (list\map code.format) + (|>> (list\each code.format) (text.interposed " ") - ($_ text\compose text.new_line "Remaining input: "))) + ($_ text\composite text.new_line "Remaining input: "))) (def: .public any (Parser Code) @@ -47,7 +47,7 @@ (#try.Success [tokens' t])))) (template [<query> <check> <type> <tag> <eq> <desc>] - [(with_expansions [<failure> (as_is (#try.Failure ($_ text\compose "Cannot parse " <desc> (remaining_inputs tokens))))] + [(with_expansions [<failure> (as_is (#try.Failure ($_ text\composite "Cannot parse " <desc> (remaining_inputs tokens))))] (def: .public <query> (Parser <type>) (function (_ tokens) @@ -87,14 +87,14 @@ (#.Item [token tokens']) (if (code\= code token) (#try.Success [tokens' []]) - (#try.Failure ($_ text\compose "Expected a " (code.format code) " but instead got " (code.format token) + (#try.Failure ($_ text\composite "Expected a " (code.format code) " but instead got " (code.format token) (remaining_inputs tokens)))) _ (#try.Failure "There are no tokens to parse!")))) (template [<query> <check> <tag> <eq> <desc>] - [(with_expansions [<failure> (as_is (#try.Failure ($_ text\compose "Cannot parse " <desc> (remaining_inputs tokens))))] + [(with_expansions [<failure> (as_is (#try.Failure ($_ text\composite "Cannot parse " <desc> (remaining_inputs tokens))))] (def: .public <query> (Parser Text) (function (_ tokens) @@ -130,10 +130,10 @@ (#.Item [[_ (<tag> members)] tokens']) (case (p members) (#try.Success [#.End x]) (#try.Success [tokens' x]) - _ (#try.Failure ($_ text\compose "Parser was expected to fully consume " <desc> (remaining_inputs tokens)))) + _ (#try.Failure ($_ text\composite "Parser was expected to fully consume " <desc> (remaining_inputs tokens)))) _ - (#try.Failure ($_ text\compose "Cannot parse " <desc> (remaining_inputs tokens))))))] + (#try.Failure ($_ text\composite "Cannot parse " <desc> (remaining_inputs tokens))))))] [ form #.Form "form"] [tuple #.Tuple "tuple"] @@ -147,17 +147,17 @@ (#.Item [[_ (#.Record pairs)] tokens']) (case (p (un_paired pairs)) (#try.Success [#.End x]) (#try.Success [tokens' x]) - _ (#try.Failure ($_ text\compose "Parser was expected to fully consume record" (remaining_inputs tokens)))) + _ (#try.Failure ($_ text\composite "Parser was expected to fully consume record" (remaining_inputs tokens)))) _ - (#try.Failure ($_ text\compose "Cannot parse record" (remaining_inputs tokens)))))) + (#try.Failure ($_ text\composite "Cannot parse record" (remaining_inputs tokens)))))) (def: .public end! (Parser Any) (function (_ tokens) (case tokens #.End (#try.Success [tokens []]) - _ (#try.Failure ($_ text\compose "Expected list of tokens to be empty!" (remaining_inputs tokens)))))) + _ (#try.Failure ($_ text\composite "Expected list of tokens to be empty!" (remaining_inputs tokens)))))) (def: .public end? (Parser Bit) @@ -179,9 +179,9 @@ _ (#try.Failure (|> unconsumed - (list\map code.format) + (list\each code.format) (text.interposed ", ") - (text\compose "Unconsumed inputs: ")))))) + (text\composite "Unconsumed inputs: ")))))) (def: .public (local inputs parser) (All [a] (-> (List Code) (Parser a) (Parser a))) diff --git a/stdlib/source/library/lux/control/parser/environment.lux b/stdlib/source/library/lux/control/parser/environment.lux index f084a838d..fbb7335f5 100644 --- a/stdlib/source/library/lux/control/parser/environment.lux +++ b/stdlib/source/library/lux/control/parser/environment.lux @@ -41,4 +41,4 @@ (def: .public (result parser environment) (All [a] (-> (Parser a) Environment (Try a))) - (\ try.monad map product.right (parser environment))) + (\ try.monad each product.right (parser environment))) diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux index 1348b92b4..dcbda6f71 100644 --- a/stdlib/source/library/lux/control/parser/json.lux +++ b/stdlib/source/library/lux/control/parser/json.lux @@ -146,8 +146,8 @@ (#/.Object kvs) (case (|> kvs dictionary.entries - (list\map (function (_ [key value]) - (list (#/.String key) value))) + (list\each (function (_ [key value]) + (list (#/.String key) value))) list.together (//.result parser)) (#try.Failure error) @@ -195,4 +195,4 @@ (|>> (//.and ..string) //.some ..object - (//\map (dictionary.of_list text.hash)))) + (//\each (dictionary.of_list text.hash)))) diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux index df28b3df1..d6c6fbeca 100644 --- a/stdlib/source/library/lux/control/parser/synthesis.lux +++ b/stdlib/source/library/lux/control/parser/synthesis.lux @@ -1,6 +1,6 @@ (.module: [library - [lux (#- Variant Tuple function loop i64 local) + [lux (#- Tuple Variant function loop i64 local) [abstract [monad (#+ do)]] [control diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux index 0e9724a15..24a2f9e3c 100644 --- a/stdlib/source/library/lux/control/parser/text.lux +++ b/stdlib/source/library/lux/control/parser/text.lux @@ -31,8 +31,9 @@ (//.Parser [Offset Text])) (type: .public Slice - {#basis Offset - #distance Offset}) + (Record + {#basis Offset + #distance Offset})) (def: (remaining' offset tape) (-> Offset Text Text) @@ -161,7 +162,7 @@ (do //.monad [char any .let [char' (maybe.trusted (/.char 0 char))] - _ (//.assertion ($_ /\compose "Character is not within range: " (/.of_char bottom) "-" (/.of_char top)) + _ (//.assertion ($_ /\composite "Character is not within range: " (/.of_char bottom) "-" (/.of_char top)) (.and (n.>= bottom char') (n.<= top char')))] (in char))) @@ -265,7 +266,7 @@ (do //.monad [=left left =right right] - (in ($_ /\compose =left =right)))) + (in ($_ /\composite =left =right)))) (def: .public (and! left right) (-> (Parser Slice) (Parser Slice) (Parser Slice)) @@ -277,7 +278,7 @@ (template [<name> <base> <doc_modifier>] [(def: .public (<name> parser) (-> (Parser Text) (Parser Text)) - (|> parser <base> (\ //.monad map /.together)))] + (|> parser <base> (\ //.monad each /.together)))] [some //.some "some"] [many //.many "many"] @@ -297,7 +298,7 @@ (-> Nat (Parser Text) (Parser Text)) (|> parser (<base> amount) - (\ //.monad map /.together)))] + (\ //.monad each /.together)))] [exactly //.exactly "exactly"] [at_most //.at_most "at most"] @@ -319,7 +320,7 @@ (-> Nat Nat (Parser Text) (Parser Text)) (|> parser (//.between minimum additional) - (\ //.monad map /.together))) + (\ //.monad each /.together))) (def: .public (between! minimum additional parser) (-> Nat Nat (Parser Slice) (Parser Slice)) diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux index 0b726282a..d51ebc152 100644 --- a/stdlib/source/library/lux/control/parser/type.lux +++ b/stdlib/source/library/lux/control/parser/type.lux @@ -54,7 +54,7 @@ (exception: .public (unconsumed_input {remaining (List Type)}) (exception.report ["Types" (|> remaining - (list\map (|>> %.type (format text.new_line "* "))) + (list\each (|>> %.type (format text.new_line "* "))) (text.interposed ""))])) (type: .public Env @@ -132,7 +132,7 @@ (def: (label idx) (-> Nat Code) - (code.local_identifier ($_ text\compose "label" text.tab (n\encoded idx)))) + (code.local_identifier ($_ text\composite "label" text.tab (n\encoded idx)))) (def: .public (with_extension type poly) (All [a] (-> Type (Parser a) (Parser [Code a]))) @@ -175,7 +175,7 @@ (All [a] (-> (Parser a) (Parser [Code (List Code) a]))) (do {! //.monad} [headT any - funcI (\ ! map dictionary.size ..env) + funcI (\ ! each dictionary.size ..env) [num_args non_poly] (local (list headT) ..polymorphic') env ..env .let [funcL (label funcI) @@ -194,7 +194,7 @@ partial_varI (++ partialI) partial_varL (label partial_varI) partialC (` ((~ funcL) (~+ (|> (list.indices num_args) - (list\map (|>> (n.* 2) ++ (n.+ funcI) label)) + (list\each (|>> (n.* 2) ++ (n.+ funcI) label)) list.reversed))))] (recur (++ current_arg) (|> env' @@ -344,6 +344,6 @@ _ (local (list funcT) (..parameter! 0)) allC (let [allT (list& funcT argsT)] (|> allT - (monad.map ! (function.constant ..parameter)) + (monad.each ! (function.constant ..parameter)) (local allT)))] (in (` ((~+ allC)))))) diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux index 2e982ad45..6be4241d0 100644 --- a/stdlib/source/library/lux/control/parser/xml.lux +++ b/stdlib/source/library/lux/control/parser/xml.lux @@ -108,7 +108,7 @@ (if (name\= expected actual) (|> children (..result' parser attrs') - (try\map (|>> [[attrs tail]]))) + (try\each (|>> [[attrs tail]]))) (exception.except ..wrong_tag [expected actual])))))) (def: .public any |