diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/data/format/tar.lux | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux index 6e5293f67..7a6e9af55 100644 --- a/stdlib/source/library/lux/data/format/tar.lux +++ b/stdlib/source/library/lux/data/format/tar.lux @@ -97,10 +97,10 @@ (let [suffix <suffix> padded_size (n.+ (text.size suffix) <size>)] (|>> representation - (at n.octal encoded) + (of n.octal encoded) (..octal_padding <size>) (text.suffix suffix) - (at utf8.codec encoded) + (of utf8.codec encoded) (!binary.segment padded_size)))) (def <coercion> @@ -143,25 +143,25 @@ (Parser Small) (do <>.monad [digits (?binary.segment ..small_size) - digits (<>.of_try (at utf8.codec decoded digits)) + digits (<>.of_try (of utf8.codec decoded digits)) _ ..small_suffix] (<>.of_try (do [! try.monad] - [value (at n.octal decoded digits)] + [value (of n.octal decoded digits)] (..small value))))) (def big_parser (Parser Big) (do <>.monad [digits (?binary.segment ..big_size) - digits (<>.of_try (at utf8.codec decoded digits)) + digits (<>.of_try (of utf8.codec decoded digits)) end ?binary.bits_8 _ (let [expected (`` (char (,, (static ..blank))))] (<>.assertion (exception.error ..wrong_character [expected end]) (n.= expected end)))] (<>.of_try (do [! try.monad] - [value (at n.octal decoded digits)] + [value (of n.octal decoded digits)] (..big value))))) (nominal.def Checksum @@ -185,7 +185,7 @@ (def checksum_checksum (|> ..dummy_checksum representation - (at utf8.codec encoded) + (of utf8.codec encoded) ..checksum)) (def checksum_code @@ -193,7 +193,7 @@ (|>> ..checksum ..as_small ..from_small - (at n.octal encoded) + (of n.octal encoded) (..octal_padding ..small_size) (text.suffix ..checksum_suffix) abstraction)) @@ -203,17 +203,17 @@ (let [padded_size (n.+ (text.size ..checksum_suffix) ..small_size)] (|>> representation - (at utf8.codec encoded) + (of utf8.codec encoded) (!binary.segment padded_size)))) (def checksum_parser (Parser [Nat Checksum]) (do <>.monad [ascii (?binary.segment ..small_size) - digits (<>.of_try (at utf8.codec decoded ascii)) + digits (<>.of_try (of utf8.codec decoded ascii)) _ ..small_suffix value (<>.of_try - (at n.octal decoded digits))] + (of n.octal decoded digits))] (in [value (abstraction (%.format digits ..checksum_suffix))]))) ) @@ -224,7 +224,7 @@ (def ascii? (-> Text Bit) - (|>> (at utf8.codec encoded) + (|>> (of utf8.codec encoded) (binary.mix (function (_ char verdict) (.and verdict (n.<= ..last_ascii char))) @@ -247,7 +247,7 @@ size (loop (again [end (-- size)]) (when end - 0 (at utf8.codec encoded "") + 0 (of utf8.codec encoded "") _ (let [last_char (binary!.bits_8 end string)] (`` (when (.nat last_char) (char (,, (static ..null))) @@ -271,7 +271,7 @@ (-> <representation> (Try <type>)) (if (..ascii? value) (if (|> value - (at utf8.codec encoded) + (of utf8.codec encoded) binary!.size (n.> <size>)) (exception.except <exception> [value]) @@ -288,7 +288,7 @@ padded_size (n.+ (text.size suffix) <size>)] (|>> representation (text.suffix suffix) - (at utf8.codec encoded) + (of utf8.codec encoded) (!binary.segment padded_size)))) (def <parser> @@ -301,7 +301,7 @@ (n.= expected end))] (<>.of_try (do [! try.monad] - [text (at utf8.codec decoded (..un_padded string))] + [text (of utf8.codec decoded (..un_padded string))] (<in> text))))) (def .public <none> @@ -330,7 +330,7 @@ (let [padded_size (n.+ (text.size ..null) ..magic_size)] (|>> representation - (at utf8.codec encoded) + (of utf8.codec encoded) (!binary.segment padded_size)))) (def magic_parser @@ -342,8 +342,8 @@ _ (<>.assertion (exception.error ..wrong_character [expected end]) (n.= expected end))] (<>.of_try - (at try.monad each (|>> abstraction) - (at utf8.codec decoded string))))) + (of try.monad each (|>> abstraction) + (of utf8.codec decoded string))))) ) (def block_size Size 512) @@ -524,7 +524,7 @@ (def mode_parser (Parser Mode) (do [! <>.monad] - [value (at ! each ..from_small ..small_parser)] + [value (of ! each ..from_small ..small_parser)] (if (n.> (representation ..maximum_mode) value) (<>.of_try @@ -810,7 +810,7 @@ (-> Checksum Binary Nat) (let [|checksum| (|> checksum ..from_checksum - (at utf8.codec encoded) + (of utf8.codec encoded) ..checksum)] (|> (..checksum header) (n.- |checksum|) @@ -882,7 +882,7 @@ (do [! <>.monad] [header ..header_parser] (cond (same? ..contiguous (the #link_flag header)) - (at ! each (|>> {..#Contiguous}) (..file_parser header)) + (of ! each (|>> {..#Contiguous}) (..file_parser header)) (same? ..symbolic_link (the #link_flag header)) (in {..#Symbolic_Link (the #link_name header)}) @@ -892,7 +892,7 @@ ... (or (same? ..normal (the #link_flag header)) ... (same? ..old_normal (the #link_flag header))) - (at ! each (|>> {..#Normal}) (..file_parser header))))) + (of ! each (|>> {..#Normal}) (..file_parser header))))) ... It's safe to implement the parser this way because the range of values for Nat is 2^64 ... Whereas the maximum possible value for the checksum of a 512 block is (256 × 512) = 131,072 @@ -919,7 +919,7 @@ (def .public parser (Parser Tar) (|> (<>.some ..entry_parser) - (at <>.monad each sequence.of_list) + (of <>.monad each sequence.of_list) (<>.before ..end_of_archive_parser))) (def .public codec |