From 68b1dd82f23d6648ac3d9075a8f84b0174392945 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 17 Dec 2020 22:03:54 -0400 Subject: More optimizations to the Lux syntax parser. --- stdlib/source/program/aedifex/metadata/artifact.lux | 17 ++++++++++++----- stdlib/source/program/aedifex/metadata/snapshot.lux | 12 ++++++------ 2 files changed, 18 insertions(+), 11 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 1f8068111..aa7b9abce 100644 --- a/stdlib/source/program/aedifex/metadata/artifact.lux +++ b/stdlib/source/program/aedifex/metadata/artifact.lux @@ -61,6 +61,7 @@ [ "groupId"] [ "artifactId"] [ "version"] + [ "versioning"] [ "versions"] [ "lastUpdated"] [ "metadata"] @@ -87,8 +88,10 @@ xml.attributes (list (..write-group (get@ #group value)) (..write-name (get@ #name value)) - (..write-versions (get@ #versions value)) - (..write-last-updated (get@ #last-updated value))))) + (#xml.Node .. + xml.attributes + (list (..write-versions (get@ #versions value)) + (..write-last-updated (get@ #last-updated value))))))) (def: (sub tag parser) (All [a] (-> xml.Tag (Parser a) (Parser a))) @@ -136,9 +139,13 @@ ($_ <>.and (.somewhere (..text ..)) (.somewhere (..text ..)) - (.somewhere (<| (..sub ..) - (<>.many (..text ..)))) - (.somewhere ..last-updated-parser) + (<| (..sub ..) + ($_ <>.and + (<| .somewhere + (..sub ..) + (<>.many (..text ..))) + (.somewhere ..last-updated-parser) + )) ))) (def: #export equivalence diff --git a/stdlib/source/program/aedifex/metadata/snapshot.lux b/stdlib/source/program/aedifex/metadata/snapshot.lux index a94ac33c4..1919d06ca 100644 --- a/stdlib/source/program/aedifex/metadata/snapshot.lux +++ b/stdlib/source/program/aedifex/metadata/snapshot.lux @@ -212,7 +212,7 @@ (Parser Build) (.embed (<>.codec n.decimal (.many .decimal)) - (..text ..))) + (..text ..))) (exception: #export (time-stamp-mismatch {expected Time-Stamp} {actual Text}) (exception.report @@ -226,7 +226,7 @@ (def: (snapshot-parser expected) (-> Value (Parser Type)) - (<| (..sub ..) + (<| (..sub ..) (do <>.monad [#let [[version time-stamp build] expected] updated (.somewhere (..text ..)) @@ -243,8 +243,8 @@ (do <>.monad [[time-stamp build] (<| .somewhere (..sub ..) - (<>.and ..time-stamp-parser - ..build-parser)) + (<>.and (.somewhere ..time-stamp-parser) + (.somewhere ..build-parser))) last-updated (.somewhere ..last-updated-parser) _ (<>.assert (exception.construct ..time-stamp-mismatch [time-stamp (instant-format last-updated)]) (\ instant.equivalence = time-stamp last-updated)) @@ -268,7 +268,7 @@ #version version #versioning versioning})))) -(def: versioning +(def: versioning-equivalence (Equivalence Versioning) ($_ product.equivalence instant.equivalence @@ -282,5 +282,5 @@ text.equivalence text.equivalence text.equivalence - ..versioning + ..versioning-equivalence )) -- cgit v1.2.3