From ddcfead3ebf30fd8fef26f495662ef61e652ba4f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 6 Sep 2021 02:17:41 -0400 Subject: Applied new convention for variants. --- .../source/library/lux/control/parser/binary.lux | 10 ---------- stdlib/source/library/lux/data/format/binary.lux | 23 ---------------------- .../library/lux/tool/compiler/language/lux.lux | 22 +++++++++++---------- 3 files changed, 12 insertions(+), 43 deletions(-) (limited to 'stdlib') diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux index 1491e0cea..846f952d3 100644 --- a/stdlib/source/library/lux/control/parser/binary.lux +++ b/stdlib/source/library/lux/control/parser/binary.lux @@ -123,16 +123,6 @@ (!variant [[0 [#.Left] left] [1 [#.Right] right]])) -(def: .public (or/5 p/0 p/1 p/2 p/3 p/4) - (All (_ p/0 p/1 p/2 p/3 p/4) - (-> (Parser p/0) (Parser p/1) (Parser p/2) (Parser p/3) (Parser p/4) - (Parser (Or p/0 p/1 p/2 p/3 p/4)))) - (!variant [[0 [0 #0] p/0] - [1 [1 #0] p/1] - [2 [2 #0] p/2] - [3 [3 #0] p/3] - [4 [3 #1] p/4]])) - (def: .public (rec body) (All (_ a) (-> (-> (Parser a) (Parser a)) (Parser a))) (function (_ input) diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index e57bbf11c..71aeb6fc6 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -98,29 +98,6 @@ [1 #.Right right]) ))) -(def: .public (or/5 w/0 w/1 w/2 w/3 w/4) - (All (_ w/0 w/1 w/2 w/3 w/4) - (-> (Writer w/0) (Writer w/1) (Writer w/2) (Writer w/3) (Writer w/4) - (Writer (Or w/0 w/1 w/2 w/3 w/4)))) - (function (_ altV) - (case altV - (^template [ ] - [( caseV) - (let [[caseS caseT] ( caseV)] - [(.++ caseS) - (function (_ [offset binary]) - (|> binary - (binary.write/8! offset ) - try.trusted - [(.++ offset)] - caseT))])]) - ([0 0 #0 w/0] - [1 1 #0 w/1] - [2 2 #0 w/2] - [3 3 #0 w/3] - [4 3 #1 w/4]) - ))) - (def: .public (and pre post) (All (_ a b) (-> (Writer a) (Writer b) (Writer [a b]))) (function (_ [preV postV]) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux index 30465ca7d..8d0ac3171 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux @@ -36,11 +36,12 @@ alias (: (Writer Alias) (_.and _.text _.text)) global (: (Writer Global) - (_.or/5 definition - global_type - global_label - global_label - alias))] + ($_ _.or + definition + global_type + global_label + global_label + alias))] ($_ _.and ... #module_hash _.nat @@ -71,11 +72,12 @@ alias (: (Parser Alias) (<>.and .text .text)) global (: (Parser Global) - (.or/5 definition - global_type - global_label - global_label - alias))] + ($_ .or + definition + global_type + global_label + global_label + alias))] ($_ <>.and ... #module_hash .nat -- cgit v1.2.3