From 2431e767a09894c2f685911ba7f1ba0b7de2a165 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 13 Jul 2021 02:41:45 -0400 Subject: Improved the XML parsing library. --- stdlib/source/program/aedifex/metadata/artifact.lux | 18 ++++++------------ stdlib/source/program/aedifex/metadata/snapshot.lux | 11 +++-------- 2 files changed, 9 insertions(+), 20 deletions(-) (limited to 'stdlib/source/program/aedifex/metadata') diff --git a/stdlib/source/program/aedifex/metadata/artifact.lux b/stdlib/source/program/aedifex/metadata/artifact.lux index 7150efbab..50f228e50 100644 --- a/stdlib/source/program/aedifex/metadata/artifact.lux +++ b/stdlib/source/program/aedifex/metadata/artifact.lux @@ -105,15 +105,10 @@ (list (..format_versions (get@ #versions value)) (..format_last_updated (get@ #last_updated value))))))) -(def: (sub tag parser) - (All [a] (-> xml.Tag (Parser a) (Parser a))) - (do <>.monad - [_ (.node tag)] - (.children parser))) - (def: (text tag) (-> xml.Tag (Parser Text)) - (..sub tag .text)) + (<| (.node tag) + .text)) (def: date_parser (.Parser Date) @@ -147,18 +142,17 @@ (def: #export parser (Parser Metadata) - (<| (..sub ..) + (<| (.node ..) ($_ <>.and (.somewhere (..text ..)) (.somewhere (..text ..)) - (<| (..sub ..) + (<| (.node ..) ($_ <>.and (<| .somewhere - (..sub ..) + (.node ..) (<>.many (..text ..))) (.somewhere ..last_updated_parser) - )) - ))) + ))))) (def: #export equivalence (Equivalence Metadata) diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux index 518e0404a..41a0d9986 100644 --- a/stdlib/source/program/aedifex/metadata/snapshot.lux +++ b/stdlib/source/program/aedifex/metadata/snapshot.lux @@ -77,19 +77,14 @@ (..format_version version) (///artifact/versioning.format versioning))))) -(def: (sub tag parser) - (All [a] (-> xml.Tag (Parser a) (Parser a))) - (do <>.monad - [_ (.node tag)] - (.children parser))) - (def: (text tag) (-> xml.Tag (Parser Text)) - (..sub tag .text)) + (<| (.node tag) + .text)) (def: #export parser (Parser Metadata) - (<| (..sub ..) + (<| (.node ..) (do {! <>.monad} [group (.somewhere (..text ..)) name (.somewhere (..text ..)) -- cgit v1.2.3