From 72b4eecdc514387ab3b1c105cfd49436c9eb1e8d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 25 Oct 2020 05:10:08 -0400 Subject: Some improvements to the Lux syntax parser. --- stdlib/source/program/aedifex.lux | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) (limited to 'stdlib/source/program/aedifex.lux') diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index 327eb8902..76db24a47 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -33,6 +33,7 @@ [action (#+ Action)] ["#" profile] ["#." project (#+ Project)] + ["#." input] ["#." parser] ["#." pom] ["#." cli] @@ -46,26 +47,6 @@ ["#/." auto] ["#/." deploy]]]) -(def: (read-file! path) - (-> Path (IO (Try Binary))) - (do (try.with io.monad) - [project-file (!.use (:: file.system file) [path])] - (!.use (:: project-file content) []))) - -(def: (read-code source-code) - (-> Text (Try Code)) - (let [parse (syntax.parse "" - syntax.no-aliases - (text.size source-code)) - start (: Source - [["" 0 0] 0 source-code])] - (case (parse start) - (#.Left [end error]) - (#try.Failure error) - - (#.Right [end lux-code]) - (#try.Success lux-code)))) - (def: (install! profile) (-> /.Profile (Promise Any)) (do promise.monad @@ -99,20 +80,10 @@ (log! (format "Could not resolve dependencies:" text.new-line error)))))) -(def: project - (-> Binary (Try Project)) - (|>> (do> try.monad - [encoding.from-utf8] - [..read-code] - [(list) (.run /parser.project)]))) - (program: [{[profile operation] /cli.command}] (do {@ io.monad} - [data (..read-file! /.file)] - (case (do try.monad - [data data - project (..project data)] - (/project.profile profile project)) + [?profile (/input.read io.monad file.system profile)] + (case ?profile (#try.Success profile) (case operation #/cli.POM -- cgit v1.2.3