From 0594525aea5a62355838116a1408f7ce7a7ba0b4 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 10 May 2018 20:16:56 -0400 Subject: - Adjusted new-luxc to latest changes. --- new-luxc/source/luxc/cache.lux | 2 +- new-luxc/source/luxc/cache/description.lux | 9 +++---- new-luxc/source/luxc/cache/influences.lux | 2 +- new-luxc/source/luxc/cache/io.lux | 5 ++-- new-luxc/source/luxc/lang/translation.lux | 4 +-- .../luxc/lang/translation/jvm/imports.jvm.lux | 2 +- new-luxc/source/luxc/repl.lux | 30 ++++++++++----------- new-luxc/source/program.lux | 31 +++++++++++----------- .../test/test/luxc/lang/translation/common.lux | 4 +-- 9 files changed, 43 insertions(+), 46 deletions(-) (limited to 'new-luxc') diff --git a/new-luxc/source/luxc/cache.lux b/new-luxc/source/luxc/cache.lux index 2b47c12dc..8be91fb35 100644 --- a/new-luxc/source/luxc/cache.lux +++ b/new-luxc/source/luxc/cache.lux @@ -1,7 +1,7 @@ (.module: lux (lux (data [text] - (coll [dict #+ Dict])))) + (coll (dictionary ["dict" unordered #+ Dict]))))) (type: #export Cache (Dict Text Module)) (def: #export empty Cache (dict.new text.Hash)) diff --git a/new-luxc/source/luxc/cache/description.lux b/new-luxc/source/luxc/cache/description.lux index 467fed765..9ee07c7ad 100644 --- a/new-luxc/source/luxc/cache/description.lux +++ b/new-luxc/source/luxc/cache/description.lux @@ -12,8 +12,9 @@ ["s" syntax #+ Syntax])) [///lang]) -(exception: #export (Invalid-Lux-Version {message Text}) - message) +(exception: #export (invalid-lux-version {version Text}) + (format "Expected: " ///lang.version "\n" + " Actual: " version "\n")) (def: (write-type type) (-> Type Code) @@ -121,9 +122,7 @@ (<| (s.run (list description)) (s.record (do p.Monad [lux-version (p.after (s.this (` "lux version")) s.text) - _ (p.assert (Invalid-Lux-Version - (format "Expected: " ///lang.version "\n" - " Actual: " lux-version "\n")) + _ (p.assert (ex.construct invalid-lux-version lux-version) (text/= ///lang.version lux-version))] ($_ p.seq (p.after (s.this (` "lux file")) s.text) diff --git a/new-luxc/source/luxc/cache/influences.lux b/new-luxc/source/luxc/cache/influences.lux index a75e1a7a1..bbddd79aa 100644 --- a/new-luxc/source/luxc/cache/influences.lux +++ b/new-luxc/source/luxc/cache/influences.lux @@ -2,7 +2,7 @@ lux (lux (data [text] (coll [list "list/" Fold] - [dict #+ Dict])))) + (dictionary ["dict" unordered #+ Dict]))))) (type: #export Influences (Dict Text (List Text))) diff --git a/new-luxc/source/luxc/cache/io.lux b/new-luxc/source/luxc/cache/io.lux index 62585c0bc..998c658ac 100644 --- a/new-luxc/source/luxc/cache/io.lux +++ b/new-luxc/source/luxc/cache/io.lux @@ -9,8 +9,8 @@ [text "text/" Hash] text/format (coll [list "list/" Fold] - [dict #+ Dict] - [set #+ Set])) + (dictionary ["dict" unordered #+ Dict]) + (set ["set" unordered #+ Set]))) (lang [syntax #+ Aliases]) [io #+ Process "process/" Monad] (concurrency [atom #+ Atom atom]) @@ -25,7 +25,6 @@ [(exception: #export ( {message Text}) message)] - [Invalid-Lux-Version] [Module-Is-Not-Cached] [Cannot-Pre-Load-Cache-More-Than-Once] [Cannot-Delete-Cached-File] diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux index 4cab6d682..99328a45f 100644 --- a/new-luxc/source/luxc/lang/translation.lux +++ b/new-luxc/source/luxc/lang/translation.lux @@ -9,7 +9,7 @@ [text "text/" Hash] text/format (coll [list "list/" Functor] - [dict])) + (dictionary ["dict" unordered]))) [macro] (lang [syntax #+ Aliases] (type ["tc" check])) @@ -135,7 +135,7 @@ (function (_ compiler) (case (action compiler) (#e.Error error) - (if (ex.match? syntax.End-Of-File error) + (if (ex.match? syntax.end-of-file error) (#e.Success [compiler []]) (#e.Error error)) diff --git a/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux index de75a4d75..61061c3af 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/imports.jvm.lux @@ -12,7 +12,7 @@ [text "text/" Eq] text/format (coll [list "list/" Functor Fold] - [dict #+ Dict])) + (dictionary ["dict" unordered #+ Dict]))) [macro] (macro [code] ["s" syntax]) diff --git a/new-luxc/source/luxc/repl.lux b/new-luxc/source/luxc/repl.lux index fbf1a336e..0ce7fb898 100644 --- a/new-luxc/source/luxc/repl.lux +++ b/new-luxc/source/luxc/repl.lux @@ -12,7 +12,7 @@ [json #+ JSON]) (coll [array] [list "list/" Functor] - [dict])) + (dictionary ["dict" unordered]))) (time [instant #+ Instant] [duration #+ Duration] [date #+ Date]) @@ -46,8 +46,8 @@ [(exception: #export ( {message Text}) message)] - [REPL-Initialization-Failed] - [REPL-Error] + [repl-initialization-failed] + [repl-error] ) (def: repl-module "") @@ -85,7 +85,7 @@ (wrap compiler)) (#e.Error message) - (task.throw REPL-Initialization-Failed message)))) + (task.throw repl-initialization-failed message)))) (def: (add-line line [where offset input]) (-> Text Source Source) @@ -102,20 +102,20 @@ (Poly Representation) (`` ($_ p.either (do p.Monad - [_ poly.unit] + [_ (poly.this Top)] (wrap (const "[]"))) - (~~ (do-template [ ] + (~~ (do-template [ ] [(do p.Monad - [_ ] + [_ (poly.this )] (wrap (|>> (:! ) )))] - [poly.bool Bool %b] - [poly.nat Nat %n] - [poly.int Int %i] - [poly.deg Deg %d] - [poly.frac Frac %f] - [poly.text Text %t]))))) + [Bool %b] + [Nat %n] + [Int %i] + [Deg %d] + [Frac %f] + [Text %t]))))) (def: (special-representation representation) (-> (Poly Representation) (Poly Representation)) @@ -324,8 +324,8 @@ (recur compiler' source' false)) (#e.Error error) - (if (ex.match? syntax.End-Of-File error) + (if (ex.match? syntax.end-of-file error) (recur compiler source true) - (exec (log! (REPL-Error error)) + (exec (log! (ex.construct repl-error error)) (recur compiler fresh-source false)))))) ))) diff --git a/new-luxc/source/program.lux b/new-luxc/source/program.lux index 5e60c318a..bc5f65e5d 100644 --- a/new-luxc/source/program.lux +++ b/new-luxc/source/program.lux @@ -63,20 +63,19 @@ (#e.Success output) (wrap output)))) -(program: ([service ..service]) - (exec - (case service - (#Build [sources target program]) - (<| (or-crash! "Compilation failed:") - (promise.future - (do io.Monad - [#let [start (io.run instant.now)] - result (translationL.translate-program sources target program) - #let [end (io.run instant.now) - _ (log! (format "\n" "Elapsed time: " (%duration (instant.span start end))))]] - (wrap result)))) - - (#REPL [sources target]) - (<| (or-crash! "REPL failed:") - (repl.run sources target))) +(program: [{service ..service}] + (exec (case service + (#Build [sources target program]) + (<| (or-crash! "Compilation failed:") + (promise.future + (do io.Monad + [#let [start (io.run instant.now)] + result (translationL.translate-program sources target program) + #let [end (io.run instant.now) + _ (log! (format "\n" "Elapsed time: " (%duration (instant.span start end))))]] + (wrap result)))) + + (#REPL [sources target]) + (<| (or-crash! "REPL failed:") + (repl.run sources target))) (io []))) diff --git a/new-luxc/test/test/luxc/lang/translation/common.lux b/new-luxc/test/test/luxc/lang/translation/common.lux index cfc96fbcf..05a1d069f 100644 --- a/new-luxc/test/test/luxc/lang/translation/common.lux +++ b/new-luxc/test/test/luxc/lang/translation/common.lux @@ -319,8 +319,8 @@ (~ sample0S) (~ (code.nat char-idx))))) (case> (^multi (#e.Success valueV) - [(:! (Maybe Nat) valueV) (#.Some valueV)]) - (text.contains? ("lux nat char" valueV) + [(:! (Maybe Int) valueV) (#.Some valueV)]) + (text.contains? ("lux int char" valueV) sample0) _ -- cgit v1.2.3