From 3053fd79bc6ae42415298ee056a268dc2c9b690c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 26 Jun 2022 12:55:04 -0400 Subject: New "parser" hierarchy. [Part 4] --- stdlib/source/documentation/lux.lux | 4 +- .../documentation/lux/data/collection/array.lux | 3 - .../documentation/lux/data/collection/bits.lux | 3 - .../lux/data/collection/dictionary.lux | 3 - .../lux/data/collection/dictionary/ordered.lux | 3 - .../lux/data/collection/dictionary/plist.lux | 3 - .../documentation/lux/data/collection/list.lux | 3 - .../documentation/lux/data/collection/queue.lux | 3 - .../lux/data/collection/queue/priority.lux | 3 - .../documentation/lux/data/collection/sequence.lux | 3 - .../documentation/lux/data/collection/set.lux | 3 - .../lux/data/collection/set/multi.lux | 3 - .../lux/data/collection/set/ordered.lux | 3 - .../documentation/lux/data/collection/stack.lux | 3 - .../documentation/lux/data/collection/stream.lux | 3 - .../documentation/lux/data/collection/tree.lux | 3 - .../lux/data/collection/tree/finger.lux | 3 - .../lux/data/collection/tree/zipper.lux | 3 - stdlib/source/documentation/lux/data/color.lux | 8 +- .../source/documentation/lux/data/color/named.lux | 3 - stdlib/source/documentation/lux/extension.lux | 7 +- stdlib/source/documentation/lux/test.lux | 3 - stdlib/source/documentation/lux/time.lux | 3 - stdlib/source/documentation/lux/time/date.lux | 3 - stdlib/source/documentation/lux/time/day.lux | 3 - stdlib/source/documentation/lux/time/duration.lux | 3 - stdlib/source/documentation/lux/time/instant.lux | 3 - stdlib/source/documentation/lux/time/month.lux | 3 - stdlib/source/documentation/lux/time/year.lux | 3 - stdlib/source/documentation/lux/type.lux | 3 - stdlib/source/documentation/lux/type/check.lux | 3 - stdlib/source/documentation/lux/type/dynamic.lux | 3 - stdlib/source/documentation/lux/type/implicit.lux | 3 - stdlib/source/documentation/lux/type/poly.lux | 3 - stdlib/source/documentation/lux/type/primitive.lux | 3 - stdlib/source/documentation/lux/type/quotient.lux | 3 - .../source/documentation/lux/type/refinement.lux | 3 - stdlib/source/documentation/lux/type/resource.lux | 3 - stdlib/source/documentation/lux/type/unit.lux | 3 - stdlib/source/documentation/lux/type/variance.lux | 3 - stdlib/source/documentation/lux/world/console.lux | 3 - stdlib/source/documentation/lux/world/file.lux | 3 - .../source/documentation/lux/world/file/watch.lux | 3 - .../documentation/lux/world/input/keyboard.lux | 3 - .../documentation/lux/world/net/http/client.lux | 3 - .../documentation/lux/world/net/http/status.lux | 3 - .../lux/world/output/video/resolution.lux | 3 - stdlib/source/documentation/lux/world/program.lux | 3 - stdlib/source/documentation/lux/world/shell.lux | 3 - stdlib/source/format/lux/data/text.lux | 8 +- .../source/library/lux/abstract/monad/indexed.lux | 6 +- .../source/library/lux/control/concatenative.lux | 8 +- stdlib/source/library/lux/control/continuation.lux | 7 +- stdlib/source/library/lux/control/exception.lux | 8 +- .../library/lux/control/function/contract.lux | 7 +- .../source/library/lux/control/function/inline.lux | 6 +- .../source/library/lux/control/function/mutual.lux | 8 +- stdlib/source/library/lux/control/io.lux | 7 +- stdlib/source/library/lux/control/lazy.lux | 6 +- stdlib/source/library/lux/control/parser/code.lux | 226 ------------- stdlib/source/library/lux/control/parser/type.lux | 350 --------------------- stdlib/source/library/lux/control/pipe.lux | 8 +- stdlib/source/library/lux/control/remember.lux | 22 +- .../library/lux/control/security/capability.lux | 8 +- .../library/lux/data/collection/sequence.lux | 8 +- .../source/library/lux/data/collection/stream.lux | 6 +- stdlib/source/library/lux/data/collection/tree.lux | 6 +- .../source/library/lux/data/format/css/value.lux | 7 +- stdlib/source/library/lux/data/format/json.lux | 8 +- stdlib/source/library/lux/data/text/escape.lux | 8 +- stdlib/source/library/lux/data/text/regex.lux | 8 +- stdlib/source/library/lux/debug.lux | 14 +- stdlib/source/library/lux/documentation.lux | 10 +- stdlib/source/library/lux/extension.lux | 6 +- stdlib/source/library/lux/ffi.jvm.lux | 10 +- stdlib/source/library/lux/ffi.lux | 108 +++---- stdlib/source/library/lux/ffi.old.lux | 12 +- stdlib/source/library/lux/ffi.php.lux | 16 +- stdlib/source/library/lux/ffi.scm.lux | 12 +- stdlib/source/library/lux/ffi/export.js.lux | 6 +- stdlib/source/library/lux/ffi/export.jvm.lux | 6 +- stdlib/source/library/lux/ffi/export.lua.lux | 6 +- stdlib/source/library/lux/ffi/export.py.lux | 6 +- stdlib/source/library/lux/ffi/export.rb.lux | 6 +- stdlib/source/library/lux/macro/context.lux | 8 +- stdlib/source/library/lux/macro/local.lux | 10 +- stdlib/source/library/lux/macro/syntax.lux | 8 +- stdlib/source/library/lux/macro/syntax/check.lux | 6 +- .../library/lux/macro/syntax/declaration.lux | 6 +- .../source/library/lux/macro/syntax/definition.lux | 8 +- stdlib/source/library/lux/macro/syntax/export.lux | 7 +- stdlib/source/library/lux/macro/syntax/input.lux | 6 +- .../library/lux/macro/syntax/type/variable.lux | 6 +- stdlib/source/library/lux/macro/template.lux | 10 +- stdlib/source/library/lux/math.lux | 9 +- stdlib/source/library/lux/math/infix.lux | 6 +- stdlib/source/library/lux/math/modular.lux | 8 +- stdlib/source/library/lux/math/modulus.lux | 7 +- stdlib/source/library/lux/math/number/complex.lux | 9 +- stdlib/source/library/lux/math/number/ratio.lux | 8 +- stdlib/source/library/lux/meta/configuration.lux | 8 +- stdlib/source/library/lux/meta/version.lux | 8 +- stdlib/source/library/lux/program.lux | 4 +- stdlib/source/library/lux/static.lux | 6 +- stdlib/source/library/lux/target/jvm/modifier.lux | 8 +- stdlib/source/library/lux/target/lua.lux | 7 +- stdlib/source/library/lux/target/php.lux | 7 +- stdlib/source/library/lux/target/python.lux | 7 +- stdlib/source/library/lux/target/r.lux | 7 +- stdlib/source/library/lux/target/ruby.lux | 7 +- stdlib/source/library/lux/test.lux | 8 +- .../lux/tool/compiler/language/lux/analysis.lux | 8 +- .../lux/phase/extension/analysis/common_lisp.lux | 32 +- .../language/lux/phase/extension/analysis/js.lux | 6 +- .../language/lux/phase/extension/analysis/jvm.lux | 9 +- .../language/lux/phase/extension/analysis/lua.lux | 6 +- .../language/lux/phase/extension/analysis/lux.lux | 9 +- .../language/lux/phase/extension/analysis/php.lux | 28 +- .../lux/phase/extension/analysis/python.lux | 6 +- .../language/lux/phase/extension/analysis/r.lux | 6 +- .../language/lux/phase/extension/analysis/ruby.lux | 6 +- .../lux/phase/extension/analysis/scheme.lux | 20 +- .../language/lux/phase/extension/directive/jvm.lux | 9 +- .../language/lux/phase/extension/directive/lux.lux | 8 +- .../lux/phase/generation/common_lisp/runtime.lux | 8 +- .../language/lux/phase/generation/extension.lux | 8 +- .../language/lux/phase/generation/js/runtime.lux | 8 +- .../language/lux/phase/generation/lua/runtime.lux | 8 +- .../language/lux/phase/generation/php/runtime.lux | 8 +- .../lux/phase/generation/python/runtime.lux | 8 +- .../language/lux/phase/generation/r/runtime.lux | 8 +- .../language/lux/phase/generation/ruby/runtime.lux | 8 +- .../phase/generation/scheme/extension/common.lux | 8 +- .../lux/phase/generation/scheme/runtime.lux | 8 +- .../lux/tool/compiler/language/lux/syntax.lux | 9 +- stdlib/source/library/lux/type.lux | 8 +- stdlib/source/library/lux/type/dynamic.lux | 8 +- stdlib/source/library/lux/type/implicit.lux | 10 +- stdlib/source/library/lux/type/poly.lux | 14 +- stdlib/source/library/lux/type/primitive.lux | 6 +- stdlib/source/library/lux/type/quotient.lux | 7 +- stdlib/source/library/lux/type/refinement.lux | 7 +- stdlib/source/library/lux/type/resource.lux | 9 +- stdlib/source/library/lux/type/unit.lux | 7 +- stdlib/source/library/lux/type/unit/scale.lux | 8 +- .../source/library/lux/world/net/http/client.lux | 9 +- stdlib/source/parser/lux/macro/code.lux | 226 +++++++++++++ stdlib/source/parser/lux/type.lux | 350 +++++++++++++++++++++ .../source/polytypic/lux/abstract/equivalence.lux | 6 +- stdlib/source/polytypic/lux/abstract/functor.lux | 41 ++- stdlib/source/polytypic/lux/data/format/json.lux | 10 +- stdlib/source/program/aedifex/input.lux | 7 +- stdlib/source/program/aedifex/parser.lux | 8 +- stdlib/source/test/aedifex/parser.lux | 7 +- stdlib/source/test/lux.lux | 27 +- stdlib/source/test/lux/control/parser.lux | 13 +- stdlib/source/test/lux/control/parser/code.lux | 161 ---------- stdlib/source/test/lux/control/parser/type.lux | 323 ------------------- stdlib/source/test/lux/control/remember.lux | 9 +- stdlib/source/test/lux/data/text.lux | 8 +- stdlib/source/test/lux/data/text/escape.lux | 9 +- stdlib/source/test/lux/data/text/regex.lux | 7 +- stdlib/source/test/lux/debug.lux | 7 +- stdlib/source/test/lux/documentation.lux | 7 +- stdlib/source/test/lux/extension.lux | 9 +- stdlib/source/test/lux/ffi.jvm.lux | 9 +- stdlib/source/test/lux/macro.lux | 9 +- stdlib/source/test/lux/macro/code.lux | 150 ++++++++- stdlib/source/test/lux/macro/local.lux | 8 +- stdlib/source/test/lux/macro/syntax.lux | 8 +- stdlib/source/test/lux/macro/syntax/check.lux | 8 +- .../source/test/lux/macro/syntax/declaration.lux | 9 +- stdlib/source/test/lux/macro/syntax/definition.lux | 8 +- stdlib/source/test/lux/macro/syntax/export.lux | 7 +- stdlib/source/test/lux/macro/syntax/input.lux | 9 +- .../source/test/lux/macro/syntax/type/variable.lux | 9 +- stdlib/source/test/lux/macro/template.lux | 7 +- stdlib/source/test/lux/meta/configuration.lux | 8 +- stdlib/source/test/lux/meta/version.lux | 7 +- stdlib/source/test/lux/program.lux | 5 +- stdlib/source/test/lux/type.lux | 312 +++++++++++++++++- stdlib/source/test/lux/type/primitive.lux | 9 +- stdlib/source/test/lux/type/resource.lux | 7 +- 183 files changed, 1631 insertions(+), 1838 deletions(-) delete mode 100644 stdlib/source/library/lux/control/parser/code.lux delete mode 100644 stdlib/source/library/lux/control/parser/type.lux create mode 100644 stdlib/source/parser/lux/macro/code.lux create mode 100644 stdlib/source/parser/lux/type.lux delete mode 100644 stdlib/source/test/lux/control/parser/code.lux delete mode 100644 stdlib/source/test/lux/control/parser/type.lux (limited to 'stdlib') diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 72fa36c45..0bf71c4ad 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -5,9 +5,7 @@ ["$" documentation (.only documentation)] ["[0]" debug] [control - ["[0]" io] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" io]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]] diff --git a/stdlib/source/documentation/lux/data/collection/array.lux b/stdlib/source/documentation/lux/data/collection/array.lux index b8a5f6e8a..8697a4686 100644 --- a/stdlib/source/documentation/lux/data/collection/array.lux +++ b/stdlib/source/documentation/lux/data/collection/array.lux @@ -2,9 +2,6 @@ [library [lux (.except list) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/bits.lux b/stdlib/source/documentation/lux/data/collection/bits.lux index 117f4c7d6..075c71091 100644 --- a/stdlib/source/documentation/lux/data/collection/bits.lux +++ b/stdlib/source/documentation/lux/data/collection/bits.lux @@ -2,9 +2,6 @@ [library [lux (.except or and not) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/dictionary.lux b/stdlib/source/documentation/lux/data/collection/dictionary.lux index b7a04eda8..72ed210aa 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary.lux @@ -2,9 +2,6 @@ [library [lux (.except has revised) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux index 4f4e6a259..d5f857c5c 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/ordered.lux @@ -2,9 +2,6 @@ [library [lux (.except has revised) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux index 2edd88313..0dafc6340 100644 --- a/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/documentation/lux/data/collection/dictionary/plist.lux @@ -2,9 +2,6 @@ [library [lux (.except has revised) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/list.lux b/stdlib/source/documentation/lux/data/collection/list.lux index 0841931de..8d8a47651 100644 --- a/stdlib/source/documentation/lux/data/collection/list.lux +++ b/stdlib/source/documentation/lux/data/collection/list.lux @@ -2,9 +2,6 @@ [library [lux (.except all) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/queue.lux b/stdlib/source/documentation/lux/data/collection/queue.lux index 5e3595df8..19fee78c9 100644 --- a/stdlib/source/documentation/lux/data/collection/queue.lux +++ b/stdlib/source/documentation/lux/data/collection/queue.lux @@ -2,9 +2,6 @@ [library [lux (.except list) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/queue/priority.lux b/stdlib/source/documentation/lux/data/collection/queue/priority.lux index f73f16453..47ccd89bb 100644 --- a/stdlib/source/documentation/lux/data/collection/queue/priority.lux +++ b/stdlib/source/documentation/lux/data/collection/queue/priority.lux @@ -2,9 +2,6 @@ [library [lux (.except list) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/sequence.lux b/stdlib/source/documentation/lux/data/collection/sequence.lux index d4694429e..7c286aa0a 100644 --- a/stdlib/source/documentation/lux/data/collection/sequence.lux +++ b/stdlib/source/documentation/lux/data/collection/sequence.lux @@ -2,9 +2,6 @@ [library [lux (.except list has revised) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/set.lux b/stdlib/source/documentation/lux/data/collection/set.lux index 322ec2394..2eb5f11c9 100644 --- a/stdlib/source/documentation/lux/data/collection/set.lux +++ b/stdlib/source/documentation/lux/data/collection/set.lux @@ -2,9 +2,6 @@ [library [lux (.except list has) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/set/multi.lux b/stdlib/source/documentation/lux/data/collection/set/multi.lux index 7137544a3..5f48a9e9e 100644 --- a/stdlib/source/documentation/lux/data/collection/set/multi.lux +++ b/stdlib/source/documentation/lux/data/collection/set/multi.lux @@ -2,9 +2,6 @@ [library [lux (.except list has) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/set/ordered.lux b/stdlib/source/documentation/lux/data/collection/set/ordered.lux index 7d5073699..88ae58dc6 100644 --- a/stdlib/source/documentation/lux/data/collection/set/ordered.lux +++ b/stdlib/source/documentation/lux/data/collection/set/ordered.lux @@ -2,9 +2,6 @@ [library [lux (.except list has) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/stack.lux b/stdlib/source/documentation/lux/data/collection/stack.lux index 91229d086..da805da8a 100644 --- a/stdlib/source/documentation/lux/data/collection/stack.lux +++ b/stdlib/source/documentation/lux/data/collection/stack.lux @@ -2,9 +2,6 @@ [library [lux (.except list) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/stream.lux b/stdlib/source/documentation/lux/data/collection/stream.lux index 54c485d4f..f77decc5e 100644 --- a/stdlib/source/documentation/lux/data/collection/stream.lux +++ b/stdlib/source/documentation/lux/data/collection/stream.lux @@ -2,9 +2,6 @@ [library [lux (.except list pattern) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/tree.lux b/stdlib/source/documentation/lux/data/collection/tree.lux index a29e8fff7..9c9fe9ad5 100644 --- a/stdlib/source/documentation/lux/data/collection/tree.lux +++ b/stdlib/source/documentation/lux/data/collection/tree.lux @@ -2,9 +2,6 @@ [library [lux (.except list) ["$" documentation (.only documentation:)] - [control - ["<>" parser (.only) - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/tree/finger.lux b/stdlib/source/documentation/lux/data/collection/tree/finger.lux index 32baf2a3b..31f2dac1f 100644 --- a/stdlib/source/documentation/lux/data/collection/tree/finger.lux +++ b/stdlib/source/documentation/lux/data/collection/tree/finger.lux @@ -2,9 +2,6 @@ [library [lux (.except list) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/collection/tree/zipper.lux b/stdlib/source/documentation/lux/data/collection/tree/zipper.lux index 61beb4f1e..4ad5aae46 100644 --- a/stdlib/source/documentation/lux/data/collection/tree/zipper.lux +++ b/stdlib/source/documentation/lux/data/collection/tree/zipper.lux @@ -2,9 +2,6 @@ [library [lux (.except list) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/data/color.lux b/stdlib/source/documentation/lux/data/color.lux index 3846ced3e..603ccb07b 100644 --- a/stdlib/source/documentation/lux/data/color.lux +++ b/stdlib/source/documentation/lux/data/color.lux @@ -2,16 +2,14 @@ [library [lux (.except) ["$" documentation (.only documentation:)] - [control - ["<>" parser (.only) - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] [macro [syntax (.only syntax)] - ["[0]" code] - ["[0]" template]]]] + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser]]]]] [\\library ["[0]" /]] ["[0]" / diff --git a/stdlib/source/documentation/lux/data/color/named.lux b/stdlib/source/documentation/lux/data/color/named.lux index e595febb4..d905485f0 100644 --- a/stdlib/source/documentation/lux/data/color/named.lux +++ b/stdlib/source/documentation/lux/data/color/named.lux @@ -2,9 +2,6 @@ [library [lux (.except) ["$" documentation (.only documentation:)] - [control - ["<>" parser (.only) - ["<[0]>" code]]] [data ["[0]" text ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/extension.lux b/stdlib/source/documentation/lux/extension.lux index 6cd4922ed..1379b60a3 100644 --- a/stdlib/source/documentation/lux/extension.lux +++ b/stdlib/source/documentation/lux/extension.lux @@ -3,16 +3,15 @@ [lux (.except) ["$" documentation (.only documentation:)] ["[0]" debug] - [control - ["<>" parser - ["<[0]>" code]]] [data [text ["%" \\format (.only format)]] [collection ["[0]" sequence]]] [macro - ["[0]" template]] + ["[0]" template] + ["[0]" code + ["<[1]>" \\parser]]] ["@" target ["[0]" jvm]] [tool diff --git a/stdlib/source/documentation/lux/test.lux b/stdlib/source/documentation/lux/test.lux index 9b89be715..b9196ae25 100644 --- a/stdlib/source/documentation/lux/test.lux +++ b/stdlib/source/documentation/lux/test.lux @@ -2,9 +2,6 @@ [library [lux (.except and for) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/time.lux b/stdlib/source/documentation/lux/time.lux index 54dd90c9a..1b0b5ac6c 100644 --- a/stdlib/source/documentation/lux/time.lux +++ b/stdlib/source/documentation/lux/time.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser (.only) - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/time/date.lux b/stdlib/source/documentation/lux/time/date.lux index 9bf40345c..818371741 100644 --- a/stdlib/source/documentation/lux/time/date.lux +++ b/stdlib/source/documentation/lux/time/date.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/time/day.lux b/stdlib/source/documentation/lux/time/day.lux index 02472edcf..5cd046493 100644 --- a/stdlib/source/documentation/lux/time/day.lux +++ b/stdlib/source/documentation/lux/time/day.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/time/duration.lux b/stdlib/source/documentation/lux/time/duration.lux index 6e02734e4..448ea46eb 100644 --- a/stdlib/source/documentation/lux/time/duration.lux +++ b/stdlib/source/documentation/lux/time/duration.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/time/instant.lux b/stdlib/source/documentation/lux/time/instant.lux index ec6515e74..9eb35f53d 100644 --- a/stdlib/source/documentation/lux/time/instant.lux +++ b/stdlib/source/documentation/lux/time/instant.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/time/month.lux b/stdlib/source/documentation/lux/time/month.lux index 1dcb72d41..ccd31a8c4 100644 --- a/stdlib/source/documentation/lux/time/month.lux +++ b/stdlib/source/documentation/lux/time/month.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/time/year.lux b/stdlib/source/documentation/lux/time/year.lux index 3e7957de9..b8dc23837 100644 --- a/stdlib/source/documentation/lux/time/year.lux +++ b/stdlib/source/documentation/lux/time/year.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/type.lux b/stdlib/source/documentation/lux/type.lux index 16b7f238a..37322e9c0 100644 --- a/stdlib/source/documentation/lux/type.lux +++ b/stdlib/source/documentation/lux/type.lux @@ -2,9 +2,6 @@ [library [lux (.except function as let) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format]]] diff --git a/stdlib/source/documentation/lux/type/check.lux b/stdlib/source/documentation/lux/type/check.lux index df026fac7..959cda6a4 100644 --- a/stdlib/source/documentation/lux/type/check.lux +++ b/stdlib/source/documentation/lux/type/check.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/type/dynamic.lux b/stdlib/source/documentation/lux/type/dynamic.lux index 182cafaec..d6930a245 100644 --- a/stdlib/source/documentation/lux/type/dynamic.lux +++ b/stdlib/source/documentation/lux/type/dynamic.lux @@ -2,9 +2,6 @@ [library [lux (.except static) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/type/implicit.lux b/stdlib/source/documentation/lux/type/implicit.lux index 3152aa23d..713ad788c 100644 --- a/stdlib/source/documentation/lux/type/implicit.lux +++ b/stdlib/source/documentation/lux/type/implicit.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/type/poly.lux b/stdlib/source/documentation/lux/type/poly.lux index 6fe2dcf42..31159c6a5 100644 --- a/stdlib/source/documentation/lux/type/poly.lux +++ b/stdlib/source/documentation/lux/type/poly.lux @@ -6,9 +6,6 @@ [\\specification ["$[0]" equivalence] ["$[0]" codec]]] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/type/primitive.lux b/stdlib/source/documentation/lux/type/primitive.lux index 8224eca7f..252891761 100644 --- a/stdlib/source/documentation/lux/type/primitive.lux +++ b/stdlib/source/documentation/lux/type/primitive.lux @@ -2,9 +2,6 @@ [library [lux (.except) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/type/quotient.lux b/stdlib/source/documentation/lux/type/quotient.lux index 2546996d7..c0185b109 100644 --- a/stdlib/source/documentation/lux/type/quotient.lux +++ b/stdlib/source/documentation/lux/type/quotient.lux @@ -2,9 +2,6 @@ [library [lux (.except) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/type/refinement.lux b/stdlib/source/documentation/lux/type/refinement.lux index 0c2d8eec5..083dd523e 100644 --- a/stdlib/source/documentation/lux/type/refinement.lux +++ b/stdlib/source/documentation/lux/type/refinement.lux @@ -2,9 +2,6 @@ [library [lux (.except) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/type/resource.lux b/stdlib/source/documentation/lux/type/resource.lux index 4a1a408f2..e6f964b9b 100644 --- a/stdlib/source/documentation/lux/type/resource.lux +++ b/stdlib/source/documentation/lux/type/resource.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/type/unit.lux b/stdlib/source/documentation/lux/type/unit.lux index 681708f55..edfd3340b 100644 --- a/stdlib/source/documentation/lux/type/unit.lux +++ b/stdlib/source/documentation/lux/type/unit.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/type/variance.lux b/stdlib/source/documentation/lux/type/variance.lux index 09b787cd5..d4a1052d3 100644 --- a/stdlib/source/documentation/lux/type/variance.lux +++ b/stdlib/source/documentation/lux/type/variance.lux @@ -2,9 +2,6 @@ [library [lux (.except and) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/world/console.lux b/stdlib/source/documentation/lux/world/console.lux index 8f5180287..9c5004ae1 100644 --- a/stdlib/source/documentation/lux/world/console.lux +++ b/stdlib/source/documentation/lux/world/console.lux @@ -3,9 +3,6 @@ [lux (.except) ["$" documentation (.only documentation:)] ["@" target] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/world/file.lux b/stdlib/source/documentation/lux/world/file.lux index 019ecb99a..753ebd8ea 100644 --- a/stdlib/source/documentation/lux/world/file.lux +++ b/stdlib/source/documentation/lux/world/file.lux @@ -3,9 +3,6 @@ [lux (.except) ["$" documentation (.only documentation:)] ["@" target] - [control - ["<>" parser (.only) - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/world/file/watch.lux b/stdlib/source/documentation/lux/world/file/watch.lux index 93d0b4410..94ec46172 100644 --- a/stdlib/source/documentation/lux/world/file/watch.lux +++ b/stdlib/source/documentation/lux/world/file/watch.lux @@ -3,9 +3,6 @@ [lux (.except) ["$" documentation (.only documentation:)] ["@" target] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/world/input/keyboard.lux b/stdlib/source/documentation/lux/world/input/keyboard.lux index 23868eeaa..86011916c 100644 --- a/stdlib/source/documentation/lux/world/input/keyboard.lux +++ b/stdlib/source/documentation/lux/world/input/keyboard.lux @@ -2,9 +2,6 @@ [library [lux (.except) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/world/net/http/client.lux b/stdlib/source/documentation/lux/world/net/http/client.lux index 5f2af5e06..27cb1e449 100644 --- a/stdlib/source/documentation/lux/world/net/http/client.lux +++ b/stdlib/source/documentation/lux/world/net/http/client.lux @@ -3,9 +3,6 @@ [lux (.except) ["$" documentation (.only documentation:)] ["@" target] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/world/net/http/status.lux b/stdlib/source/documentation/lux/world/net/http/status.lux index 129a7d833..1999f23e9 100644 --- a/stdlib/source/documentation/lux/world/net/http/status.lux +++ b/stdlib/source/documentation/lux/world/net/http/status.lux @@ -2,9 +2,6 @@ [library [lux (.except) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/world/output/video/resolution.lux b/stdlib/source/documentation/lux/world/output/video/resolution.lux index 8da9cc2ca..97d312c77 100644 --- a/stdlib/source/documentation/lux/world/output/video/resolution.lux +++ b/stdlib/source/documentation/lux/world/output/video/resolution.lux @@ -2,9 +2,6 @@ [library [lux (.except) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/world/program.lux b/stdlib/source/documentation/lux/world/program.lux index 5def43411..0e932c07d 100644 --- a/stdlib/source/documentation/lux/world/program.lux +++ b/stdlib/source/documentation/lux/world/program.lux @@ -2,9 +2,6 @@ [library [lux (.except) ["$" documentation (.only documentation:)] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/documentation/lux/world/shell.lux b/stdlib/source/documentation/lux/world/shell.lux index fed983eed..b2ad55851 100644 --- a/stdlib/source/documentation/lux/world/shell.lux +++ b/stdlib/source/documentation/lux/world/shell.lux @@ -3,9 +3,6 @@ [lux (.except) ["$" documentation (.only documentation:)] ["@" target] - [control - ["<>" parser - ["<[0]>" code]]] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] diff --git a/stdlib/source/format/lux/data/text.lux b/stdlib/source/format/lux/data/text.lux index 7c80696fd..bae5e1263 100644 --- a/stdlib/source/format/lux/data/text.lux +++ b/stdlib/source/format/lux/data/text.lux @@ -6,8 +6,7 @@ [functor ["[0]" contravariant]]] [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data ["[0]" bit] ["[0]" text] @@ -32,8 +31,9 @@ ["[0]" ratio]]] [macro [syntax (.only syntax)] - ["[0]" code] - ["[0]" template]] + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [meta ["[0]" location] ["[0]" symbol]] diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux index ae8ad03db..8d03d011e 100644 --- a/stdlib/source/library/lux/abstract/monad/indexed.lux +++ b/stdlib/source/library/lux/abstract/monad/indexed.lux @@ -2,14 +2,14 @@ [library [lux (.except global) [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]]]] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]] ["[0]" //]) (type .public (IxMonad m) diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux index b0768b43e..4e900a860 100644 --- a/stdlib/source/library/lux/control/concatenative.lux +++ b/stdlib/source/library/lux/control/concatenative.lux @@ -15,8 +15,9 @@ ["[0]" list (.use "[1]#[0]" mix functor)]]] ["[0]" macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code] - ["[0]" template]] + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat] @@ -24,8 +25,7 @@ ["r" rev] ["f" frac]]]]] [// - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]]) + ["<>" parser (.use "[1]#[0]" monad)]]) (type Stack (Record diff --git a/stdlib/source/library/lux/control/continuation.lux b/stdlib/source/library/lux/control/continuation.lux index 57f0053e9..a9e62ac66 100644 --- a/stdlib/source/library/lux/control/continuation.lux +++ b/stdlib/source/library/lux/control/continuation.lux @@ -6,12 +6,11 @@ [apply (.only Apply)] [monad (.only Monad do)]] [control - ["[0]" function] - [parser - ["<[0]>" code]]] + ["[0]" function]] [macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code]]]]) + ["[0]" code (.only) + ["<[1]>" \\parser]]]]]) (type .public (Cont i o) (-> (-> i o) o)) diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux index 98e0c6f72..cf45dfe13 100644 --- a/stdlib/source/library/lux/control/exception.lux +++ b/stdlib/source/library/lux/control/exception.lux @@ -6,16 +6,16 @@ [abstract [monad (.only do)]] [control - ["[0]" maybe] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]] + ["<>" parser (.use "[1]#[0]" monad)] + ["[0]" maybe]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" monoid)] [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] [macro - ["[0]" code] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]] [syntax (.only syntax) ["|[0]|" input] ["[0]" type diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux index 80e90f6ca..df8702fed 100644 --- a/stdlib/source/library/lux/control/function/contract.lux +++ b/stdlib/source/library/lux/control/function/contract.lux @@ -2,15 +2,14 @@ [library [lux (.except) [control - ["[0]" exception (.only exception)] - [parser - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [data [text ["%" \\format (.only format)]]] [macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["i" int]]]]]) diff --git a/stdlib/source/library/lux/control/function/inline.lux b/stdlib/source/library/lux/control/function/inline.lux index 10141088d..98d6e56c9 100644 --- a/stdlib/source/library/lux/control/function/inline.lux +++ b/stdlib/source/library/lux/control/function/inline.lux @@ -5,13 +5,13 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" list (.use "[1]#[0]" monad)]]] ["[0]" macro (.only) - ["[0]" code] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]] [syntax (.only syntax) ["|[0]|" export]]]]]) diff --git a/stdlib/source/library/lux/control/function/mutual.lux b/stdlib/source/library/lux/control/function/mutual.lux index 617efe7de..c6107b1a9 100644 --- a/stdlib/source/library/lux/control/function/mutual.lux +++ b/stdlib/source/library/lux/control/function/mutual.lux @@ -5,9 +5,8 @@ [abstract ["[0]" monad (.only do)]] [control - ["[0]" try (.only Try)] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]] + ["<>" parser (.use "[1]#[0]" monad)] + ["[0]" try (.only Try)]] [data ["[0]" product] [text @@ -18,7 +17,8 @@ ["[0]" plist (.only PList)]]]] ["[0]" macro (.only) ["[0]" local] - ["[0]" code] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]] [syntax (.only syntax) ["[0]" declaration (.only Declaration)]]]]] ["[0]" //]) diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux index 5ae034638..609814844 100644 --- a/stdlib/source/library/lux/control/io.lux +++ b/stdlib/source/library/lux/control/io.lux @@ -5,14 +5,13 @@ [functor (.only Functor)] [apply (.only Apply)] [monad (.only Monad do)]] - [control - [parser - ["<[0]>" code]]] [type [primitive (.except)]] [macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" template]]]]) + ["[0]" template] + ["[0]" code + ["<[1]>" \\parser]]]]]) (primitive .public (IO a) (-> Any a) diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux index 95299e5f0..b20711ba7 100644 --- a/stdlib/source/library/lux/control/lazy.lux +++ b/stdlib/source/library/lux/control/lazy.lux @@ -8,12 +8,12 @@ [equivalence (.only Equivalence)]] [control ["[0]" io] - [parser - ["<[0]>" code]] [concurrency ["[0]" atom]]] [macro (.only with_symbols) - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code + ["<[1]>" \\parser]]] [type (.only sharing) [primitive (.except)]]]]) diff --git a/stdlib/source/library/lux/control/parser/code.lux b/stdlib/source/library/lux/control/parser/code.lux deleted file mode 100644 index a73b18c55..000000000 --- a/stdlib/source/library/lux/control/parser/code.lux +++ /dev/null @@ -1,226 +0,0 @@ -(.require - [library - [lux (.except nat int rev local not symbol local global) - [abstract - ["[0]" monad (.only do)]] - [control - ["[0]" try (.only Try)]] - [data - ["[0]" bit] - ["[0]" text (.use "[1]#[0]" monoid)] - [collection - ["[0]" list (.use "[1]#[0]" functor)]]] - [macro - ["[0]" code (.use "[1]#[0]" equivalence)]] - [math - [number - ["[0]" nat] - ["[0]" int] - ["[0]" rev] - ["[0]" frac]]] - [meta - ["[0]" symbol]]]] - ["[0]" //]) - -(def (un_paired pairs) - (All (_ a) (-> (List [a a]) (List a))) - (case pairs - {.#End} - {.#End} - - {.#Item [[x y] pairs']} - (list.partial x y (un_paired pairs')))) - -(type .public Parser - (//.Parser (List Code))) - -(def remaining_inputs - (-> (List Code) Text) - (|>> (list#each code.format) - (text.interposed " ") - (all text#composite text.new_line "Remaining input: "))) - -(def .public any - (Parser Code) - (function (_ tokens) - (case tokens - {.#End} - {try.#Failure "There are no tokens to parse!"} - - {.#Item [t tokens']} - {try.#Success [tokens' t]}))) - -(def .public next - (Parser Code) - (function (_ tokens) - (case tokens - {.#End} - {try.#Failure "There are no tokens to parse!"} - - {.#Item next _} - {try.#Success [tokens next]}))) - -(with_template [ ] - [(with_expansions [ (these {try.#Failure (all text#composite "Cannot parse " (remaining_inputs tokens))})] - (def .public - (Parser ) - (function (_ tokens) - (case tokens - {.#Item [[_ { x}] tokens']} - {try.#Success [tokens' x]} - - _ - ))) - - (def .public ( expected) - (-> (Parser Any)) - (function (_ tokens) - (case tokens - {.#Item [[_ { actual}] tokens']} - (if (at = expected actual) - {try.#Success [tokens' []]} - ) - - _ - ))))] - - [bit this_bit Bit .#Bit bit.equivalence "bit"] - [nat this_nat Nat .#Nat nat.equivalence "nat"] - [int this_int Int .#Int int.equivalence "int"] - [rev this_rev Rev .#Rev rev.equivalence "rev"] - [frac this_frac Frac .#Frac frac.equivalence "frac"] - [text this_text Text .#Text text.equivalence "text"] - [symbol this_symbol Symbol .#Symbol symbol.equivalence "symbol"] - ) - -(def .public (this code) - (-> Code (Parser Any)) - (function (_ tokens) - (case tokens - {.#Item [token tokens']} - (if (code#= code token) - {try.#Success [tokens' []]} - {try.#Failure (all text#composite "Expected a " (code.format code) " but instead got " (code.format token) - (remaining_inputs tokens))}) - - _ - {try.#Failure "There are no tokens to parse!"}))) - -(with_expansions [ (these {try.#Failure (all text#composite "Cannot parse local symbol" (remaining_inputs tokens))})] - (def .public local - (Parser Text) - (function (_ tokens) - (case tokens - {.#Item [[_ {.#Symbol ["" x]}] tokens']} - {try.#Success [tokens' x]} - - _ - ))) - - (def .public (this_local expected) - (-> Text (Parser Any)) - (function (_ tokens) - (case tokens - {.#Item [[_ {.#Symbol ["" actual]}] tokens']} - (if (at text.equivalence = expected actual) - {try.#Success [tokens' []]} - ) - - _ - )))) - -(with_expansions [ (these {try.#Failure (all text#composite "Cannot parse local symbol" (remaining_inputs tokens))})] - (def .public global - (Parser Symbol) - (function (_ tokens) - (case tokens - {.#Item [[_ {.#Symbol ["" short]}] tokens']} - - - {.#Item [[_ {.#Symbol it}] tokens']} - {try.#Success [tokens' it]} - - _ - ))) - - (def .public (this_global expected) - (-> Symbol (Parser Any)) - (function (_ tokens) - (case tokens - {.#Item [[_ {.#Symbol ["" actual]}] tokens']} - - - {.#Item [[_ {.#Symbol it}] tokens']} - (if (at symbol.equivalence = expected it) - {try.#Success [tokens' []]} - ) - - _ - )))) - -(with_template [ ] - [(def .public ( p) - (All (_ a) - (-> (Parser a) (Parser a))) - (function (_ tokens) - (case tokens - {.#Item [[_ { members}] tokens']} - (case (p members) - {try.#Success [{.#End} x]} {try.#Success [tokens' x]} - _ {try.#Failure (all text#composite "Parser was expected to fully consume " (remaining_inputs tokens))}) - - _ - {try.#Failure (all text#composite "Cannot parse " (remaining_inputs tokens))})))] - - [form .#Form "form"] - [variant .#Variant "variant"] - [tuple .#Tuple "tuple"] - ) - -(def .public end - (Parser Any) - (function (_ tokens) - (case tokens - {.#End} {try.#Success [tokens []]} - _ {try.#Failure (all text#composite "Expected list of tokens to be empty!" (remaining_inputs tokens))}))) - -(def .public end? - (Parser Bit) - (function (_ tokens) - {try.#Success [tokens (case tokens - {.#End} true - _ false)]})) - -(def .public (result parser inputs) - (All (_ a) (-> (Parser a) (List Code) (Try a))) - (case (parser inputs) - {try.#Failure error} - {try.#Failure error} - - {try.#Success [unconsumed value]} - (case unconsumed - {.#End} - {try.#Success value} - - _ - {try.#Failure (|> unconsumed - (list#each code.format) - (text.interposed ", ") - (text#composite "Unconsumed inputs: "))}))) - -(def .public (locally inputs parser) - (All (_ a) (-> (List Code) (Parser a) (Parser a))) - (function (_ real) - (do try.monad - [value (..result parser inputs)] - (in [real value])))) - -(def .public (not parser) - (All (_ a) (-> (Parser a) (Parser Code))) - (do //.monad - [sample ..next - result (//.or parser - ..any)] - (case result - {.#Left _} (//.failure (text#composite "Did NOT expect to parse code: " (code.format sample))) - {.#Right output} (in output)))) diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux deleted file mode 100644 index b4609b897..000000000 --- a/stdlib/source/library/lux/control/parser/type.lux +++ /dev/null @@ -1,350 +0,0 @@ -(.require - [library - [lux (.except function local parameter) - [abstract - ["[0]" monad (.only do)]] - [control - ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] - ["[0]" function]] - [data - ["[0]" text (.use "[1]#[0]" monoid) - ["%" \\format (.only format)]] - [collection - ["[0]" list (.use "[1]#[0]" functor)] - ["[0]" dictionary (.only Dictionary)]]] - [macro - ["^" pattern] - ["[0]" code]] - [math - [number - ["n" nat (.use "[1]#[0]" decimal)]]] - ["[0]" type (.use "[1]#[0]" equivalence) - ["[0]" check]]]] - ["[0]" //]) - -(def |recursion_dummy| - (template (|recursion_dummy|) - [{.#Primitive "" {.#End}}])) - -(with_template [] - [(exception .public ( [type Type]) - (exception.report - "Type" (%.type type)))] - - [not_existential] - [not_recursive] - [not_named] - [not_parameter] - [unknown_parameter] - [not_function] - [not_application] - [not_polymorphic] - [not_variant] - [not_tuple] - ) - -(with_template [] - [(exception .public ( [expected Type - actual Type]) - (exception.report - "Expected" (%.type expected) - "Actual" (%.type actual)))] - - [types_do_not_match] - [wrong_parameter] - ) - -(exception .public empty_input) - -(exception .public (unconsumed_input [remaining (List Type)]) - (exception.report - "Types" (|> remaining - (list#each (|>> %.type (format text.new_line "* "))) - (text.interposed "")))) - -(type .public Env - (Dictionary Nat [Type Code])) - -(type .public (Parser a) - (//.Parser [Env (List Type)] a)) - -(def .public fresh - Env - (dictionary.empty n.hash)) - -(def (result' env poly types) - (All (_ a) (-> Env (Parser a) (List Type) (Try a))) - (case (//.result poly [env types]) - {try.#Failure error} - {try.#Failure error} - - {try.#Success [[env' remaining] output]} - (case remaining - {.#End} - {try.#Success output} - - _ - (exception.except ..unconsumed_input remaining)))) - -(def .public (result poly type) - (All (_ a) (-> (Parser a) Type (Try a))) - (result' ..fresh poly (list type))) - -(def .public env - (Parser Env) - (.function (_ [env inputs]) - {try.#Success [[env inputs] env]})) - -(def (with_env temp poly) - (All (_ a) (-> Env (Parser a) (Parser a))) - (.function (_ [env inputs]) - (case (//.result poly [temp inputs]) - {try.#Failure error} - {try.#Failure error} - - {try.#Success [[_ remaining] output]} - {try.#Success [[env remaining] output]}))) - -(def .public next - (Parser Type) - (.function (_ [env inputs]) - (case inputs - {.#End} - (exception.except ..empty_input []) - - {.#Item headT tail} - {try.#Success [[env inputs] headT]}))) - -(def .public any - (Parser Type) - (.function (_ [env inputs]) - (case inputs - {.#End} - (exception.except ..empty_input []) - - {.#Item headT tail} - {try.#Success [[env tail] headT]}))) - -(def .public (local types poly) - (All (_ a) (-> (List Type) (Parser a) (Parser a))) - (.function (_ [env pass_through]) - (case (result' env poly types) - {try.#Failure error} - {try.#Failure error} - - {try.#Success output} - {try.#Success [[env pass_through] output]}))) - -(def (label idx) - (-> Nat Code) - (code.local (all text#composite "label" text.tab (n#encoded idx)))) - -(def .public (with_extension type poly) - (All (_ a) (-> Type (Parser a) (Parser [Code a]))) - (.function (_ [env inputs]) - (let [current_id (dictionary.size env) - g!var (label current_id)] - (case (//.result poly - [(dictionary.has current_id [type g!var] env) - inputs]) - {try.#Failure error} - {try.#Failure error} - - {try.#Success [[_ inputs'] output]} - {try.#Success [[env inputs'] [g!var output]]})))) - -(with_template [ ] - [(`` (def .public ( poly) - (All (_ a) (-> (Parser a) (Parser a))) - (do //.monad - [headT ..any] - (let [members ( (type.anonymous headT))] - (if (n.> 1 (list.size members)) - (local members poly) - (//.failure (exception.error headT)))))))] - - [variant type.flat_variant ..not_variant] - [tuple type.flat_tuple ..not_tuple] - ) - -(def polymorphic' - (Parser [Nat Type]) - (do //.monad - [headT any - .let [[num_arg bodyT] (type.flat_univ_q (type.anonymous headT))]] - (if (n.= 0 num_arg) - (//.failure (exception.error ..not_polymorphic headT)) - (in [num_arg bodyT])))) - -(def .public (polymorphic poly) - (All (_ a) (-> (Parser a) (Parser [Code (List Code) a]))) - (do [! //.monad] - [headT any - funcI (at ! each dictionary.size ..env) - [num_args non_poly] (local (list headT) ..polymorphic') - env ..env - .let [funcL (label funcI) - [all_varsL env'] (loop (again [current_arg 0 - env' env - all_varsL (is (List Code) (list))]) - (if (n.< num_args current_arg) - (if (n.= 0 current_arg) - (let [varL (label (++ funcI))] - (again (++ current_arg) - (|> env' - (dictionary.has funcI [headT funcL]) - (dictionary.has (++ funcI) [{.#Parameter (++ funcI)} varL])) - {.#Item varL all_varsL})) - (let [partialI (|> current_arg (n.* 2) (n.+ funcI)) - partial_varI (++ partialI) - partial_varL (label partial_varI) - partialC (` ((~ funcL) (~+ (|> (list.indices num_args) - (list#each (|>> (n.* 2) ++ (n.+ funcI) label)) - list.reversed))))] - (again (++ current_arg) - (|> env' - (dictionary.has partialI [(|recursion_dummy|) partialC]) - (dictionary.has partial_varI [{.#Parameter partial_varI} partial_varL])) - {.#Item partial_varL all_varsL}))) - [all_varsL env']))]] - (<| (with_env env') - (local (list non_poly)) - (do ! - [output poly] - (in [funcL all_varsL output]))))) - -(def .public (function in_poly out_poly) - (All (_ i o) (-> (Parser i) (Parser o) (Parser [i o]))) - (do //.monad - [headT any - .let [[inputsT outputT] (type.flat_function (type.anonymous headT))]] - (if (n.> 0 (list.size inputsT)) - (//.and (local inputsT in_poly) - (local (list outputT) out_poly)) - (//.failure (exception.error ..not_function headT))))) - -(def .public (applied poly) - (All (_ a) (-> (Parser a) (Parser a))) - (do //.monad - [headT any - .let [[funcT paramsT] (type.flat_application (type.anonymous headT))]] - (if (n.= 0 (list.size paramsT)) - (//.failure (exception.error ..not_application headT)) - (..local {.#Item funcT paramsT} poly)))) - -(with_template [ ] - [(def .public ( expected) - (-> Type (Parser Any)) - (do //.monad - [actual any] - (if ( expected actual) - (in []) - (//.failure (exception.error ..types_do_not_match [expected actual])))))] - - [exactly type#=] - [sub check.subsumes?] - [super (function.flipped check.subsumes?)] - ) - -(def .public (argument env idx) - (-> Env Nat Nat) - (let [env_level (n./ 2 (dictionary.size env)) - parameter_level (n./ 2 idx) - parameter_idx (n.% 2 idx)] - (|> env_level -- (n.- parameter_level) (n.* 2) (n.+ parameter_idx)))) - -(def .public parameter - (Parser Code) - (do //.monad - [env ..env - headT any] - (case headT - {.#Parameter idx} - (case (dictionary.value (..argument env idx) env) - {.#Some [poly_type poly_code]} - (in poly_code) - - {.#None} - (//.failure (exception.error ..unknown_parameter headT))) - - _ - (//.failure (exception.error ..not_parameter headT))))) - -(def .public (this_parameter id) - (-> Nat (Parser Any)) - (do //.monad - [env ..env - headT any] - (case headT - {.#Parameter idx} - (if (n.= id (..argument env idx)) - (in []) - (//.failure (exception.error ..wrong_parameter [{.#Parameter id} headT]))) - - _ - (//.failure (exception.error ..not_parameter headT))))) - -(def .public existential - (Parser Nat) - (do //.monad - [headT any] - (case headT - {.#Ex ex_id} - (in ex_id) - - _ - (//.failure (exception.error ..not_existential headT))))) - -(def .public named - (Parser [Symbol Type]) - (do //.monad - [inputT any] - (case inputT - {.#Named name anonymousT} - (in [name anonymousT]) - - _ - (//.failure (exception.error ..not_named inputT))))) - -(def .public (recursive poly) - (All (_ a) (-> (Parser a) (Parser [Code a]))) - (do [! //.monad] - [headT any] - (case (type.anonymous headT) - (pattern {.#Apply (|recursion_dummy|) {.#UnivQ _ headT'}}) - (do ! - [[recT _ output] (|> poly - (with_extension (|recursion_dummy|)) - (with_extension headT) - (local (list headT')))] - (in [recT output])) - - _ - (//.failure (exception.error ..not_recursive headT))))) - -(def .public recursive_self - (Parser Code) - (do //.monad - [env ..env - headT any] - (case (type.anonymous headT) - (^.multi (pattern {.#Apply (|recursion_dummy|) {.#Parameter funcT_idx}}) - (n.= 0 (..argument env funcT_idx)) - [(dictionary.value 0 env) {.#Some [self_type self_call]}]) - (in self_call) - - _ - (//.failure (exception.error ..not_recursive headT))))) - -(def .public recursive_call - (Parser Code) - (do [! //.monad] - [env ..env - [funcT argsT] (..applied (//.and any (//.many any))) - _ (local (list funcT) (..this_parameter 0)) - allC (let [allT (list.partial funcT argsT)] - (|> allT - (monad.each ! (function.constant ..parameter)) - (local allT)))] - (in (` ((~+ allC)))))) diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux index eff3b6dce..99e7a697c 100644 --- a/stdlib/source/library/lux/control/pipe.lux +++ b/stdlib/source/library/lux/control/pipe.lux @@ -4,16 +4,16 @@ [abstract ["[0]" monad]] [control - ["[0]" try] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser] + ["[0]" try]] [data ["[0]" identity] [collection ["[0]" list (.use "[1]#[0]" monad)]]] [macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux index 264d13adb..bce726fb1 100644 --- a/stdlib/source/library/lux/control/remember.lux +++ b/stdlib/source/library/lux/control/remember.lux @@ -4,11 +4,10 @@ [abstract [monad (.only do)]] [control + ["<>" parser (.use "[1]#[0]" functor)] ["[0]" io] ["[0]" try] - ["[0]" exception (.only exception)] - ["<>" parser (.use "[1]#[0]" functor) - ["" code (.only Parser)]]] + ["[0]" exception (.only exception)]] [data ["[0]" text ["%" \\format (.only format)]]] @@ -17,9 +16,10 @@ ["[0]" date (.only Date) (.use "[1]#[0]" order)]] ["[0]" meta] [macro - ["[0]" code] + [syntax (.only syntax)] ["[0]" template] - [syntax (.only syntax)]]]]) + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) (exception .public (must_remember [deadline Date today Date @@ -40,9 +40,9 @@ (Parser Date) (all <>.either (<>#each (|>> instant.of_millis instant.date) - .int) + .int) (do <>.monad - [raw .text] + [raw .text] (case (at date.codec decoded raw) {try.#Success date} (in date) @@ -52,8 +52,8 @@ (def .public remember (syntax (_ [deadline ..deadline - message .text - focus (<>.maybe .any)]) + message .text + focus (<>.maybe .any)]) (let [now (io.run! instant.now) today (instant.date now)] (if (date#< deadline today) @@ -68,8 +68,8 @@ (with_template [ ] [(`` (def .public (syntax (_ [deadline ..deadline - message .text - focus (<>.maybe .any)]) + message .text + focus (<>.maybe .any)]) (in (list (` (..remember (~ (code.text (%.date deadline))) (~ (code.text (format " " message))) (~+ (case focus diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index 0164bcc7b..96813f726 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -4,9 +4,8 @@ [abstract [monad (.only do)]] [control + ["<>" parser] ["[0]" io (.only IO)] - ["<>" parser (.only) - ["" code]] [concurrency ["[0]" async (.only Async)]]] [data @@ -18,7 +17,8 @@ [primitive (.except)]] ["[0]" meta] ["[0]" macro (.only) - ["[0]" code] + ["[0]" code (.only) + ["<[1]>" \\parser]] [syntax (.only syntax) ["|[0]|" export] ["|[0]|" declaration]]]]]) @@ -44,7 +44,7 @@ (|export|.parser (all <>.and |declaration|.parser - (.form (all <>.and .local .any .any))))]) + (.form (all <>.and .local .any .any))))]) (macro.with_symbols [g!_] (do [! meta.monad] [this_module meta.current_module_name diff --git a/stdlib/source/library/lux/data/collection/sequence.lux b/stdlib/source/library/lux/data/collection/sequence.lux index 493b5d411..3d5dfd300 100644 --- a/stdlib/source/library/lux/data/collection/sequence.lux +++ b/stdlib/source/library/lux/data/collection/sequence.lux @@ -14,11 +14,10 @@ [mix (.only Mix)] [predicate (.only Predicate)]] [control + ["<>" parser] ["[0]" maybe (.use "[1]#[0]" functor)] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["[0]" exception (.only exception)]] [data ["[0]" product] [collection @@ -28,7 +27,8 @@ [macro [syntax (.only syntax)] ["^" pattern] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/data/collection/stream.lux b/stdlib/source/library/lux/data/collection/stream.lux index 42523d5e3..4e82cbe1e 100644 --- a/stdlib/source/library/lux/data/collection/stream.lux +++ b/stdlib/source/library/lux/data/collection/stream.lux @@ -6,15 +6,15 @@ [comonad (.only CoMonad)]] [control ["//" continuation (.only Cont)] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data ["[0]" bit] [collection ["[0]" list (.use "[1]#[0]" monad)]]] [macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat]]]]]) diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux index f05521c70..64288458d 100644 --- a/stdlib/source/library/lux/data/collection/tree.lux +++ b/stdlib/source/library/lux/data/collection/tree.lux @@ -7,14 +7,14 @@ [mix (.only Mix)] [monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" list (.use "[1]#[0]" monad mix)]]] [macro [syntax (.only syntax)] - ["[0]" code]]]]) + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) (type .public (Tree a) (Record diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index ac6af642c..6dab6619e 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -2,9 +2,7 @@ [library [lux (.except Label All Location and static false true) [control - ["[0]" maybe] - [parser - ["<[0]>" code]]] + ["[0]" maybe]] [data ["[0]" color] ["[0]" product] @@ -15,7 +13,8 @@ [macro [syntax (.only syntax)] ["[0]" template] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux index 845a4e057..3f14a9599 100644 --- a/stdlib/source/library/lux/data/format/json.lux +++ b/stdlib/source/library/lux/data/format/json.lux @@ -8,11 +8,10 @@ [predicate (.only Predicate)] ["[0]" monad (.only do)]] [control + ["<>" parser (.use "[1]#[0]" monad)] ["[0]" pipe] ["[0]" maybe] - ["[0]" try (.only Try)] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code]]] + ["[0]" try (.only Try)]] [data ["[0]" bit] ["[0]" product] @@ -25,7 +24,8 @@ [macro [syntax (.only syntax)] ["^" pattern] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux index f8980caf1..aff108c29 100644 --- a/stdlib/source/library/lux/data/text/escape.lux +++ b/stdlib/source/library/lux/data/text/escape.lux @@ -5,18 +5,18 @@ [abstract [monad (.only do)]] [control + ["<>" parser] ["[0]" maybe] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] - ["<>" parser - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [math [number (.only hex) ["n" nat]]] [macro [syntax (.only syntax)] ["^" pattern] - ["[0]" code]]]] + ["[0]" code (.only) + ["<[1]>" \\parser]]]]] ["[0]" // (.only Char) ["%" \\format (.only format)]]) diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux index 957c12bd7..c9a8a5d68 100644 --- a/stdlib/source/library/lux/data/text/regex.lux +++ b/stdlib/source/library/lux/data/text/regex.lux @@ -5,11 +5,10 @@ [abstract [monad (.only do)]] [control + ["<>" parser (.use "[1]#[0]" monad)] ["[0]" maybe] ["[0]" try] - ["[0]" exception (.only exception)] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [data ["[0]" product] ["[0]" text @@ -19,7 +18,8 @@ [macro (.only with_symbols) [syntax (.only syntax)] ["^" pattern] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex) ["n" nat (.use "[1]#[0]" decimal)]]]]] diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux index 3db55592d..fa9e36cff 100644 --- a/stdlib/source/library/lux/debug.lux +++ b/stdlib/source/library/lux/debug.lux @@ -2,19 +2,16 @@ [library [lux (.except private) ["@" target] - ["[0]" type] ["[0]" ffi (.only import)] ["[0]" meta] [abstract ["[0]" monad (.only do)]] [control + ["<>" parser] ["[0]" pipe] ["[0]" function] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" type (.only Parser)] - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [data ["[0]" text (.only) ["%" \\format (.only Format)]] @@ -29,7 +26,8 @@ ["^" pattern] ["[0]" template] ["[0]" syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number [ratio (.only Ratio)] @@ -40,7 +38,9 @@ [duration (.only Duration)] [date (.only Date)] [month (.only Month)] - [day (.only Day)]]]]) + [day (.only Day)]] + ["[0]" type (.only) + ["<[1]>" \\parser (.only Parser)]]]]) (with_expansions [ (these (import java/lang/String "[1]::[0]") diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux index 26e87d50d..2fd1b2bdf 100644 --- a/stdlib/source/library/lux/documentation.lux +++ b/stdlib/source/library/lux/documentation.lux @@ -7,10 +7,9 @@ [monad (.only do)] ["[0]" enum]] [control + ["<>" parser (.use "[1]#[0]" monad)] ["[0]" maybe (.use "[1]#[0]" functor)] - ["[0]" exception (.only exception)] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]] + ["[0]" exception (.only exception)]] [data ["[0]" product] ["[0]" text (.only \n) (.use "[1]#[0]" order) @@ -24,8 +23,9 @@ ["[0]" macro (.only) [syntax (.only syntax)] ["^" pattern] - ["[0]" code] - ["[0]" template]] + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat]]] diff --git a/stdlib/source/library/lux/extension.lux b/stdlib/source/library/lux/extension.lux index 3d1b684f6..9c3946a30 100644 --- a/stdlib/source/library/lux/extension.lux +++ b/stdlib/source/library/lux/extension.lux @@ -4,15 +4,15 @@ [abstract ["[0]" monad]] [control - ["<>" parser (.use "[1]#[0]" monad) - ["" code (.only Parser)]]] + ["<>" parser (.use "[1]#[0]" monad)]] [data ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" functor)]]] [macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["" \\parser (.only Parser)]]] [tool [compiler ["[0]" phase] diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index fddb85cb7..5768251a8 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -5,12 +5,11 @@ [abstract ["[0]" monad (.only do)]] [control + ["<>" parser (.use "[1]#[0]" monad)] ["[0]" io] ["[0]" maybe] ["[0]" try (.only Try)] - ["[0]" exception (.only Exception exception)] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]] + ["[0]" exception (.only Exception exception)]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" equivalence) @@ -23,9 +22,10 @@ [macro (.only with_symbols) [syntax (.only syntax)] ["^" pattern] - ["[0]" code] ["[0]" template] - ["[0]" context]] + ["[0]" context] + ["[0]" code (.only) + ["<[1]>" \\parser(.only Parser)]]] [math [number ["n" nat]]] diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux index 097f91e77..103d2babd 100644 --- a/stdlib/source/library/lux/ffi.lux +++ b/stdlib/source/library/lux/ffi.lux @@ -5,11 +5,10 @@ [abstract ["[0]" monad (.only do)]] [control + ["<>" parser (.use "[1]#[0]" monad)] ["[0]" io] ["[0]" maybe (.use "[1]#[0]" functor)] - ["[0]" try] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]] + ["[0]" try]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" equivalence) @@ -18,8 +17,9 @@ ["[0]" list (.use "[1]#[0]" monad mix)]]] ["[0]" macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code] - ["[0]" template]] + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] ["@" target (.only) ["[0]" js]] [type @@ -378,8 +378,8 @@ parameters (list#each ..output_type :parameters:))] (` (.def ((~ g!it) (~+ (case g!parameters - {.#End} (list g!it) - _ (list#each (the #mandatory) g!parameters)))) + {.#End} (list g!it) + _ (list#each (the #mandatory) g!parameters)))) (.All ((~ g!it) (~+ g!variables)) (-> (~+ :input:/*) (~ (|> :output: @@ -450,8 +450,8 @@ g!class (` ((~ (code.local (maybe.else class_name alias))) (~+ g!class_variables))) :output: [#optional? false #mandatory g!class]] (` (.def ((~ g!it) (~+ (case g!parameters - {.#End} (list g!it) - _ (list#each (the #mandatory) g!parameters)))) + {.#End} (list g!it) + _ (list#each (the #mandatory) g!parameters)))) (.All ((~ g!it) (~+ g!class_variables) (~+ g!input_variables)) (.-> (~+ (list#each ..output_type :parameters:)) (~ (|> :output: @@ -728,51 +728,51 @@ {try.#Failure (%.format "Invalid inputs for extension: " (%.text name))})))))])) (analysis - [name phase archive state] - .end - _ - {try.#Success [state (extension_analysis name (list))]}) + [name phase archive state] + .end + _ + {try.#Success [state (extension_analysis name (list))]}) (generation - [name phase archive state] - (list) - {try.#Success [state js.undefined]}) + [name phase archive state] + (list) + {try.#Success [state js.undefined]}) (def .public undefined (template (undefined) [(.is ..Undefined ())])) (analysis - [name phase archive state] - .any - it - (do try.monad - [[state it] (phase archive (` (.is .Any (~ it))) state)] - (in [state (extension_analysis name (list it))]))) + [name phase archive state] + .any + it + (do try.monad + [[state it] (phase archive (` (.is .Any (~ it))) state)] + (in [state (extension_analysis name (list it))]))) (generation - [name phase archive state] - (list it) - (do try.monad - [[state it] (phase archive it state)] - (in [state (js.= js.undefined it)]))) + [name phase archive state] + (list it) + (do try.monad + [[state it] (phase archive it state)] + (in [state (js.= js.undefined it)]))) (def .public undefined? (template (undefined? ) [(.as .Bit (.is .Any ( )))])) (analysis - [name phase archive state] - (<>.some (<>.and .text .any)) - it - (do [! try.monad] - [[state output] (monad.mix ! (.function (_ [key value] [state output]) - (do ! - [[state value] (phase archive (` (.is .Any (~ value))) state)] - (in [state (list.partial value (text_analysis key) output)]))) - [state (list)] - it)] - (in [state (extension_analysis name (list.reversed output))]))) + [name phase archive state] + (<>.some (<>.and .text .any)) + it + (do [! try.monad] + [[state output] (monad.mix ! (.function (_ [key value] [state output]) + (do ! + [[state value] (phase archive (` (.is .Any (~ value))) state)] + (in [state (list.partial value (text_analysis key) output)]))) + [state (list)] + it)] + (in [state (extension_analysis name (list.reversed output))]))) (def text_synthesis (template (_ ) @@ -791,22 +791,22 @@ (.undefined))) (generation - [name phase archive state] - (list.partial head_key head_value tail) - (do [! try.monad] - [[state output] (monad.mix ! - (.function (_ [key value] [state output]) - (case key - (pattern (text_synthesis key)) - (do try.monad - [[state value] (phase archive value state)] - (in [state (list.partial [key value] output)])) - - _ - (.undefined))) - [state (list)] - (pairs (list.partial head_key head_value tail)))] - (in [state (js.object (list.reversed output))]))) + [name phase archive state] + (list.partial head_key head_value tail) + (do [! try.monad] + [[state output] (monad.mix ! + (.function (_ [key value] [state output]) + (case key + (pattern (text_synthesis key)) + (do try.monad + [[state value] (phase archive value state)] + (in [state (list.partial [key value] output)])) + + _ + (.undefined))) + [state (list)] + (pairs (list.partial head_key head_value tail)))] + (in [state (js.object (list.reversed output))]))) (def .public object (syntax (_ [it (<>.some .any)]) diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index a577a3b6d..a199b5012 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -6,12 +6,11 @@ ["[0]" monad (.only Monad do)] ["[0]" enum]] [control + ["<>" parser] ["[0]" function] ["[0]" io] ["[0]" maybe] - ["[0]" try (.only Try)] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["[0]" try (.only Try)]] [data ["[0]" product] ["[0]" bit (.use "[1]#[0]" codec)] @@ -23,8 +22,9 @@ ["[0]" macro (.only with_symbols) [syntax (.only syntax)] ["^" pattern] - ["[0]" code] - ["[0]" template]] + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] ["[0]" meta]]]) (with_template [ ] @@ -324,7 +324,7 @@ (text.replaced "/" ".")) (def (generic_class_type' mode type_params in_array? name+params - class_type') + class_type') (-> Primitive_Mode (List Type_Parameter) Bit [Text (List GenericType)] (-> Primitive_Mode (List Type_Parameter) Bit GenericType Code) Code) diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux index 00b35e83d..f5f357021 100644 --- a/stdlib/source/library/lux/ffi.php.lux +++ b/stdlib/source/library/lux/ffi.php.lux @@ -6,10 +6,9 @@ [abstract [monad (.only do)]] [control + ["<>" parser (.use "[1]#[0]" monad)] ["[0]" io] - ["[0]" maybe] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]] + ["[0]" maybe]] [data ["[0]" product] ["[0]" text @@ -20,8 +19,9 @@ abstract] [macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code] - ["[0]" template]]]]) + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) (primitive .public (Object brand) Any) @@ -224,7 +224,7 @@ (-> Code Code Code (List Nullable) Bit Bit Nullable Code) (let [g!inputs (input_variables inputsT)] (` (def ((~ g!method) - [(~+ (list#each product.right g!inputs))]) + [(~+ (list#each product.right g!inputs))]) (-> [(~+ (list#each nullable_type inputsT))] (~ (|> (nullable_type outputT) (try_type try?) @@ -286,8 +286,8 @@ {#Virtual [method alias inputsT io? try? outputT]} (let [g!inputs (input_variables inputsT)] (` (def ((~ (qualify (maybe.else method alias))) - [(~+ (list#each product.right g!inputs))] - (~ g!object)) + [(~+ (list#each product.right g!inputs))] + (~ g!object)) (-> [(~+ (list#each nullable_type inputsT))] (~ g!type) (~ (|> (nullable_type outputT) diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux index 49296eef7..27f8c4f4f 100644 --- a/stdlib/source/library/lux/ffi.scm.lux +++ b/stdlib/source/library/lux/ffi.scm.lux @@ -6,10 +6,9 @@ [abstract [monad (.only do)]] [control + ["<>" parser (.use "[1]#[0]" monad)] ["[0]" io] - ["[0]" maybe] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]] + ["[0]" maybe]] [data ["[0]" product] ["[0]" text @@ -20,8 +19,9 @@ abstract] [macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code] - ["[0]" template]]]]) + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) (primitive .public (Object brand) Any) @@ -189,7 +189,7 @@ (-> Code Code Code (List Nilable) Bit Bit Nilable Code) (let [g!inputs (input_variables inputsT)] (` (def ((~ g!method) - [(~+ (list#each product.right g!inputs))]) + [(~+ (list#each product.right g!inputs))]) (-> [(~+ (list#each nilable_type inputsT))] (~ (|> (nilable_type outputT) (try_type try?) diff --git a/stdlib/source/library/lux/ffi/export.js.lux b/stdlib/source/library/lux/ffi/export.js.lux index 2f635e20b..e40ea1964 100644 --- a/stdlib/source/library/lux/ffi/export.js.lux +++ b/stdlib/source/library/lux/ffi/export.js.lux @@ -7,8 +7,7 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser]] [data [text ["%" \\format]] @@ -17,7 +16,8 @@ ["[0]" set]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random]] [target diff --git a/stdlib/source/library/lux/ffi/export.jvm.lux b/stdlib/source/library/lux/ffi/export.jvm.lux index 8d3cc0ea1..6aebb2c13 100644 --- a/stdlib/source/library/lux/ffi/export.jvm.lux +++ b/stdlib/source/library/lux/ffi/export.jvm.lux @@ -2,14 +2,14 @@ [library [lux (.except function) [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" list (.use "[1]#[0]" monad)]]] [macro [syntax (.only syntax)] - ["[0]" code]]]] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]] ["[0]" //]) (type (API of) diff --git a/stdlib/source/library/lux/ffi/export.lua.lux b/stdlib/source/library/lux/ffi/export.lua.lux index 6cfe5b891..66b98998d 100644 --- a/stdlib/source/library/lux/ffi/export.lua.lux +++ b/stdlib/source/library/lux/ffi/export.lua.lux @@ -7,8 +7,7 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser]] [data [text ["%" \\format]] @@ -17,7 +16,8 @@ ["[0]" set]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random]] [target diff --git a/stdlib/source/library/lux/ffi/export.py.lux b/stdlib/source/library/lux/ffi/export.py.lux index 1a4b3e054..42309927e 100644 --- a/stdlib/source/library/lux/ffi/export.py.lux +++ b/stdlib/source/library/lux/ffi/export.py.lux @@ -7,8 +7,7 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser]] [data [text ["%" \\format]] @@ -17,7 +16,8 @@ ["[0]" set]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random]] [target diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux index 1266c730c..6777bfa86 100644 --- a/stdlib/source/library/lux/ffi/export.rb.lux +++ b/stdlib/source/library/lux/ffi/export.rb.lux @@ -8,8 +8,7 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser]] [data ["[0]" text ["%" \\format] @@ -19,7 +18,8 @@ ["[0]" set]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random]] [target diff --git a/stdlib/source/library/lux/macro/context.lux b/stdlib/source/library/lux/macro/context.lux index fef8ae1d8..4d4224ccf 100644 --- a/stdlib/source/library/lux/macro/context.lux +++ b/stdlib/source/library/lux/macro/context.lux @@ -5,16 +5,18 @@ [monad (.only do)] ["[0]" predicate (.only Predicate)]] [control + ["?" parser] ["[0]" exception (.only exception)] - ["[0]" maybe] - ["?" parser (.only) - ["?[0]" code]]] + ["[0]" maybe]] [data ["[0]" text (.use "[1]#[0]" equivalence monoid)] [collection ["[0]" list] [dictionary ["[0]" plist (.only PList)]]]] + [macro + ["[0]" code + ["?[1]" \\parser]]] ["[0]" meta (.only) ["[0]" symbol (.use "[1]#[0]" codec)]]]] ["[0]" // (.only) diff --git a/stdlib/source/library/lux/macro/local.lux b/stdlib/source/library/lux/macro/local.lux index 4e762b81d..ef15fbe10 100644 --- a/stdlib/source/library/lux/macro/local.lux +++ b/stdlib/source/library/lux/macro/local.lux @@ -5,10 +5,9 @@ [abstract ["[0]" monad (.only do)]] [control + ["<>" parser] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [data ["[0]" product] ["[0]" text] @@ -18,7 +17,8 @@ ["[0]" plist (.only PList)]]]]]] ["[0]" // (.only) [syntax (.only syntax)] - ["[1][0]" code]]) + ["[0]" code (.only) + ["<[1]>" \\parser]]]) (exception .public (unknown_module [module Text]) (exception.report @@ -106,7 +106,7 @@ seed meta.seed g!pop (//.symbol "pop") _ (.let [g!pop (is Symbol - ["" (//code.format g!pop)])] + ["" (code.format g!pop)])] (..push_one [g!pop (..pop_all (list#each product.left macros) g!pop)]))] (in (` ((~ g!pop)))))) diff --git a/stdlib/source/library/lux/macro/syntax.lux b/stdlib/source/library/lux/macro/syntax.lux index 897b778e5..380713ff0 100644 --- a/stdlib/source/library/lux/macro/syntax.lux +++ b/stdlib/source/library/lux/macro/syntax.lux @@ -5,10 +5,9 @@ [abstract ["[0]" monad (.only do)]] [control + ["<>" parser] ["[0]" maybe] - ["[0]" try] - ["<>" parser (.only) - ["" code (.only Parser)]]] + ["[0]" try]] [data ["[0]" text (.use "[1]#[0]" monoid)] [collection @@ -20,7 +19,8 @@ ["[0]" rev] ["[0]" frac]]]]] ["[0]" // (.only with_symbols) - ["[0]" code]] + ["[0]" code (.only) + ["" \\parser (.only Parser)]]] ["[0]" / ["[1][0]" export]]) diff --git a/stdlib/source/library/lux/macro/syntax/check.lux b/stdlib/source/library/lux/macro/syntax/check.lux index 6649a6864..7a4b6ac73 100644 --- a/stdlib/source/library/lux/macro/syntax/check.lux +++ b/stdlib/source/library/lux/macro/syntax/check.lux @@ -6,12 +6,12 @@ [equivalence (.only Equivalence)] [monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data ["[0]" product]] [macro - ["[0]" code]]]]) + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) (def extension "lux check") diff --git a/stdlib/source/library/lux/macro/syntax/declaration.lux b/stdlib/source/library/lux/macro/syntax/declaration.lux index c4cac1e99..dbb86e1ce 100644 --- a/stdlib/source/library/lux/macro/syntax/declaration.lux +++ b/stdlib/source/library/lux/macro/syntax/declaration.lux @@ -4,15 +4,15 @@ [abstract [equivalence (.only Equivalence)]] [control - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]] + ["<>" parser (.use "[1]#[0]" monad)]] [data ["[0]" product] ["[0]" text] [collection ["[0]" list (.use "[1]#[0]" functor)]]] [macro - ["[0]" code]]]]) + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) (type .public Declaration (Record diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux index eee400dfe..b93e0bd64 100644 --- a/stdlib/source/library/lux/macro/syntax/definition.lux +++ b/stdlib/source/library/lux/macro/syntax/definition.lux @@ -5,9 +5,8 @@ [equivalence (.only Equivalence)] [monad (.only do)]] [control - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser] + ["[0]" exception (.only exception)]] [data ["[0]" sum] ["[0]" product] @@ -17,7 +16,8 @@ [collection ["[0]" list]]] ["[0]" macro (.only) - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] ["[0]" meta (.only) ["[0]" location]]]] ["[0]" // (.only) diff --git a/stdlib/source/library/lux/macro/syntax/export.lux b/stdlib/source/library/lux/macro/syntax/export.lux index 1a80d36c1..e47b09750 100644 --- a/stdlib/source/library/lux/macro/syntax/export.lux +++ b/stdlib/source/library/lux/macro/syntax/export.lux @@ -4,10 +4,11 @@ [abstract [monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [macro - ["^" pattern]]]]) + ["^" pattern] + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]]]]) (def .public default_policy Code diff --git a/stdlib/source/library/lux/macro/syntax/input.lux b/stdlib/source/library/lux/macro/syntax/input.lux index b0022bc25..1354a9a54 100644 --- a/stdlib/source/library/lux/macro/syntax/input.lux +++ b/stdlib/source/library/lux/macro/syntax/input.lux @@ -4,14 +4,14 @@ [abstract [equivalence (.only Equivalence)]] [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" monad)]]] [macro - ["[0]" code]]]]) + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) (type .public Input (Record diff --git a/stdlib/source/library/lux/macro/syntax/type/variable.lux b/stdlib/source/library/lux/macro/syntax/type/variable.lux index ada8766cb..2658572e6 100644 --- a/stdlib/source/library/lux/macro/syntax/type/variable.lux +++ b/stdlib/source/library/lux/macro/syntax/type/variable.lux @@ -3,13 +3,11 @@ [lux (.except) [abstract [equivalence (.only Equivalence)]] - [control - [parser - ["<[0]>" code (.only Parser)]]] [data ["[0]" text]] [macro - ["[0]" code]]]]) + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]]) (type .public Variable Text) diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux index 834599518..68a37a237 100644 --- a/stdlib/source/library/lux/macro/template.lux +++ b/stdlib/source/library/lux/macro/template.lux @@ -5,10 +5,9 @@ [abstract ["[0]" monad (.only do)]] [control + ["<>" parser (.use "[1]#[0]" functor)] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] - ["<>" parser (.use "[1]#[0]" functor) - ["<[0]>" code (.only Parser)]]] + ["[0]" exception (.only exception)]] [data ["[0]" bit (.use "[1]#[0]" codec)] ["[0]" text] @@ -25,8 +24,9 @@ ["[0]" frac (.use "[1]#[0]" decimal)]]]]] ["[0]" // (.only) [syntax (.only syntax)] - ["[0]" code] - ["[0]" local]]) + ["[0]" local] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]) (def .public spliced (syntax (_ [parts (.tuple (<>.some .any))]) diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux index 6404b3343..63f2e931c 100644 --- a/stdlib/source/library/lux/math.lux +++ b/stdlib/source/library/lux/math.lux @@ -7,10 +7,9 @@ [abstract ["[0]" monad (.only do)]] [control + ["<>" parser] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [data [text ["%" \\format]] @@ -18,7 +17,9 @@ ["[0]" list (.use "[1]#[0]" mix)]]] [macro [syntax (.only syntax)] - ["[0]" template]] + ["[0]" template] + ["[0]" code + ["<[1]>" \\parser]]] [tool [compiler ["[0]" phase (.use "[1]#[0]" monad)] diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux index af6268977..01930c466 100644 --- a/stdlib/source/library/lux/math/infix.lux +++ b/stdlib/source/library/lux/math/infix.lux @@ -4,15 +4,15 @@ [abstract [monad (.only do)]] [control - ["<>" parser (.use "[1]#[0]" functor) - ["<[0]>" code (.only Parser)]]] + ["<>" parser (.use "[1]#[0]" functor)]] [data ["[0]" product] [collection ["[0]" list (.use "[1]#[0]" mix)]]] [macro [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux index 4fcb27d65..489f798ab 100644 --- a/stdlib/source/library/lux/math/modular.lux +++ b/stdlib/source/library/lux/math/modular.lux @@ -8,16 +8,16 @@ [codec (.only Codec)] [monad (.only do)]] [control + ["<>" parser] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" monoid) ["<[1]>" \\parser (.only Parser)]]] [macro - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["i" int (.use "[1]#[0]" decimal)]]] diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux index f22bb1d39..d440669ae 100644 --- a/stdlib/source/library/lux/math/modulus.lux +++ b/stdlib/source/library/lux/math/modulus.lux @@ -6,12 +6,11 @@ [monad (.only do)]] [control ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] - [parser - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [macro [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["i" int]]] diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux index 611d66066..d22ce8ad2 100644 --- a/stdlib/source/library/lux/math/number/complex.lux +++ b/stdlib/source/library/lux/math/number/complex.lux @@ -4,14 +4,15 @@ [abstract [equivalence (.only Equivalence)]] [control - ["[0]" maybe] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" maybe]] [data [collection ["[0]" list (.use "[1]#[0]" functor)]]] [macro - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code + ["<[1]>" \\parser]]] [math [number ["f" frac] diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux index 2e77616c6..6deac08f0 100644 --- a/stdlib/source/library/lux/math/number/ratio.lux +++ b/stdlib/source/library/lux/math/number/ratio.lux @@ -8,17 +8,17 @@ [codec (.only Codec)] [monad (.only do)]] [control + ["<>" parser] ["[0]" function] ["[0]" maybe] - ["[0]" try] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["[0]" try]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" monoid)]] [macro [syntax (.only syntax)] - ["[0]" code]]]] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]]]] [// ["n" nat (.use "[1]#[0]" decimal)]]) diff --git a/stdlib/source/library/lux/meta/configuration.lux b/stdlib/source/library/lux/meta/configuration.lux index d52b60914..d0dea1e76 100644 --- a/stdlib/source/library/lux/meta/configuration.lux +++ b/stdlib/source/library/lux/meta/configuration.lux @@ -7,10 +7,9 @@ [monoid (.only Monoid)] [monad (.only do)]] [control + ["<>" parser] ["[0]" maybe (.use "[1]#[0]" functor)] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format] @@ -21,7 +20,8 @@ ["/" plist]]]] [macro [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex)]]]]) diff --git a/stdlib/source/library/lux/meta/version.lux b/stdlib/source/library/lux/meta/version.lux index da5d349bb..f7df8ac2f 100644 --- a/stdlib/source/library/lux/meta/version.lux +++ b/stdlib/source/library/lux/meta/version.lux @@ -5,16 +5,16 @@ [abstract [monad (.only do)]] [control - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" exception (.only exception)]] [data ["[0]" text (.use "[1]#[0]" equivalence)] [collection ["[0]" list (.use "[1]#[0]" mix)]]] [macro [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [tool [compiler [version (.only Version)]]]]]) diff --git a/stdlib/source/library/lux/program.lux b/stdlib/source/library/lux/program.lux index ca420eb9f..99fb1832e 100644 --- a/stdlib/source/library/lux/program.lux +++ b/stdlib/source/library/lux/program.lux @@ -9,11 +9,11 @@ [concurrency ["[0]" thread]] ["<>" parser (.only) - ["<[0]>" code] ["<[0]>" cli]]] [macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code]]]]) + ["[0]" code (.only) + ["<[1]>" \\parser]]]]]) (type Arguments (Variant diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux index 53426b0f8..a473f8288 100644 --- a/stdlib/source/library/lux/static.lux +++ b/stdlib/source/library/lux/static.lux @@ -5,14 +5,14 @@ [abstract [monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser]] [data [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] [macro [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex)] ["[0]" random (.only Random)]]]]) diff --git a/stdlib/source/library/lux/target/jvm/modifier.lux b/stdlib/source/library/lux/target/jvm/modifier.lux index 058027fab..ac45136d6 100644 --- a/stdlib/source/library/lux/target/jvm/modifier.lux +++ b/stdlib/source/library/lux/target/jvm/modifier.lux @@ -5,15 +5,15 @@ ["[0]" equivalence (.only Equivalence)] ["[0]" monoid (.only Monoid)]] [control - ["[0]" try] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" try]] [data ["[0]" binary ["[1]F" \\format (.only Writer)]]] [macro (.only with_symbols) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" number (.only hex) ["[0]" i64]]] diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux index 635117c5e..f12cfbac6 100644 --- a/stdlib/source/library/lux/target/lua.lux +++ b/stdlib/source/library/lux/target/lua.lux @@ -7,9 +7,7 @@ [hash (.only Hash)] ["[0]" enum]] [control - ["[0]" pipe] - [parser - ["<[0]>" code]]] + ["[0]" pipe]] [data ["[0]" text (.only) ["%" \\format (.only format)]] @@ -18,7 +16,8 @@ [macro [syntax (.only syntax)] ["[0]" template] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux index 99b0c1d3f..2ad1863b6 100644 --- a/stdlib/source/library/lux/target/php.lux +++ b/stdlib/source/library/lux/target/php.lux @@ -7,9 +7,7 @@ [hash (.only Hash)] ["[0]" enum]] [control - ["[0]" pipe] - [parser - ["<[0]>" code]]] + ["[0]" pipe]] [data ["[0]" text (.only) ["%" \\format (.only format)]] @@ -18,7 +16,8 @@ [macro [syntax (.only syntax)] ["[0]" template] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux index 1ce2789e7..ddc601161 100644 --- a/stdlib/source/library/lux/target/python.lux +++ b/stdlib/source/library/lux/target/python.lux @@ -8,9 +8,7 @@ [hash (.only Hash)] ["[0]" enum]] [control - ["[0]" pipe] - [parser - ["<[0]>" code]]] + ["[0]" pipe]] [data ["[0]" text (.only) ["%" \\format (.only format)]] @@ -19,7 +17,8 @@ [macro [syntax (.only syntax)] ["[0]" template] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux index 6ec808501..6d56eea58 100644 --- a/stdlib/source/library/lux/target/r.lux +++ b/stdlib/source/library/lux/target/r.lux @@ -4,9 +4,7 @@ [control ["[0]" pipe] ["[0]" function] - ["[0]" maybe (.use "[1]#[0]" functor)] - [parser - ["<[0]>" code]]] + ["[0]" maybe (.use "[1]#[0]" functor)]] [data ["[0]" text ["%" \\format (.only format)]] @@ -15,7 +13,8 @@ [macro [syntax (.only syntax)] ["[0]" template] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["f" frac]]] diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux index 980307456..5a5f5af9d 100644 --- a/stdlib/source/library/lux/target/ruby.lux +++ b/stdlib/source/library/lux/target/ruby.lux @@ -7,9 +7,7 @@ [hash (.only Hash)] ["[0]" enum]] [control - ["[0]" pipe] - [parser - ["<[0]>" code]]] + ["[0]" pipe]] [data ["[0]" text (.only) ["%" \\format (.only format)]] @@ -18,7 +16,8 @@ [macro [syntax (.only syntax)] ["[0]" template] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux index b7cdc5ca7..110675c5d 100644 --- a/stdlib/source/library/lux/test.lux +++ b/stdlib/source/library/lux/test.lux @@ -6,6 +6,7 @@ [abstract ["[0]" monad (.only do)]] [control + ["<>" parser] ["[0]" pipe] ["[0]" maybe] ["[0]" try] @@ -13,9 +14,7 @@ ["[0]" io] [concurrency ["[0]" atom (.only Atom)] - ["[0]" async (.only Async) (.use "[1]#[0]" monad)]] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" async (.only Async) (.use "[1]#[0]" monad)]]] [data ["[0]" product] ["[0]" text (.only) @@ -35,7 +34,8 @@ ["f" frac]]] [macro [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] ["[0]" meta (.only) ["[0]" symbol]] [world diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux index 81d6ccdf5..c3ccd43e9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux @@ -9,9 +9,7 @@ ["[0]" function] ["[0]" maybe] ["[0]" try (.only Try)] - ["[0]" exception (.only Exception)] - [parser - ["<[0]>" code]]] + ["[0]" exception (.only Exception)]] [data ["[0]" product] ["[0]" bit (.use "[1]#[0]" equivalence)] @@ -20,7 +18,9 @@ [collection ["[0]" list (.use "[1]#[0]" functor mix)]]] [macro - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code + ["<[1]>" \\parser]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/common_lisp.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/common_lisp.lux index 5e7529857..377ce23c4 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/common_lisp.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/common_lisp.lux @@ -1,32 +1,10 @@ (.require [library - [lux (.except) - ["[0]" ffi] - [abstract - ["[0]" monad (.only do)]] - [control - ["<>" parser (.only) - ["" code (.only Parser)]]] - [data - [collection - ["[0]" array (.only Array)] - ["[0]" dictionary] - ["[0]" list]]] - ["[0]" type (.only) - ["[0]" check]] - ["@" target - ["_" common_lisp]]]] - [// - ["/" lux (.only custom)] - [// - ["[0]" bundle] - [// - ["[0]" analysis - ["[1]/[0]" type]] - [// - ["[0]" analysis (.only Analysis Operation Phase Handler Bundle)] - [/// - ["[0]" phase]]]]]]) + [lux (.except)]] + [/// + ["[0]" bundle] + [/// + [analysis (.only Bundle)]]]) (def .public bundle Bundle diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux index af44a8272..102e5adcf 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/js.lux @@ -5,13 +5,15 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" array] ["[0]" dictionary] ["[0]" list]]] + [macro + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] ["[0]" type (.only) ["[0]" check]] ["@" target (.only) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux index 32ca3161d..16cb9e777 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux @@ -7,12 +7,11 @@ ["[0]" monad (.only do)] ["[0]" predicate]] [control + ["<>" parser] ["[0]" pipe] ["[0]" maybe (.use "[1]#[0]" functor)] ["[0]" try (.only Try) (.use "[1]#[0]" monad)] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["[0]" exception (.only exception)]] [data [binary (.only Binary) ["[0]" \\format]] @@ -27,7 +26,9 @@ ["[0]" sequence]]] [macro ["^" pattern] - ["[0]" template]] + ["[0]" template] + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux index b507b7a15..3c0e4cc86 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lua.lux @@ -5,13 +5,15 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" array] ["[0]" dictionary] ["[0]" list]]] + [macro + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] ["[0]" type (.only) ["[0]" check]] ["@" target (.only) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index 448735394..75e4e8516 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -4,11 +4,10 @@ [abstract ["[0]" monad (.only do)]] [control + ["<>" parser] ["[0]" maybe] ["[0]" try] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["[0]" exception (.only exception)]] [data ["[0]" text (.only) ["%" \\format (.only format)]] @@ -16,7 +15,9 @@ ["[0]" list (.use "[1]#[0]" functor)] ["[0]" dictionary (.only Dictionary)]]] [macro - ["^" pattern]] + ["^" pattern] + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux index 27e096e18..3852d2b24 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/php.lux @@ -5,13 +5,15 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" array (.only Array)] ["[0]" dictionary] ["[0]" list]]] + [macro + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] ["[0]" type (.only) ["[0]" check]] ["@" target (.only) @@ -31,7 +33,7 @@ (def array::new Handler (custom - [.any + [.any (function (_ extension phase archive lengthC) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -44,7 +46,7 @@ (def array::length Handler (custom - [.any + [.any (function (_ extension phase archive arrayC) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -57,7 +59,7 @@ (def array::read Handler (custom - [(<>.and .any .any) + [(<>.and .any .any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -72,7 +74,7 @@ (def array::write Handler (custom - [(all <>.and .any .any .any) + [(all <>.and .any .any .any) (function (_ extension phase archive [indexC valueC arrayC]) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -89,7 +91,7 @@ (def array::delete Handler (custom - [(all <>.and .any .any) + [(all <>.and .any .any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -127,7 +129,7 @@ (def object::new Handler (custom - [(all <>.and .text (<>.some .any)) + [(all <>.and .text (<>.some .any)) (function (_ extension phase archive [constructor inputsC]) (do [! phase.monad] [inputsA (monad.each ! (|>> (phase archive) (analysis/type.with_type Any)) inputsC) @@ -137,7 +139,7 @@ (def object::get Handler (custom - [(all <>.and .text .any) + [(all <>.and .text .any) (function (_ extension phase archive [fieldC objectC]) (do phase.monad [objectA (analysis/type.with_type ..Object @@ -149,7 +151,7 @@ (def object::do Handler (custom - [(all <>.and .text .any (<>.some .any)) + [(all <>.and .text .any (<>.some .any)) (function (_ extension phase archive [methodC objectC inputsC]) (do [! phase.monad] [objectA (analysis/type.with_type ..Object @@ -174,7 +176,7 @@ (def php::constant Handler (custom - [.text + [.text (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] @@ -183,7 +185,7 @@ (def php::apply Handler (custom - [(all <>.and .any (<>.some .any)) + [(all <>.and .any (<>.some .any)) (function (_ extension phase archive [abstractionC inputsC]) (do [! phase.monad] [abstractionA (analysis/type.with_type ..Function @@ -195,7 +197,7 @@ (def php::pack Handler (custom - [(all <>.and .any .any) + [(all <>.and .any .any) (function (_ extension phase archive [formatC dataC]) (do [! phase.monad] [formatA (analysis/type.with_type Text diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux index d44c8f5de..3c6e4b452 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/python.lux @@ -5,13 +5,15 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" array] ["[0]" dictionary] ["[0]" list]]] + [macro + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] ["[0]" type (.only) ["[0]" check]] ["@" target (.only) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/r.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/r.lux index c499e23d8..a53133555 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/r.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/r.lux @@ -5,13 +5,15 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" array (.only Array)] ["[0]" dictionary] ["[0]" list]]] + [macro + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] ["[0]" type (.only) ["[0]" check]] ["@" target diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux index b43fb8c4f..3029aec9d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/ruby.lux @@ -5,13 +5,15 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" array] ["[0]" dictionary] ["[0]" list]]] + [macro + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] ["[0]" type (.only) ["[0]" check]] ["@" target (.only) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux index 0220eb1f4..bf1493940 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/scheme.lux @@ -5,13 +5,15 @@ [abstract ["[0]" monad (.only do)]] [control - ["<>" parser (.only) - ["" code (.only Parser)]]] + ["<>" parser]] [data [collection ["[0]" array (.only Array)] ["[0]" dictionary] ["[0]" list]]] + [macro + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] ["[0]" type (.only) ["[0]" check]] ["@" target (.only) @@ -31,7 +33,7 @@ (def array::new Handler (custom - [.any + [.any (function (_ extension phase archive lengthC) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -44,7 +46,7 @@ (def array::length Handler (custom - [.any + [.any (function (_ extension phase archive arrayC) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -57,7 +59,7 @@ (def array::read Handler (custom - [(<>.and .any .any) + [(<>.and .any .any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -72,7 +74,7 @@ (def array::write Handler (custom - [(all <>.and .any .any .any) + [(all <>.and .any .any .any) (function (_ extension phase archive [indexC valueC arrayC]) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -89,7 +91,7 @@ (def array::delete Handler (custom - [(all <>.and .any .any) + [(all <>.and .any .any) (function (_ extension phase archive [indexC arrayC]) (<| analysis/type.with_var (function (_ [@var :var:])) @@ -131,7 +133,7 @@ (def scheme::constant Handler (custom - [.text + [.text (function (_ extension phase archive name) (do phase.monad [_ (analysis/type.infer Any)] @@ -140,7 +142,7 @@ (def scheme::apply Handler (custom - [(all <>.and .any (<>.some .any)) + [(all <>.and .any (<>.some .any)) (function (_ extension phase archive [abstractionC inputsC]) (do [! phase.monad] [abstractionA (analysis/type.with_type ..Function diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux index e2833a6c1..05da344e7 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux @@ -5,11 +5,10 @@ [abstract ["[0]" monad (.only do)]] [control + ["<>" parser (.use "[1]#[0]" monad)] ["[0]" pipe] ["[0]" try (.only Try) (.use "[1]#[0]" functor)] - ["[0]" exception] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]] + ["[0]" exception]] [data ["[0]" product] [binary (.only Binary) @@ -24,7 +23,9 @@ ["[0]" set (.only Set)]]] [macro ["^" pattern] - ["[0]" template]] + ["[0]" template] + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index 20f7aa448..0d02b109f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -7,11 +7,10 @@ ["[0]" monad (.only do)]] [control [io (.only IO)] + ["<>" parser] ["[0]" maybe (.use "[1]#[0]" functor)] ["[0]" try] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["[0]" exception (.only exception)]] [data ["[0]" binary] ["[0]" product] @@ -24,7 +23,8 @@ ["[0]" set (.only Set)]]] [macro ["^" pattern] - ["[0]" code]] + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux index 25e2a8d21..42c75531d 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux @@ -5,9 +5,8 @@ [abstract ["[0]" monad (.only do)]] [control - ["[0]" function] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" function]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" hash) @@ -18,7 +17,8 @@ ["[0]" sequence]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex) ["[0]" i64]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux index 5e96d3ec3..75cb5a86e 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/extension.lux @@ -3,16 +3,14 @@ [lux (.except) [abstract ["[0]" monad (.only do)]] - [control - [parser - ["<[0]>" code]]] [data [collection ["[0]" list (.use "[1]#[0]" functor)]]] ["[0]" meta] ["[0]" macro (.only with_symbols) - ["[0]" code] - [syntax (.only syntax)]]]] + [syntax (.only syntax)] + ["[0]" code (.only) + ["<[1]>" \\parser]]]]] ["[0]" /// ["[1][0]" extension] [// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux index 45ec51f44..3eaadc3f5 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux @@ -5,9 +5,8 @@ [abstract ["[0]" monad (.only do)]] [control - ["[0]" function] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" function]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" hash) @@ -19,7 +18,8 @@ ["[0]" sequence]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex) ["[0]" i64]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux index 1e9b333c4..f7fb63f10 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux @@ -5,9 +5,8 @@ [abstract ["[0]" monad (.only do)]] [control - ["[0]" function] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" function]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" hash) @@ -19,7 +18,8 @@ ["[0]" sequence]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex) ["[0]" i64]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux index c1867a620..1254f50bc 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux @@ -5,9 +5,8 @@ [abstract ["[0]" monad (.only do)]] [control - ["[0]" function] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" function]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" hash) @@ -19,7 +18,8 @@ ["[0]" sequence]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex) ["[0]" i64]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux index 40b7ebd56..dfef07d7c 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux @@ -4,9 +4,8 @@ [abstract ["[0]" monad (.only do)]] [control - ["[0]" function] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" function]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" hash) @@ -18,7 +17,8 @@ ["[0]" sequence]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex) ["f" frac] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux index 69fff57bc..089bdf2b9 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux @@ -5,9 +5,8 @@ [abstract ["[0]" monad (.only do)]] [control - ["[0]" function] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" function]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" hash) @@ -19,7 +18,8 @@ ["[0]" sequence]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex) ["n" nat] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux index 4754c861b..74261ccc3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux @@ -5,9 +5,8 @@ [abstract ["[0]" monad (.only do)]] [control - ["[0]" function] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" function]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" hash) @@ -19,7 +18,8 @@ ["[0]" sequence]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex) ["[0]" i64] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux index bbb7db4e9..a99e83f84 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/extension/common.lux @@ -3,9 +3,6 @@ [lux (.except) [abstract ["[0]" monad (.only do)]] - [control - [parser - ["<[0]>" code]]] [data ["[0]" product] ["[0]" text] @@ -15,8 +12,9 @@ ["[0]" list (.use "[1]#[0]" functor)] ["dict" dictionary (.only Dictionary)]]] ["[0]" macro (.only with_symbols) - ["[0]" code] - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [target ["_" scheme (.only Expression Computation)]]]] ["[0]" /// diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux index 35e49dc7e..0b287568a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux @@ -5,9 +5,8 @@ [abstract ["[0]" monad (.only do)]] [control - ["[0]" function] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" function]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" hash) @@ -19,7 +18,8 @@ ["[0]" sequence]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex) ["[0]" i64]]] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux index 1e1e062eb..7b31c9a0a 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux @@ -31,10 +31,9 @@ [abstract [monad (.only do)]] [control + ["<>" parser] ["[0]" maybe] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [data ["[0]" text (.only) [\\parser (.only Offset)] @@ -44,7 +43,9 @@ ["[0]" dictionary (.only Dictionary)]]] [macro [syntax (.only syntax)] - ["[0]" template]] + ["[0]" template] + ["[0]" code + ["<[1]>" \\parser]]] [meta ["[0]" symbol]] [math diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux index ac1e01df2..00afaddc0 100644 --- a/stdlib/source/library/lux/type.lux +++ b/stdlib/source/library/lux/type.lux @@ -6,10 +6,9 @@ [equivalence (.only Equivalence)] [monad (.only Monad do)]] [control + ["<>" parser] ["[0]" function] - ["[0]" maybe] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["[0]" maybe]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" monoid equivalence)] @@ -19,7 +18,8 @@ ["[0]" macro (.only) [syntax (.only syntax)] ["^" pattern] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat (.use "[1]#[0]" decimal)]]] diff --git a/stdlib/source/library/lux/type/dynamic.lux b/stdlib/source/library/lux/type/dynamic.lux index 9afa8f395..fd98afcdf 100644 --- a/stdlib/source/library/lux/type/dynamic.lux +++ b/stdlib/source/library/lux/type/dynamic.lux @@ -4,14 +4,14 @@ ["[0]" debug] [control ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] - [parser - ["<[0]>" code]]] + ["[0]" exception (.only exception)]] [data [text ["%" \\format]]] [macro (.only with_symbols) - ["[0]" syntax (.only syntax)]] + ["[0]" syntax (.only syntax)] + ["[0]" code + ["<[1]>" \\parser]]] ["[0]" type (.only) ["[0]" primitive (.only primitive)]]]]) diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux index 3b330f2c1..f831c551b 100644 --- a/stdlib/source/library/lux/type/implicit.lux +++ b/stdlib/source/library/lux/type/implicit.lux @@ -5,10 +5,9 @@ ["[0]" monad (.only do)] ["[0]" equivalence]] [control + ["<>" parser] ["[0]" maybe] - ["[0]" try] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["[0]" try]] [data ["[0]" product] ["[0]" text (.use "[1]#[0]" equivalence) @@ -17,8 +16,9 @@ ["[0]" list (.use "[1]#[0]" monad mix)] ["[0]" dictionary (.only Dictionary)]]] ["[0]" macro (.only) - ["[0]" code] - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [math ["[0]" number (.only) ["n" nat]]] diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/type/poly.lux index 1555bfe9a..4f70bb937 100644 --- a/stdlib/source/library/lux/type/poly.lux +++ b/stdlib/source/library/lux/type/poly.lux @@ -2,14 +2,11 @@ [library [lux (.except) ["[0]" meta] - ["[0]" type] [abstract ["[0]" monad (.only do)]] [control - ["[0]" maybe] - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" type (.only Env)] - ["<[0]>" code (.only Parser)]]] + ["<>" parser (.use "[1]#[0]" monad)] + ["[0]" maybe]] [data ["[0]" product] ["[0]" text] @@ -19,10 +16,13 @@ [macro (.only with_symbols) [syntax (.only syntax)] ["^" pattern] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [math [number - ["n" nat]]]]]) + ["n" nat]]] + ["[0]" type (.only) + ["<[1]>" \\parser (.only Env)]]]]) (def .public polytypic (syntax (_ [name .local diff --git a/stdlib/source/library/lux/type/primitive.lux b/stdlib/source/library/lux/type/primitive.lux index c7d4a147a..50c288e1c 100644 --- a/stdlib/source/library/lux/type/primitive.lux +++ b/stdlib/source/library/lux/type/primitive.lux @@ -5,16 +5,16 @@ [abstract [monad (.only do)]] [control - ["<>" parser (.use "[1]#[0]" monad) - ["<[0]>" code (.only Parser)]]] + ["<>" parser (.use "[1]#[0]" monad)]] [data ["[0]" text (.use "[1]#[0]" equivalence)] [collection ["[0]" list (.use "[1]#[0]" functor)]]] ["[0]" macro (.only) ["^" pattern] - ["[0]" code] ["[0]" context] + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]] [syntax (.only syntax) ["|[0]|" export]]] [meta diff --git a/stdlib/source/library/lux/type/quotient.lux b/stdlib/source/library/lux/type/quotient.lux index 8e96bfd3b..98292553c 100644 --- a/stdlib/source/library/lux/type/quotient.lux +++ b/stdlib/source/library/lux/type/quotient.lux @@ -3,11 +3,10 @@ [lux (.except type) [abstract [equivalence (only Equivalence)]] - [control - [parser - ["<[0]>" code]]] [macro (.only with_symbols) - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code + ["<[1]>" \\parser]]] ["[0]" type [primitive (.except)]]]]) diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux index a4054407c..3a7a2ef85 100644 --- a/stdlib/source/library/lux/type/refinement.lux +++ b/stdlib/source/library/lux/type/refinement.lux @@ -3,11 +3,10 @@ [lux (.except only type) [abstract [predicate (.only Predicate)]] - [control - [parser - ["<[0]>" code]]] ["[0]" macro (.only) - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code + ["<[1]>" \\parser]]] ["[0]" type (.only) [primitive (.except)]]]]) diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux index 6a35b1567..760f07dc2 100644 --- a/stdlib/source/library/lux/type/resource.lux +++ b/stdlib/source/library/lux/type/resource.lux @@ -6,10 +6,9 @@ ["[0]" monad (.only Monad do) [indexed (.only IxMonad)]]] [control + ["<>" parser] ["[0]" maybe] - ["[0]" exception (.only exception)] - ["<>" parser (.only) - ["<[0]>" code (.only Parser)]]] + ["[0]" exception (.only exception)]] [data [text ["%" \\format (.only format)]] @@ -18,7 +17,9 @@ ["[0]" sequence (.only Sequence)] ["[0]" list (.use "[1]#[0]" functor mix)]]] ["[0]" macro (.only) - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code + ["<[1]>" \\parser (.only Parser)]]] [math [number ["n" nat]]] diff --git a/stdlib/source/library/lux/type/unit.lux b/stdlib/source/library/lux/type/unit.lux index bcc8f672c..e7327e551 100644 --- a/stdlib/source/library/lux/type/unit.lux +++ b/stdlib/source/library/lux/type/unit.lux @@ -5,11 +5,10 @@ [equivalence (.only Equivalence)] [order (.only Order)] [enum (.only Enum)]] - [control - [parser - ["<[0]>" code]]] ["[0]" macro (.only) - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code + ["<[1]>" \\parser]]] [math [number ["i" int]]]]] diff --git a/stdlib/source/library/lux/type/unit/scale.lux b/stdlib/source/library/lux/type/unit/scale.lux index 9eacbb81b..e88ee83e8 100644 --- a/stdlib/source/library/lux/type/unit/scale.lux +++ b/stdlib/source/library/lux/type/unit/scale.lux @@ -1,11 +1,11 @@ (.require [library [lux (.except type) - [control - [parser - ["<[0]>" code]]] + [control] ["[0]" macro (.only) - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code + ["<[1]>" \\parser]]] [math [number ["i" int] diff --git a/stdlib/source/library/lux/world/net/http/client.lux b/stdlib/source/library/lux/world/net/http/client.lux index 832ff6f23..52812a399 100644 --- a/stdlib/source/library/lux/world/net/http/client.lux +++ b/stdlib/source/library/lux/world/net/http/client.lux @@ -11,9 +11,7 @@ ["[0]" maybe (.use "[1]#[0]" functor)] ["[0]" try (.only Try)] [concurrency - ["[0]" async (.only Async)]] - [parser - ["<[0]>" code]]] + ["[0]" async (.only Async)]]] [data ["[0]" binary (.only Binary)] ["[0]" text] @@ -21,8 +19,9 @@ ["[0]" dictionary]]] [macro [syntax (.only syntax)] - ["[0]" code] - ["[0]" template]] + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["n" nat] diff --git a/stdlib/source/parser/lux/macro/code.lux b/stdlib/source/parser/lux/macro/code.lux new file mode 100644 index 000000000..85490e2d0 --- /dev/null +++ b/stdlib/source/parser/lux/macro/code.lux @@ -0,0 +1,226 @@ +(.require + [library + [lux (.except nat int rev local not symbol local global) + [abstract + ["[0]" monad (.only do)]] + [control + ["//" parser] + ["[0]" try (.only Try)]] + [data + ["[0]" bit] + ["[0]" text (.use "[1]#[0]" monoid)] + [collection + ["[0]" list (.use "[1]#[0]" functor)]]] + [macro + ["[0]" code (.use "[1]#[0]" equivalence)]] + [math + [number + ["[0]" nat] + ["[0]" int] + ["[0]" rev] + ["[0]" frac]]] + [meta + ["[0]" symbol]]]]) + +(def (un_paired pairs) + (All (_ a) (-> (List [a a]) (List a))) + (case pairs + {.#End} + {.#End} + + {.#Item [[x y] pairs']} + (list.partial x y (un_paired pairs')))) + +(type .public Parser + (//.Parser (List Code))) + +(def remaining_inputs + (-> (List Code) Text) + (|>> (list#each code.format) + (text.interposed " ") + (all text#composite text.new_line "Remaining input: "))) + +(def .public any + (Parser Code) + (function (_ tokens) + (case tokens + {.#End} + {try.#Failure "There are no tokens to parse!"} + + {.#Item [t tokens']} + {try.#Success [tokens' t]}))) + +(def .public next + (Parser Code) + (function (_ tokens) + (case tokens + {.#End} + {try.#Failure "There are no tokens to parse!"} + + {.#Item next _} + {try.#Success [tokens next]}))) + +(with_template [ ] + [(with_expansions [ (these {try.#Failure (all text#composite "Cannot parse " (remaining_inputs tokens))})] + (def .public + (Parser ) + (function (_ tokens) + (case tokens + {.#Item [[_ { x}] tokens']} + {try.#Success [tokens' x]} + + _ + ))) + + (def .public ( expected) + (-> (Parser Any)) + (function (_ tokens) + (case tokens + {.#Item [[_ { actual}] tokens']} + (if (at = expected actual) + {try.#Success [tokens' []]} + ) + + _ + ))))] + + [bit this_bit Bit .#Bit bit.equivalence "bit"] + [nat this_nat Nat .#Nat nat.equivalence "nat"] + [int this_int Int .#Int int.equivalence "int"] + [rev this_rev Rev .#Rev rev.equivalence "rev"] + [frac this_frac Frac .#Frac frac.equivalence "frac"] + [text this_text Text .#Text text.equivalence "text"] + [symbol this_symbol Symbol .#Symbol symbol.equivalence "symbol"] + ) + +(def .public (this code) + (-> Code (Parser Any)) + (function (_ tokens) + (case tokens + {.#Item [token tokens']} + (if (code#= code token) + {try.#Success [tokens' []]} + {try.#Failure (all text#composite "Expected a " (code.format code) " but instead got " (code.format token) + (remaining_inputs tokens))}) + + _ + {try.#Failure "There are no tokens to parse!"}))) + +(with_expansions [ (these {try.#Failure (all text#composite "Cannot parse local symbol" (remaining_inputs tokens))})] + (def .public local + (Parser Text) + (function (_ tokens) + (case tokens + {.#Item [[_ {.#Symbol ["" x]}] tokens']} + {try.#Success [tokens' x]} + + _ + ))) + + (def .public (this_local expected) + (-> Text (Parser Any)) + (function (_ tokens) + (case tokens + {.#Item [[_ {.#Symbol ["" actual]}] tokens']} + (if (at text.equivalence = expected actual) + {try.#Success [tokens' []]} + ) + + _ + )))) + +(with_expansions [ (these {try.#Failure (all text#composite "Cannot parse local symbol" (remaining_inputs tokens))})] + (def .public global + (Parser Symbol) + (function (_ tokens) + (case tokens + {.#Item [[_ {.#Symbol ["" short]}] tokens']} + + + {.#Item [[_ {.#Symbol it}] tokens']} + {try.#Success [tokens' it]} + + _ + ))) + + (def .public (this_global expected) + (-> Symbol (Parser Any)) + (function (_ tokens) + (case tokens + {.#Item [[_ {.#Symbol ["" actual]}] tokens']} + + + {.#Item [[_ {.#Symbol it}] tokens']} + (if (at symbol.equivalence = expected it) + {try.#Success [tokens' []]} + ) + + _ + )))) + +(with_template [ ] + [(def .public ( p) + (All (_ a) + (-> (Parser a) (Parser a))) + (function (_ tokens) + (case tokens + {.#Item [[_ { members}] tokens']} + (case (p members) + {try.#Success [{.#End} x]} {try.#Success [tokens' x]} + _ {try.#Failure (all text#composite "Parser was expected to fully consume " (remaining_inputs tokens))}) + + _ + {try.#Failure (all text#composite "Cannot parse " (remaining_inputs tokens))})))] + + [form .#Form "form"] + [variant .#Variant "variant"] + [tuple .#Tuple "tuple"] + ) + +(def .public end + (Parser Any) + (function (_ tokens) + (case tokens + {.#End} {try.#Success [tokens []]} + _ {try.#Failure (all text#composite "Expected list of tokens to be empty!" (remaining_inputs tokens))}))) + +(def .public end? + (Parser Bit) + (function (_ tokens) + {try.#Success [tokens (case tokens + {.#End} true + _ false)]})) + +(def .public (result parser inputs) + (All (_ a) (-> (Parser a) (List Code) (Try a))) + (case (parser inputs) + {try.#Failure error} + {try.#Failure error} + + {try.#Success [unconsumed value]} + (case unconsumed + {.#End} + {try.#Success value} + + _ + {try.#Failure (|> unconsumed + (list#each code.format) + (text.interposed ", ") + (text#composite "Unconsumed inputs: "))}))) + +(def .public (locally inputs parser) + (All (_ a) (-> (List Code) (Parser a) (Parser a))) + (function (_ real) + (do try.monad + [value (..result parser inputs)] + (in [real value])))) + +(def .public (not parser) + (All (_ a) (-> (Parser a) (Parser Code))) + (do //.monad + [sample ..next + result (//.or parser + ..any)] + (case result + {.#Left _} (//.failure (text#composite "Did NOT expect to parse code: " (code.format sample))) + {.#Right output} (in output)))) diff --git a/stdlib/source/parser/lux/type.lux b/stdlib/source/parser/lux/type.lux new file mode 100644 index 000000000..a107a1778 --- /dev/null +++ b/stdlib/source/parser/lux/type.lux @@ -0,0 +1,350 @@ +(.require + [library + [lux (.except function local parameter) + [abstract + ["[0]" monad (.only do)]] + [control + ["//" parser] + ["[0]" try (.only Try)] + ["[0]" exception (.only exception)] + ["[0]" function]] + [data + ["[0]" text (.use "[1]#[0]" monoid) + ["%" \\format (.only format)]] + [collection + ["[0]" list (.use "[1]#[0]" functor)] + ["[0]" dictionary (.only Dictionary)]]] + [macro + ["^" pattern] + ["[0]" code]] + [math + [number + ["n" nat (.use "[1]#[0]" decimal)]]] + ["[0]" type (.use "[1]#[0]" equivalence) + ["[0]" check]]]]) + +(def |recursion_dummy| + (template (|recursion_dummy|) + [{.#Primitive "" {.#End}}])) + +(with_template [] + [(exception .public ( [type Type]) + (exception.report + "Type" (%.type type)))] + + [not_existential] + [not_recursive] + [not_named] + [not_parameter] + [unknown_parameter] + [not_function] + [not_application] + [not_polymorphic] + [not_variant] + [not_tuple] + ) + +(with_template [] + [(exception .public ( [expected Type + actual Type]) + (exception.report + "Expected" (%.type expected) + "Actual" (%.type actual)))] + + [types_do_not_match] + [wrong_parameter] + ) + +(exception .public empty_input) + +(exception .public (unconsumed_input [remaining (List Type)]) + (exception.report + "Types" (|> remaining + (list#each (|>> %.type (format text.new_line "* "))) + (text.interposed "")))) + +(type .public Env + (Dictionary Nat [Type Code])) + +(type .public (Parser a) + (//.Parser [Env (List Type)] a)) + +(def .public fresh + Env + (dictionary.empty n.hash)) + +(def (result' env poly types) + (All (_ a) (-> Env (Parser a) (List Type) (Try a))) + (case (//.result poly [env types]) + {try.#Failure error} + {try.#Failure error} + + {try.#Success [[env' remaining] output]} + (case remaining + {.#End} + {try.#Success output} + + _ + (exception.except ..unconsumed_input remaining)))) + +(def .public (result poly type) + (All (_ a) (-> (Parser a) Type (Try a))) + (result' ..fresh poly (list type))) + +(def .public env + (Parser Env) + (.function (_ [env inputs]) + {try.#Success [[env inputs] env]})) + +(def (with_env temp poly) + (All (_ a) (-> Env (Parser a) (Parser a))) + (.function (_ [env inputs]) + (case (//.result poly [temp inputs]) + {try.#Failure error} + {try.#Failure error} + + {try.#Success [[_ remaining] output]} + {try.#Success [[env remaining] output]}))) + +(def .public next + (Parser Type) + (.function (_ [env inputs]) + (case inputs + {.#End} + (exception.except ..empty_input []) + + {.#Item headT tail} + {try.#Success [[env inputs] headT]}))) + +(def .public any + (Parser Type) + (.function (_ [env inputs]) + (case inputs + {.#End} + (exception.except ..empty_input []) + + {.#Item headT tail} + {try.#Success [[env tail] headT]}))) + +(def .public (local types poly) + (All (_ a) (-> (List Type) (Parser a) (Parser a))) + (.function (_ [env pass_through]) + (case (result' env poly types) + {try.#Failure error} + {try.#Failure error} + + {try.#Success output} + {try.#Success [[env pass_through] output]}))) + +(def (label idx) + (-> Nat Code) + (code.local (all text#composite "label" text.tab (n#encoded idx)))) + +(def .public (with_extension type poly) + (All (_ a) (-> Type (Parser a) (Parser [Code a]))) + (.function (_ [env inputs]) + (let [current_id (dictionary.size env) + g!var (label current_id)] + (case (//.result poly + [(dictionary.has current_id [type g!var] env) + inputs]) + {try.#Failure error} + {try.#Failure error} + + {try.#Success [[_ inputs'] output]} + {try.#Success [[env inputs'] [g!var output]]})))) + +(with_template [ ] + [(`` (def .public ( poly) + (All (_ a) (-> (Parser a) (Parser a))) + (do //.monad + [headT ..any] + (let [members ( (type.anonymous headT))] + (if (n.> 1 (list.size members)) + (local members poly) + (//.failure (exception.error headT)))))))] + + [variant type.flat_variant ..not_variant] + [tuple type.flat_tuple ..not_tuple] + ) + +(def polymorphic' + (Parser [Nat Type]) + (do //.monad + [headT any + .let [[num_arg bodyT] (type.flat_univ_q (type.anonymous headT))]] + (if (n.= 0 num_arg) + (//.failure (exception.error ..not_polymorphic headT)) + (in [num_arg bodyT])))) + +(def .public (polymorphic poly) + (All (_ a) (-> (Parser a) (Parser [Code (List Code) a]))) + (do [! //.monad] + [headT any + funcI (at ! each dictionary.size ..env) + [num_args non_poly] (local (list headT) ..polymorphic') + env ..env + .let [funcL (label funcI) + [all_varsL env'] (loop (again [current_arg 0 + env' env + all_varsL (is (List Code) (list))]) + (if (n.< num_args current_arg) + (if (n.= 0 current_arg) + (let [varL (label (++ funcI))] + (again (++ current_arg) + (|> env' + (dictionary.has funcI [headT funcL]) + (dictionary.has (++ funcI) [{.#Parameter (++ funcI)} varL])) + {.#Item varL all_varsL})) + (let [partialI (|> current_arg (n.* 2) (n.+ funcI)) + partial_varI (++ partialI) + partial_varL (label partial_varI) + partialC (` ((~ funcL) (~+ (|> (list.indices num_args) + (list#each (|>> (n.* 2) ++ (n.+ funcI) label)) + list.reversed))))] + (again (++ current_arg) + (|> env' + (dictionary.has partialI [(|recursion_dummy|) partialC]) + (dictionary.has partial_varI [{.#Parameter partial_varI} partial_varL])) + {.#Item partial_varL all_varsL}))) + [all_varsL env']))]] + (<| (with_env env') + (local (list non_poly)) + (do ! + [output poly] + (in [funcL all_varsL output]))))) + +(def .public (function in_poly out_poly) + (All (_ i o) (-> (Parser i) (Parser o) (Parser [i o]))) + (do //.monad + [headT any + .let [[inputsT outputT] (type.flat_function (type.anonymous headT))]] + (if (n.> 0 (list.size inputsT)) + (//.and (local inputsT in_poly) + (local (list outputT) out_poly)) + (//.failure (exception.error ..not_function headT))))) + +(def .public (applied poly) + (All (_ a) (-> (Parser a) (Parser a))) + (do //.monad + [headT any + .let [[funcT paramsT] (type.flat_application (type.anonymous headT))]] + (if (n.= 0 (list.size paramsT)) + (//.failure (exception.error ..not_application headT)) + (..local {.#Item funcT paramsT} poly)))) + +(with_template [ ] + [(def .public ( expected) + (-> Type (Parser Any)) + (do //.monad + [actual any] + (if ( expected actual) + (in []) + (//.failure (exception.error ..types_do_not_match [expected actual])))))] + + [exactly type#=] + [sub check.subsumes?] + [super (function.flipped check.subsumes?)] + ) + +(def .public (argument env idx) + (-> Env Nat Nat) + (let [env_level (n./ 2 (dictionary.size env)) + parameter_level (n./ 2 idx) + parameter_idx (n.% 2 idx)] + (|> env_level -- (n.- parameter_level) (n.* 2) (n.+ parameter_idx)))) + +(def .public parameter + (Parser Code) + (do //.monad + [env ..env + headT any] + (case headT + {.#Parameter idx} + (case (dictionary.value (..argument env idx) env) + {.#Some [poly_type poly_code]} + (in poly_code) + + {.#None} + (//.failure (exception.error ..unknown_parameter headT))) + + _ + (//.failure (exception.error ..not_parameter headT))))) + +(def .public (this_parameter id) + (-> Nat (Parser Any)) + (do //.monad + [env ..env + headT any] + (case headT + {.#Parameter idx} + (if (n.= id (..argument env idx)) + (in []) + (//.failure (exception.error ..wrong_parameter [{.#Parameter id} headT]))) + + _ + (//.failure (exception.error ..not_parameter headT))))) + +(def .public existential + (Parser Nat) + (do //.monad + [headT any] + (case headT + {.#Ex ex_id} + (in ex_id) + + _ + (//.failure (exception.error ..not_existential headT))))) + +(def .public named + (Parser [Symbol Type]) + (do //.monad + [inputT any] + (case inputT + {.#Named name anonymousT} + (in [name anonymousT]) + + _ + (//.failure (exception.error ..not_named inputT))))) + +(def .public (recursive poly) + (All (_ a) (-> (Parser a) (Parser [Code a]))) + (do [! //.monad] + [headT any] + (case (type.anonymous headT) + (pattern {.#Apply (|recursion_dummy|) {.#UnivQ _ headT'}}) + (do ! + [[recT _ output] (|> poly + (with_extension (|recursion_dummy|)) + (with_extension headT) + (local (list headT')))] + (in [recT output])) + + _ + (//.failure (exception.error ..not_recursive headT))))) + +(def .public recursive_self + (Parser Code) + (do //.monad + [env ..env + headT any] + (case (type.anonymous headT) + (^.multi (pattern {.#Apply (|recursion_dummy|) {.#Parameter funcT_idx}}) + (n.= 0 (..argument env funcT_idx)) + [(dictionary.value 0 env) {.#Some [self_type self_call]}]) + (in self_call) + + _ + (//.failure (exception.error ..not_recursive headT))))) + +(def .public recursive_call + (Parser Code) + (do [! //.monad] + [env ..env + [funcT argsT] (..applied (//.and any (//.many any))) + _ (local (list funcT) (..this_parameter 0)) + allC (let [allT (list.partial funcT argsT)] + (|> allT + (monad.each ! (function.constant ..parameter)) + (local allT)))] + (in (` ((~+ allC)))))) diff --git a/stdlib/source/polytypic/lux/abstract/equivalence.lux b/stdlib/source/polytypic/lux/abstract/equivalence.lux index fce8d86bd..3d8497e87 100644 --- a/stdlib/source/polytypic/lux/abstract/equivalence.lux +++ b/stdlib/source/polytypic/lux/abstract/equivalence.lux @@ -4,9 +4,8 @@ [abstract [monad (.only Monad do)]] [control - ["[0]" maybe] - ["<>" parser (.only) - ["<[0]>" type]]] + ["<>" parser] + ["[0]" maybe]] [data ["[0]" product] ["[0]" bit] @@ -35,6 +34,7 @@ ["[0]" day] ["[0]" month]] ["[0]" type (.only) + ["<[1]>" \\parser] ["[0]" poly (.only polytypic)] ["[0]" unit]]]] [\\library diff --git a/stdlib/source/polytypic/lux/abstract/functor.lux b/stdlib/source/polytypic/lux/abstract/functor.lux index 1ff6c0398..3cc3074b0 100644 --- a/stdlib/source/polytypic/lux/abstract/functor.lux +++ b/stdlib/source/polytypic/lux/abstract/functor.lux @@ -4,9 +4,7 @@ [abstract [monad (.only Monad do)]] [control - ["p" parser (.only) - ["<[0]>" type] - ["s" code (.only Parser)]]] + ["<>" parser]] [data ["[0]" product] ["[0]" text (.only) @@ -19,13 +17,14 @@ [number ["n" nat]]] ["[0]" type (.only) + ["<[1]>" \\parser] ["[0]" poly (.only polytypic)]]]] [\\library ["[0]" /]]) (def .public functor (polytypic functor - (do [! p.monad] + (do [! <>.monad] [.let [g!_ (code.local "____________") type_funcC (code.local "____________type_funcC") funcC (code.local "____________funcC") @@ -44,16 +43,16 @@ ((~! /.Functor) ((~ (poly.code *env* unwrappedT)) (~+ paramsC))))))))) Arg (is (-> Code (.Parser Code)) (function (Arg valueC) - (all p.either + (all <>.either ... Type-var - (do p.monad + (do <>.monad [.let [varI (|> num_vars (n.* 2) --)] _ (.this_parameter varI)] (in (` ((~ funcC) (~ valueC))))) ... Variants (do ! [_ (in []) - membersC (.variant (p.many (Arg valueC))) + membersC (.variant (<>.many (Arg valueC))) .let [last (-- (list.size membersC))]] (in (` (case (~ valueC) (~+ (list#conjoint (list#each (function (_ [tag memberC]) @@ -64,18 +63,18 @@ (` {(~ (code.nat tag)) #0 (~ memberC)})))) (list.enumeration membersC)))))))) ... Tuples - (do p.monad + (do <>.monad [pairsCC (is (.Parser (List [Code Code])) (.tuple (loop (again [idx 0 pairsCC (is (List [Code Code]) (list))]) - (p.either (let [slotC (|> idx %.nat (format "____________slot") code.local)] - (do ! - [_ (in []) - memberC (Arg slotC)] - (again (++ idx) - (list#composite pairsCC (list [slotC memberC]))))) - (in pairsCC)))))] + (<>.either (let [slotC (|> idx %.nat (format "____________slot") code.local)] + (do ! + [_ (in []) + memberC (Arg slotC)] + (again (++ idx) + (list#composite pairsCC (list [slotC memberC]))))) + (in pairsCC)))))] (in (` (case (~ valueC) [(~+ (list#each product.left pairsCC))] [(~+ (list#each product.right pairsCC))])))) @@ -84,7 +83,7 @@ [_ (in []) .let [g! (code.local "____________") outL (code.local "____________outL")] - [inT+ outC] (.function (p.many .any) + [inT+ outC] (.function (<>.many .any) (Arg outL)) .let [inC+ (|> (list.size inT+) list.indices @@ -93,18 +92,18 @@ (let [(~ outL) ((~ valueC) (~+ inC+))] (~ outC)))))) ... Recursion - (do p.monad + (do <>.monad [_ .recursive_call] (in (` ((~' each) (~ funcC) (~ valueC))))) ... Parameters - (do p.monad + (do <>.monad [_ .any] (in valueC)) )))] [_ _ outputC] (is (.Parser [Code (List Code) Code]) - (p.either (.polymorphic - (Arg inputC)) - (p.failure (format "Cannot create Functor for: " (%.type inputT)))))] + (<>.either (.polymorphic + (Arg inputC)) + (<>.failure (format "Cannot create Functor for: " (%.type inputT)))))] (in (` (is (~ (@Functor inputT)) (implementation (def ((~' each) (~ funcC) (~ inputC)) diff --git a/stdlib/source/polytypic/lux/data/format/json.lux b/stdlib/source/polytypic/lux/data/format/json.lux index 8ce7112e3..064e4bcce 100644 --- a/stdlib/source/polytypic/lux/data/format/json.lux +++ b/stdlib/source/polytypic/lux/data/format/json.lux @@ -5,10 +5,8 @@ [monad (.only do)] ["[0]" codec]] [control - ["[0]" try] - ["<>" parser (.only) - ["<[0]>" type] - ["<[0]>" code]]] + ["<>" parser] + ["[0]" try]] [data ["[0]" text (.only) ["%" \\format (.only format)]] @@ -21,7 +19,8 @@ ["[0]" dictionary]]] [macro [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number ["n" nat (.use "[1]#[0]" decimal)] @@ -35,6 +34,7 @@ ["[0]" day] ["[0]" month]] ["[0]" type (.only) + ["<[1]>" \\parser] ["[0]" unit] ["[0]" poly (.only polytypic)]]]] [\\library diff --git a/stdlib/source/program/aedifex/input.lux b/stdlib/source/program/aedifex/input.lux index 0cbe189b0..918c051b1 100644 --- a/stdlib/source/program/aedifex/input.lux +++ b/stdlib/source/program/aedifex/input.lux @@ -6,9 +6,7 @@ ["[0]" mix]] [control ["[0]" pipe] - ["[0]" try (.only Try)] - [parser - ["<[0]>" code]]] + ["[0]" try (.only Try)]] [data [binary (.only Binary)] ["[0]" text @@ -16,6 +14,9 @@ ["[0]" utf8]]] [collection ["[0]" list]]] + [macro + ["[0]" code (.only) + ["<[1]>" \\parser]]] [meta ["[0]" location]] [tool diff --git a/stdlib/source/program/aedifex/parser.lux b/stdlib/source/program/aedifex/parser.lux index 18a682362..30660e707 100644 --- a/stdlib/source/program/aedifex/parser.lux +++ b/stdlib/source/program/aedifex/parser.lux @@ -4,15 +4,17 @@ [abstract [monad (.only do)]] [control - ["[0]" maybe] - ["<>" parser (.use "[1]#[0]" functor) - ["<[0]>" code (.only Parser)]]] + ["<>" parser (.use "[1]#[0]" functor)] + ["[0]" maybe]] [data ["[0]" text] [collection ["[0]" set (.only Set)] ["[0]" dictionary (.only Dictionary) ["[0]" plist (.only PList)]]]] + [macro + ["[0]" code (.only) + ["<[1]>" \\parser (.only Parser)]]] [tool [compiler [meta diff --git a/stdlib/source/test/aedifex/parser.lux b/stdlib/source/test/aedifex/parser.lux index c07e675a4..cd49c6417 100644 --- a/stdlib/source/test/aedifex/parser.lux +++ b/stdlib/source/test/aedifex/parser.lux @@ -7,9 +7,7 @@ [hash (.only Hash)]] [control ["[0]" pipe] - ["[0]" try] - [parser - ["<[0]>" code]]] + ["[0]" try]] [data ["[0]" text] [collection @@ -21,7 +19,8 @@ [number ["n" nat]]] [macro - ["[0]" code]]]] + ["[0]" code (.only) + ["<[1]>" \\parser]]]]] [// ["@[0]" profile]] [\\program diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 35ba915da..7f9d94809 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -11,9 +11,7 @@ ["[0]" io] ["[0]" maybe (.use "[1]#[0]" functor)] [concurrency - ["[0]" atom (.only Atom)]] - [parser - ["<[0]>" code]]] + ["[0]" atom (.only Atom)]]] [data ["[0]" product] ["[0]" bit (.use "[1]#[0]" equivalence)] @@ -27,8 +25,9 @@ ["[0]" macro (.only) [syntax (.only syntax)] ["^" pattern] - ["[0]" code (.use "[1]#[0]" equivalence)] - ["[0]" template]] + ["[0]" template] + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]] ["[0]" math ["[0]" random (.use "[1]#[0]" functor)] [number @@ -464,39 +463,39 @@ []] [(.require [' - [ ']]) + [ ']]) ("lux def module" [[ ]]) [( )]] [(.require ["[0]" ' - ["[0]" ']]) + ["[0]" ']]) ("lux def module" [[ ] [ ]]) [( ) ( )]] [(.require ["[0]" ' - ["[1]" ']]) + ["[1]" ']]) ("lux def module" [[ ]]) [( )]] [(.require ["[0]" ' - ["[1]" ' - ["[2]" ']]]) + ["[1]" ' + ["[2]" ']]]) ("lux def module" [[ ]]) [( )]] [(.require [' - ["[0]" ' - ["[0]" ']]]) + ["[0]" ' + ["[0]" ']]]) ("lux def module" [[ ] [ ]]) [( ) ( )]] [(.require ["[0]" ' - [' - ["[0]" <\\>']]]) + [' + ["[0]" <\\>']]]) ("lux def module" [[ ] [ <\\>]]) [( ) diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux index b9a6da76f..e977e9df3 100644 --- a/stdlib/source/test/lux/control/parser.lux +++ b/stdlib/source/test/lux/control/parser.lux @@ -10,9 +10,7 @@ ["$[0]" apply] ["$[0]" monad]]] [control - ["[0]" try (.only Try)] - [parser - ["<[0]>" code]]] + ["[0]" try (.only Try)]] [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]] @@ -24,15 +22,14 @@ ["n" nat]]] [macro [syntax (.only syntax)] - ["[0]" code]]]] + ["[0]" code (.only) + ["<[1]>" \\parser]]]]] [\\library ["[0]" / (.only Parser)]] ["[0]" / ["[1][0]" cli] - ["[1][0]" code] ["[1][0]" environment] - ["[1][0]" tree] - ["[1][0]" type]]) + ["[1][0]" tree]]) (def (should_fail expected input) (All (_ a) (-> Text (Try a) Bit)) @@ -381,8 +378,6 @@ ..combinators_2 /cli.test - /code.test /environment.test /tree.test - /type.test )))) diff --git a/stdlib/source/test/lux/control/parser/code.lux b/stdlib/source/test/lux/control/parser/code.lux deleted file mode 100644 index a3ba95629..000000000 --- a/stdlib/source/test/lux/control/parser/code.lux +++ /dev/null @@ -1,161 +0,0 @@ -(.require - [library - [lux (.except local global) - ["_" test (.only Test)] - [abstract - [monad (.only do)]] - [control - ["[0]" function] - ["[0]" try] - ["<>" parser]] - [data - ["[0]" bit] - ["[0]" text] - [collection - ["[0]" list]]] - [macro - ["^" pattern] - ["[0]" code]] - [math - ["[0]" random (.only Random) (.use "[1]#[0]" functor)] - [number - ["[0]" nat] - ["[0]" int] - ["[0]" rev] - ["[0]" frac]]] - [meta - ["[0]" symbol]]]] - [\\library - ["[0]" /]]) - -(def !expect - (template (_ ) - [(case - - true - - _ - false)])) - -(def local - (Random Text) - (random.lower_case 1)) - -(def global - (Random Symbol) - (all random.and - (random.lower_case 1) - (random.lower_case 1) - )) - -(def any_symbol - (Random Symbol) - (all random.either - (random#each (|>> [""]) - ..local) - ..global - )) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Parser]) - (`` (all _.and - (do [! random.monad] - [expected (at ! each code.bit random.bit)] - (_.coverage [/.result] - (and (|> (/.result /.any (list expected)) - (!expect {try.#Success _})) - (|> (/.result /.any (list)) - (!expect {try.#Failure _}))))) - (~~ (with_template [ ] - [(do [! random.monad] - [expected - dummy (|> (random.only (|>> (at = expected) not)))] - (all _.and - (_.coverage [] - (|> (/.result (list ( expected))) - (!expect (^.multi {try.#Success actual} - (at = expected actual))))) - (_.coverage [] - (and (|> (/.result ( expected) (list ( expected))) - (!expect {try.#Success []})) - (|> (/.result ( expected) (list ( dummy))) - (!expect {try.#Failure _})))) - ))] - - [/.any /.this (at ! each code.bit random.bit) function.identity code.equivalence] - [/.bit /.this_bit random.bit code.bit bit.equivalence] - [/.nat /.this_nat random.nat code.nat nat.equivalence] - [/.int /.this_int random.int code.int int.equivalence] - [/.rev /.this_rev random.rev code.rev rev.equivalence] - [/.frac /.this_frac random.safe_frac code.frac frac.equivalence] - [/.text /.this_text (random.unicode 1) code.text text.equivalence] - [/.local /.this_local ..local code.local text.equivalence] - [/.global /.this_global ..global code.symbol symbol.equivalence] - [/.symbol /.this_symbol ..any_symbol code.symbol symbol.equivalence] - )) - (~~ (with_template [ ] - [(do [! random.monad] - [expected_left random.nat - expected_right random.int] - (_.coverage [] - (|> (/.result ( (<>.and /.nat /.int)) - (list ( (list (code.nat expected_left) - (code.int expected_right))))) - (!expect (^.multi {try.#Success [actual_left actual_right]} - (and (at nat.equivalence = expected_left actual_left) - (at int.equivalence = expected_right actual_right)))))))] - - [/.form code.form] - [/.variant code.variant] - [/.tuple code.tuple] - )) - (do [! random.monad] - [expected_local random.nat - expected_global random.int] - (_.coverage [/.locally] - (|> (/.result (<>.and (/.locally (list (code.nat expected_local)) /.nat) - /.int) - (list (code.int expected_global))) - (!expect (^.multi {try.#Success [actual_local actual_global]} - (and (at nat.equivalence = expected_local actual_local) - (at int.equivalence = expected_global actual_global))))))) - (do [! random.monad] - [dummy (at ! each code.bit random.bit)] - (_.coverage [/.end?] - (|> (/.result (do <>.monad - [pre /.end? - _ /.any - post /.end?] - (in (and (not pre) - post))) - (list dummy)) - (!expect (^.multi {try.#Success verdict} - verdict))))) - (do [! random.monad] - [dummy (at ! each code.bit random.bit)] - (_.coverage [/.end] - (and (|> (/.result /.end (list)) - (!expect {try.#Success []})) - (|> (/.result /.end (list dummy)) - (!expect {try.#Failure _}))))) - (do [! random.monad] - [expected (at ! each code.bit random.bit)] - (_.coverage [/.next] - (|> (/.result (do <>.monad - [pre /.next - post /.any] - (in (and (same? expected pre) - (same? pre post)))) - (list expected)) - (!expect {try.#Success _})))) - (do [! random.monad] - [expected (at ! each code.bit random.bit)] - (_.coverage [/.not] - (and (|> (/.result (/.not /.nat) (list expected)) - (!expect (^.multi {try.#Success actual} - (same? expected actual)))) - (|> (/.result (/.not /.bit) (list expected)) - (!expect {try.#Failure _}))))) - )))) diff --git a/stdlib/source/test/lux/control/parser/type.lux b/stdlib/source/test/lux/control/parser/type.lux deleted file mode 100644 index 11f7b7796..000000000 --- a/stdlib/source/test/lux/control/parser/type.lux +++ /dev/null @@ -1,323 +0,0 @@ -(.require - [library - [lux (.except) - ["_" test (.only Test)] - ["[0]" type (.use "[1]#[0]" equivalence)] - [abstract - [monad (.only do)]] - [control - ["[0]" try] - ["[0]" exception]] - [data - [text - ["%" \\format (.only format)]] - [collection - ["[0]" list]]] - [macro - ["^" pattern]] - [math - ["[0]" random (.only Random)] - [number - ["n" nat]]] - [meta - ["[0]" symbol (.use "[1]#[0]" equivalence)]]]] - [\\library - ["[0]" / (.only) - ["/[1]" //]]]) - -(def !expect - (template (_ ) - [(case - - true - - _ - false)])) - -(def primitive - (Random Type) - (|> (random.alpha_numeric 1) - (at random.monad each (function (_ name) - {.#Primitive name (list)})))) - -(def test|matches - Test - (<| (_.for [/.types_do_not_match]) - (do [! random.monad] - [expected ..primitive - dummy (random.only (|>> (type#= expected) not) - ..primitive)]) - (all _.and - (_.coverage [/.exactly] - (and (|> (/.result (/.exactly expected) expected) - (!expect {try.#Success []})) - (|> (/.result (/.exactly expected) dummy) - (!expect (^.multi {try.#Failure error} - (exception.match? /.types_do_not_match error)))))) - (_.coverage [/.sub] - (and (|> (/.result (/.sub expected) expected) - (!expect {try.#Success []})) - (|> (/.result (/.sub Any) expected) - (!expect {try.#Success []})) - (|> (/.result (/.sub expected) Nothing) - (!expect {try.#Success []})) - (|> (/.result (/.sub expected) dummy) - (!expect (^.multi {try.#Failure error} - (exception.match? /.types_do_not_match error)))))) - (_.coverage [/.super] - (and (|> (/.result (/.super expected) expected) - (!expect {try.#Success []})) - (|> (/.result (/.super expected) Any) - (!expect {try.#Success []})) - (|> (/.result (/.super Nothing) expected) - (!expect {try.#Success []})) - (|> (/.result (/.super expected) dummy) - (!expect (^.multi {try.#Failure error} - (exception.match? /.types_do_not_match error)))))) - ))) - -(def test|aggregate - Test - (do [! random.monad] - [expected_left ..primitive - expected_middle ..primitive - expected_right ..primitive] - (`` (all _.and - (~~ (with_template [ ] - [(_.coverage [ ] - (and (|> (/.result ( (all //.and /.any /.any /.any)) - ( (list expected_left expected_middle expected_right))) - (!expect (^.multi {try.#Success [actual_left actual_middle actual_right]} - (and (type#= expected_left actual_left) - (type#= expected_middle actual_middle) - (type#= expected_right actual_right))))) - (|> (/.result ( (all //.and /.any /.any /.any)) - ( (list expected_left expected_middle expected_right))) - (!expect (^.multi {try.#Failure error} - (exception.match? error))))))] - - [/.variant /.not_variant type.variant type.tuple] - [/.tuple /.not_tuple type.tuple type.variant] - )) - - (_.coverage [/.function /.not_function] - (and (|> (/.result (/.function (all //.and /.any /.any) /.any) - (type.function (list expected_left expected_middle) expected_right)) - (!expect (^.multi {try.#Success [[actual_left actual_middle] actual_right]} - (and (type#= expected_left actual_left) - (type#= expected_middle actual_middle) - (type#= expected_right actual_right))))) - (|> (/.result (/.function (all //.and /.any /.any) /.any) - (type.variant (list expected_left expected_middle expected_right))) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_function error)))))) - (_.coverage [/.applied /.not_application] - (and (|> (/.result (/.applied (all //.and /.any /.any /.any)) - (type.application (list expected_middle expected_right) expected_left)) - (!expect (^.multi {try.#Success [actual_left actual_middle actual_right]} - (and (type#= expected_left actual_left) - (type#= expected_middle actual_middle) - (type#= expected_right actual_right))))) - (|> (/.result (/.applied (all //.and /.any /.any /.any)) - (type.variant (list expected_left expected_middle expected_right))) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_application error)))))) - )))) - -(def test|parameter - Test - (do random.monad - [quantification ..primitive - argument ..primitive - not_parameter ..primitive - parameter random.nat] - (all _.and - (_.coverage [/.not_parameter] - (|> (/.result /.parameter not_parameter) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_parameter error))))) - (_.coverage [/.unknown_parameter] - (|> (/.result /.parameter {.#Parameter parameter}) - (!expect (^.multi {try.#Failure error} - (exception.match? /.unknown_parameter error))))) - (_.coverage [/.with_extension] - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - /.any) - not_parameter) - (!expect (^.multi {try.#Success [quantification::binding argument::binding actual]} - (same? not_parameter actual))))) - (_.coverage [/.parameter] - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - /.parameter) - {.#Parameter 0}) - (!expect {try.#Success [quantification::binding argument::binding _]}))) - (_.coverage [/.argument] - (let [argument? (is (-> Nat Nat Bit) - (function (_ @ expected) - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - (/.with_extension quantification) - (/.with_extension argument) - (do //.monad - [env /.env - _ /.any] - (in (/.argument env @)))) - not_parameter) - (!expect (^.multi {try.#Success [_ _ _ _ actual]} - (n.= expected actual))))))] - (and (argument? 0 2) - (argument? 1 3) - (argument? 2 0)))) - (_.coverage [/.wrong_parameter] - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - (/.this_parameter 1)) - {.#Parameter 0}) - (!expect (^.multi {try.#Failure error} - (exception.match? /.wrong_parameter error))))) - (_.coverage [/.this_parameter] - (|> (/.result (<| (/.with_extension quantification) - (/.with_extension argument) - (/.this_parameter 0)) - {.#Parameter 0}) - (!expect {try.#Success [quantification::binding argument::binding _]}))) - ))) - -(def test|polymorphic - Test - (do [! random.monad] - [not_polymorphic ..primitive - expected_inputs (at ! each (|>> (n.% 10) ++) random.nat)] - (all _.and - (_.coverage [/.not_polymorphic] - (and (|> (/.result (/.polymorphic /.any) - not_polymorphic) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_polymorphic error)))) - (|> (/.result (/.polymorphic /.any) - (type.univ_q 0 not_polymorphic)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_polymorphic error)))))) - (_.coverage [/.polymorphic] - (|> (/.result (/.polymorphic /.any) - (type.univ_q expected_inputs not_polymorphic)) - (!expect (^.multi {try.#Success [g!poly actual_inputs bodyT]} - (and (n.= expected_inputs (list.size actual_inputs)) - (same? not_polymorphic bodyT)))))) - ))) - -(def test|recursive - Test - (do random.monad - [expected ..primitive] - (all _.and - (_.coverage [/.recursive] - (|> (.type_literal (Rec @ expected)) - (/.result (/.recursive /.any)) - (!expect (^.multi {try.#Success [@self actual]} - (type#= expected actual))))) - (_.coverage [/.recursive_self] - (|> (.type_literal (Rec @ @)) - (/.result (/.recursive /.recursive_self)) - (!expect (^.multi {try.#Success [@expected @actual]} - (same? @expected @actual))))) - (_.coverage [/.recursive_call] - (|> (.type_literal (All (self input) (self input))) - (/.result (/.polymorphic /.recursive_call)) - (!expect {try.#Success [@self inputs ???]}))) - (_.coverage [/.not_recursive] - (and (|> expected - (/.result (/.recursive /.any)) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_recursive error)))) - (|> expected - (/.result /.recursive_self) - (!expect (^.multi {try.#Failure error} - (exception.match? /.not_recursive error)))))) - ))) - -(def .public test - Test - (<| (_.covering /._) - (_.for [/.Parser]) - (all _.and - (do [! random.monad] - [expected ..primitive] - (_.coverage [/.result /.any] - (|> (/.result /.any expected) - (!expect (^.multi {try.#Success actual} - (type#= expected actual)))))) - (do [! random.monad] - [expected ..primitive] - (_.coverage [/.next /.unconsumed_input] - (and (|> (/.result (do //.monad - [actual /.next - _ /.any] - (in actual)) - expected) - (!expect (^.multi {try.#Success actual} - (type#= expected actual)))) - (|> (/.result /.next expected) - (!expect (^.multi {try.#Failure error} - (exception.match? /.unconsumed_input error))))))) - (do [! random.monad] - [expected ..primitive] - (_.coverage [/.empty_input] - (`` (and (~~ (with_template [] - [(|> (/.result (do //.monad - [_ /.any] - ) - expected) - (!expect (^.multi {try.#Failure error} - (exception.match? /.empty_input error))))] - - [/.any] - [/.next] - )))))) - (do [! random.monad] - [expected ..primitive] - (_.coverage [/.Env /.env /.fresh] - (|> (/.result (do //.monad - [env /.env - _ /.any] - (in env)) - expected) - (!expect (^.multi {try.#Success environment} - (same? /.fresh environment)))))) - (do [! random.monad] - [expected ..primitive - dummy (random.only (|>> (type#= expected) not) - ..primitive)] - (_.coverage [/.local] - (|> (/.result (do //.monad - [_ /.any] - (/.local (list expected) - /.any)) - dummy) - (!expect (^.multi {try.#Success actual} - (type#= expected actual)))))) - (do [! random.monad] - [expected random.nat] - (_.coverage [/.existential /.not_existential] - (|> (/.result /.existential - {.#Ex expected}) - (!expect (^.multi {try.#Success actual} - (n.= expected actual)))))) - (do [! random.monad] - [expected_name (random.and (random.alpha_numeric 1) - (random.alpha_numeric 1)) - expected_type ..primitive] - (_.coverage [/.named /.not_named] - (|> (/.result /.named - {.#Named expected_name expected_type}) - (!expect (^.multi {try.#Success [actual_name actual_type]} - (and (symbol#= expected_name actual_name) - (type#= expected_type actual_type))))))) - ..test|aggregate - ..test|matches - ..test|parameter - ..test|polymorphic - ..test|recursive - ))) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index 0ddedd7bd..44216d17d 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -8,9 +8,7 @@ [control ["[0]" io] ["[0]" try (.only Try)] - ["[0]" exception] - [parser - ["<[0]>" code]]] + ["[0]" exception]] [data ["[0]" product] ["[0]" text (.only) @@ -23,8 +21,9 @@ ["[0]" instant] ["[0]" duration]] ["[0]" macro (.only) - ["[0]" code] - ["[0]" syntax (.only syntax)]]]] + ["[0]" syntax (.only syntax)] + ["[0]" code (.only) + ["<[1]>" \\parser]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 8a71ca938..0f7e49f03 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -14,13 +14,12 @@ [functor ["$[0]" contravariant]]]] [control + ["<>" parser] ["[0]" pipe] ["[0]" maybe] ["[0]" try (.only Try)] ["[0]" exception (.only Exception)] - ["[0]" function] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" function]] [data ["[0]" bit] [collection @@ -37,7 +36,8 @@ ["[1]/[0]" block]]]] [macro ["^" pattern] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] ["[0]" modulus] diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index b2536f305..86e2a645a 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -8,9 +8,7 @@ [monad (.only do)]] [control ["[0]" try] - ["[0]" exception] - [parser - ["<[0]>" code]]] + ["[0]" exception]] [data ["[0]" bit (.use "[1]#[0]" equivalence)] ["[0]" text (.only Char) (.use "[1]#[0]" equivalence) @@ -19,8 +17,9 @@ ["[0]" set (.only Set)]]] [macro [syntax (.only syntax)] - ["[0]" code] - ["[0]" template]] + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random (.only Random)] [number (.only hex) diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux index 08403a42d..5988210cd 100644 --- a/stdlib/source/test/lux/data/text/regex.lux +++ b/stdlib/source/test/lux/data/text/regex.lux @@ -6,16 +6,15 @@ [monad (.only do)]] [control ["[0]" pipe] - ["[0]" try] - [parser - ["<[0]>" code]]] + ["[0]" try]] [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)] ["<[1]>" \\parser (.only Parser)]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math [number (.only hex)] ["[0]" random]]]] diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index a789cdaf6..978f42916 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -7,9 +7,7 @@ [monad (.only do)]] [control ["[0]" try (.use "[1]#[0]" functor)] - ["[0]" exception] - [parser - ["<[0]>" code]]] + ["[0]" exception]] [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]] @@ -20,7 +18,8 @@ [xml (.only XML)]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random (.only Random)] [number diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux index 001e79cfc..8054dbbcc 100644 --- a/stdlib/source/test/lux/documentation.lux +++ b/stdlib/source/test/lux/documentation.lux @@ -5,9 +5,7 @@ ["[0]" meta] [control ["[0]" try] - ["[0]" exception] - [parser - ["<[0]>" code]]] + ["[0]" exception]] [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format]] @@ -16,7 +14,8 @@ ["[0]" macro (.only) [syntax (.only syntax)] ["[0]" template] - ["[0]" code]]]] + ["[0]" code (.only) + ["<[1]>" \\parser]]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index c61e11805..e23bd23ea 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -19,9 +19,8 @@ [abstract ["[0]" monad (.only do)]] [control - ["[0]" try (.use "[1]#[0]" functor)] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" try (.use "[1]#[0]" functor)]] [data ["[0]" product] ["[0]" binary (.only) @@ -32,7 +31,9 @@ ["[0]" sequence] ["[0]" list (.use "[1]#[0]" functor)]]] [macro - ["[0]" template]] + ["[0]" template] + ["[0]" code + ["<[1]>" \\parser]]] [math ["[0]" random] [number diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 3c6ded17e..f22bb70c1 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -12,9 +12,7 @@ ["[0]" io] ["[0]" pipe] ["[0]" try (.use "[1]#[0]" functor)] - ["[0]" exception] - [parser - ["<[0]>" code]]] + ["[0]" exception]] [data ["[0]" bit (.use "[1]#[0]" equivalence)] ["[0]" text (.use "[1]#[0]" equivalence) @@ -23,8 +21,9 @@ ["[0]" array (.only Array)]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code] - ["[0]" template]] + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number (.only hex) diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index 9368e2a0f..3f6e3fe92 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -6,9 +6,7 @@ [abstract [monad (.only do)]] [control - ["[0]" try (.use "[1]#[0]" functor)] - [parser - ["<[0]>" code]]] + ["[0]" try (.use "[1]#[0]" functor)]] [data ["[0]" bit (.use "[1]#[0]" equivalence)] ["[0]" text (.only) @@ -27,8 +25,9 @@ [\\library ["[0]" / (.only) [syntax (.only syntax)] - ["[0]" code (.use "[1]#[0]" equivalence)] - ["[0]" template]]] + ["[0]" template] + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]]] ["[0]" / ["[1][0]" code] ["[1][0]" local] diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index 172aeb2ee..a566b030d 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -1,32 +1,174 @@ (.require [library - [lux (.except) + [lux (.except local global) ["_" test (.only Test)] [abstract [monad (.only do)] [\\specification ["$[0]" equivalence]]] [control + ["<>" parser] + ["[0]" function] ["[0]" try (.only Try)]] [data + ["[0]" bit] ["[0]" product] ["[0]" text] [collection ["[0]" list (.use "[1]#[0]" functor)]]] + [macro + ["^" pattern]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number - ["n" nat]]] + ["[0]" nat] + ["[0]" int] + ["[0]" rev] + ["[0]" frac]]] [meta + ["[0]" symbol] ["[0]" location]] [tool [compiler [language [lux ["[0]" syntax]]]]]]] + ["[0]" \\parser] [\\library ["[0]" /]]) +(def !expect + (template (_ ) + [(case + + true + + _ + false)])) + +(def local + (Random Text) + (random.lower_case 1)) + +(def global + (Random Symbol) + (all random.and + (random.lower_case 1) + (random.lower_case 1) + )) + +(def any_symbol + (Random Symbol) + (all random.either + (random#each (|>> [""]) + ..local) + ..global + )) + +(def \\parser + Test + (<| (_.covering \\parser._) + (_.for [\\parser.Parser]) + (`` (all _.and + (do [! random.monad] + [expected (at ! each /.bit random.bit)] + (_.coverage [\\parser.result] + (and (|> (\\parser.result \\parser.any (list expected)) + (!expect {try.#Success _})) + (|> (\\parser.result \\parser.any (list)) + (!expect {try.#Failure _}))))) + (~~ (with_template [ ] + [(do [! random.monad] + [expected + dummy (|> (random.only (|>> (at = expected) not)))] + (all _.and + (_.coverage [] + (|> (\\parser.result (list ( expected))) + (!expect (^.multi {try.#Success actual} + (at = expected actual))))) + (_.coverage [] + (and (|> (\\parser.result ( expected) (list ( expected))) + (!expect {try.#Success []})) + (|> (\\parser.result ( expected) (list ( dummy))) + (!expect {try.#Failure _})))) + ))] + + [\\parser.any \\parser.this (at ! each /.bit random.bit) function.identity /.equivalence] + [\\parser.bit \\parser.this_bit random.bit /.bit bit.equivalence] + [\\parser.nat \\parser.this_nat random.nat /.nat nat.equivalence] + [\\parser.int \\parser.this_int random.int /.int int.equivalence] + [\\parser.rev \\parser.this_rev random.rev /.rev rev.equivalence] + [\\parser.frac \\parser.this_frac random.safe_frac /.frac frac.equivalence] + [\\parser.text \\parser.this_text (random.unicode 1) /.text text.equivalence] + [\\parser.local \\parser.this_local ..local /.local text.equivalence] + [\\parser.global \\parser.this_global ..global /.symbol symbol.equivalence] + [\\parser.symbol \\parser.this_symbol ..any_symbol /.symbol symbol.equivalence] + )) + (~~ (with_template [ ] + [(do [! random.monad] + [expected_left random.nat + expected_right random.int] + (_.coverage [] + (|> (\\parser.result ( (<>.and \\parser.nat \\parser.int)) + (list ( (list (/.nat expected_left) + (/.int expected_right))))) + (!expect (^.multi {try.#Success [actual_left actual_right]} + (and (at nat.equivalence = expected_left actual_left) + (at int.equivalence = expected_right actual_right)))))))] + + [\\parser.form /.form] + [\\parser.variant /.variant] + [\\parser.tuple /.tuple] + )) + (do [! random.monad] + [expected_local random.nat + expected_global random.int] + (_.coverage [\\parser.locally] + (|> (\\parser.result (<>.and (\\parser.locally (list (/.nat expected_local)) \\parser.nat) + \\parser.int) + (list (/.int expected_global))) + (!expect (^.multi {try.#Success [actual_local actual_global]} + (and (at nat.equivalence = expected_local actual_local) + (at int.equivalence = expected_global actual_global))))))) + (do [! random.monad] + [dummy (at ! each /.bit random.bit)] + (_.coverage [\\parser.end?] + (|> (\\parser.result (do <>.monad + [pre \\parser.end? + _ \\parser.any + post \\parser.end?] + (in (and (not pre) + post))) + (list dummy)) + (!expect (^.multi {try.#Success verdict} + verdict))))) + (do [! random.monad] + [dummy (at ! each /.bit random.bit)] + (_.coverage [\\parser.end] + (and (|> (\\parser.result \\parser.end (list)) + (!expect {try.#Success []})) + (|> (\\parser.result \\parser.end (list dummy)) + (!expect {try.#Failure _}))))) + (do [! random.monad] + [expected (at ! each /.bit random.bit)] + (_.coverage [\\parser.next] + (|> (\\parser.result (do <>.monad + [pre \\parser.next + post \\parser.any] + (in (and (same? expected pre) + (same? pre post)))) + (list expected)) + (!expect {try.#Success _})))) + (do [! random.monad] + [expected (at ! each /.bit random.bit)] + (_.coverage [\\parser.not] + (and (|> (\\parser.result (\\parser.not \\parser.nat) (list expected)) + (!expect (^.multi {try.#Success actual} + (same? expected actual)))) + (|> (\\parser.result (\\parser.not \\parser.bit) (list expected)) + (!expect {try.#Failure _}))))) + )))) + (def random_text (Random Text) (random.alphabetic 10)) @@ -38,7 +180,7 @@ (def (random_sequence random) (All (_ a) (-> (Random a) (Random (List a)))) (do [! random.monad] - [size (|> random.nat (at ! each (n.% 3)))] + [size (|> random.nat (at ! each (nat.% 3)))] (random.list size random))) (def .public random @@ -171,4 +313,6 @@ (at /.equivalence = expected (/.replaced original substitute sample)))) + + ..\\parser ))) diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux index 708741dfe..b86a299b8 100644 --- a/stdlib/source/test/lux/macro/local.lux +++ b/stdlib/source/test/lux/macro/local.lux @@ -6,10 +6,9 @@ [abstract [monad (.only do)]] [control + ["<>" parser] ["[0]" try] - ["[0]" exception] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" exception]] [data [text ["%" \\format]] @@ -19,7 +18,8 @@ ["[0]" plist]]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random (.only Random)] [number diff --git a/stdlib/source/test/lux/macro/syntax.lux b/stdlib/source/test/lux/macro/syntax.lux index f39809d9b..c973ed03c 100644 --- a/stdlib/source/test/lux/macro/syntax.lux +++ b/stdlib/source/test/lux/macro/syntax.lux @@ -4,15 +4,15 @@ ["_" test (.only Test)] [abstract [monad (.only do)]] - [control - [parser - ["<[0]>" code]]] [math ["[0]" random] [number ["n" nat]]]]] [\\library - ["[0]" /]] + ["[0]" / (.only) + [// + ["[0]" code + ["<[1]>" \\parser]]]]] ["[0]" / ["[1][0]" check] ["[1][0]" declaration] diff --git a/stdlib/source/test/lux/macro/syntax/check.lux b/stdlib/source/test/lux/macro/syntax/check.lux index b671b807e..b8e3aa34b 100644 --- a/stdlib/source/test/lux/macro/syntax/check.lux +++ b/stdlib/source/test/lux/macro/syntax/check.lux @@ -7,13 +7,13 @@ [\\specification ["$[0]" equivalence]]] [control - ["[0]" try] - ["<>" parser (.only) - ["<[0]>" code]]] + ["<>" parser] + ["[0]" try]] [math ["[0]" random (.only Random)]] [macro - ["[0]" code (.use "[1]#[0]" equivalence)]]]] + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]]]] [\\library ["[0]" /]] ["$[0]" /// diff --git a/stdlib/source/test/lux/macro/syntax/declaration.lux b/stdlib/source/test/lux/macro/syntax/declaration.lux index 9a23d3051..b6c571170 100644 --- a/stdlib/source/test/lux/macro/syntax/declaration.lux +++ b/stdlib/source/test/lux/macro/syntax/declaration.lux @@ -7,15 +7,16 @@ [\\specification ["$[0]" equivalence]]] [control - ["[0]" try] - [parser - ["<[0]>" code]]] + ["[0]" try]] [math ["[0]" random (.only Random)] [number ["n" nat]]]]] [\\library - ["[0]" /]]) + ["[0]" / (.only) + [/// + ["[0]" code + ["<[1]>" \\parser]]]]]) (def .public random (Random /.Declaration) diff --git a/stdlib/source/test/lux/macro/syntax/definition.lux b/stdlib/source/test/lux/macro/syntax/definition.lux index 8238856c9..eab4879a0 100644 --- a/stdlib/source/test/lux/macro/syntax/definition.lux +++ b/stdlib/source/test/lux/macro/syntax/definition.lux @@ -7,12 +7,12 @@ [\\specification ["$[0]" equivalence]]] [control + ["<>" parser] ["[0]" try] - ["[0]" exception] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" exception]] [macro - ["[0]" code (.use "[1]#[0]" equivalence)]] + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]] [math ["[0]" random (.only Random)]] [meta diff --git a/stdlib/source/test/lux/macro/syntax/export.lux b/stdlib/source/test/lux/macro/syntax/export.lux index 5d2a0d23a..3ef76a0bb 100644 --- a/stdlib/source/test/lux/macro/syntax/export.lux +++ b/stdlib/source/test/lux/macro/syntax/export.lux @@ -6,11 +6,10 @@ [monad (.only do)]] [control ["[0]" maybe] - ["[0]" try (.use "[1]#[0]" functor)] - [parser - ["<[0]>" code]]] + ["[0]" try (.use "[1]#[0]" functor)]] [macro - ["[0]" code (.use "[1]#[0]" equivalence)]] + ["[0]" code (.use "[1]#[0]" equivalence) + ["<[1]>" \\parser]]] [math ["[0]" random (.only Random)] [number diff --git a/stdlib/source/test/lux/macro/syntax/input.lux b/stdlib/source/test/lux/macro/syntax/input.lux index 9a865ff13..7768f7c6b 100644 --- a/stdlib/source/test/lux/macro/syntax/input.lux +++ b/stdlib/source/test/lux/macro/syntax/input.lux @@ -7,9 +7,7 @@ [\\specification ["$[0]" equivalence]]] [control - ["[0]" try] - [parser - ["<[0]>" code]]] + ["[0]" try]] [data [collection ["[0]" list]]] @@ -18,7 +16,10 @@ [number ["n" nat]]]]] [\\library - ["[0]" /]] + ["[0]" / (.only) + [/// + ["[0]" code + ["<[1]>" \\parser]]]]] ["$[0]" /// ["[1][0]" code]]) diff --git a/stdlib/source/test/lux/macro/syntax/type/variable.lux b/stdlib/source/test/lux/macro/syntax/type/variable.lux index f242a972a..1970a6ef8 100644 --- a/stdlib/source/test/lux/macro/syntax/type/variable.lux +++ b/stdlib/source/test/lux/macro/syntax/type/variable.lux @@ -7,13 +7,14 @@ [\\specification ["$[0]" equivalence]]] [control - ["[0]" try (.use "[1]#[0]" functor)] - [parser - ["<[0]>" code]]] + ["[0]" try (.use "[1]#[0]" functor)]] [math ["[0]" random (.only Random)]]]] [\\library - ["[0]" /]]) + ["[0]" / (.only) + [//// + ["[0]" code + ["<[1]>" \\parser]]]]]) (def .public random (Random /.Variable) diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux index 2b8733643..4c48e5561 100644 --- a/stdlib/source/test/lux/macro/template.lux +++ b/stdlib/source/test/lux/macro/template.lux @@ -6,15 +6,14 @@ [monad (.only do)]] [control ["[0]" try] - ["[0]" exception] - [parser - ["<[0]>" code]]] + ["[0]" exception]] [data [collection ["[0]" list]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random (.only Random)] [number diff --git a/stdlib/source/test/lux/meta/configuration.lux b/stdlib/source/test/lux/meta/configuration.lux index c6c78c549..e1a546d82 100644 --- a/stdlib/source/test/lux/meta/configuration.lux +++ b/stdlib/source/test/lux/meta/configuration.lux @@ -9,10 +9,9 @@ ["$[0]" equivalence] ["$[0]" monoid]]] [control + ["<>" parser] ["[0]" try (.use "[1]#[0]" functor)] - ["[0]" exception] - ["<>" parser (.only) - ["<[0]>" code]]] + ["[0]" exception]] [data ["[0]" text (.only) ["<[1]>" \\parser]] @@ -20,7 +19,8 @@ ["[0]" list]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)]]]] [\\library diff --git a/stdlib/source/test/lux/meta/version.lux b/stdlib/source/test/lux/meta/version.lux index 360cbaa5f..ff70f25a0 100644 --- a/stdlib/source/test/lux/meta/version.lux +++ b/stdlib/source/test/lux/meta/version.lux @@ -8,14 +8,13 @@ [monad (.only do)]] [control ["[0]" try] - ["[0]" exception] - [parser - ["<[0]>" code]]] + ["[0]" exception]] [data ["[0]" text]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random] [number diff --git a/stdlib/source/test/lux/program.lux b/stdlib/source/test/lux/program.lux index fb87397ee..6b462da5e 100644 --- a/stdlib/source/test/lux/program.lux +++ b/stdlib/source/test/lux/program.lux @@ -8,14 +8,15 @@ ["[0]" io] ["[0]" try] ["<>" parser (.only) - ["<[0]>" code] ["<[0]>" cli]]] [data ["[0]" text] [collection ["[0]" list]]] [macro - [syntax (.only syntax)]] + [syntax (.only syntax)] + ["[0]" code + ["<[1]>" \\parser]]] [math ["[0]" random]]]] [\\library diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 436dc4e85..9f753b1d0 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -7,11 +7,15 @@ [\\specification ["$[0]" equivalence]]] [control + ["<>" parser] ["[0]" pipe] - ["[0]" maybe]] + ["[0]" maybe] + ["[0]" try] + ["[0]" exception]] [data ["[0]" bit (.use "[1]#[0]" equivalence)] - ["[0]" text (.use "[1]#[0]" equivalence)] + ["[0]" text (.use "[1]#[0]" equivalence) + ["%" \\format (.only format)]] [collection ["[0]" list] ["[0]" array]]] @@ -21,7 +25,10 @@ [math ["[0]" random (.only Random) (.use "[1]#[0]" monad)] [number - ["n" nat]]]]] + ["n" nat]]] + [meta + ["[0]" symbol (.use "[1]#[0]" equivalence)]]]] + ["[0]" \\parser] [\\library ["[0]" / (.use "[1]#[0]" equivalence)]] ["[0]" / @@ -35,6 +42,303 @@ ["[1][0]" unit] ["[1][0]" variance]]) +(def !expect + (template (_ ) + [(case + + true + + _ + false)])) + +(def primitive + (Random Type) + (|> (random.alpha_numeric 1) + (at random.monad each (function (_ name) + {.#Primitive name (list)})))) + +(def test|matches + Test + (<| (_.for [\\parser.types_do_not_match]) + (do [! random.monad] + [expected ..primitive + dummy (random.only (|>> (/#= expected) not) + ..primitive)]) + (all _.and + (_.coverage [\\parser.exactly] + (and (|> (\\parser.result (\\parser.exactly expected) expected) + (!expect {try.#Success []})) + (|> (\\parser.result (\\parser.exactly expected) dummy) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.types_do_not_match error)))))) + (_.coverage [\\parser.sub] + (and (|> (\\parser.result (\\parser.sub expected) expected) + (!expect {try.#Success []})) + (|> (\\parser.result (\\parser.sub Any) expected) + (!expect {try.#Success []})) + (|> (\\parser.result (\\parser.sub expected) Nothing) + (!expect {try.#Success []})) + (|> (\\parser.result (\\parser.sub expected) dummy) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.types_do_not_match error)))))) + (_.coverage [\\parser.super] + (and (|> (\\parser.result (\\parser.super expected) expected) + (!expect {try.#Success []})) + (|> (\\parser.result (\\parser.super expected) Any) + (!expect {try.#Success []})) + (|> (\\parser.result (\\parser.super Nothing) expected) + (!expect {try.#Success []})) + (|> (\\parser.result (\\parser.super expected) dummy) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.types_do_not_match error)))))) + ))) + +(def test|aggregate + Test + (do [! random.monad] + [expected_left ..primitive + expected_middle ..primitive + expected_right ..primitive] + (`` (all _.and + (~~ (with_template [ ] + [(_.coverage [ ] + (and (|> (\\parser.result ( (all <>.and \\parser.any \\parser.any \\parser.any)) + ( (list expected_left expected_middle expected_right))) + (!expect (^.multi {try.#Success [actual_left actual_middle actual_right]} + (and (/#= expected_left actual_left) + (/#= expected_middle actual_middle) + (/#= expected_right actual_right))))) + (|> (\\parser.result ( (all <>.and \\parser.any \\parser.any \\parser.any)) + ( (list expected_left expected_middle expected_right))) + (!expect (^.multi {try.#Failure error} + (exception.match? error))))))] + + [\\parser.variant \\parser.not_variant /.variant /.tuple] + [\\parser.tuple \\parser.not_tuple /.tuple /.variant] + )) + + (_.coverage [\\parser.function \\parser.not_function] + (and (|> (\\parser.result (\\parser.function (all <>.and \\parser.any \\parser.any) \\parser.any) + (/.function (list expected_left expected_middle) expected_right)) + (!expect (^.multi {try.#Success [[actual_left actual_middle] actual_right]} + (and (/#= expected_left actual_left) + (/#= expected_middle actual_middle) + (/#= expected_right actual_right))))) + (|> (\\parser.result (\\parser.function (all <>.and \\parser.any \\parser.any) \\parser.any) + (/.variant (list expected_left expected_middle expected_right))) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.not_function error)))))) + (_.coverage [\\parser.applied \\parser.not_application] + (and (|> (\\parser.result (\\parser.applied (all <>.and \\parser.any \\parser.any \\parser.any)) + (/.application (list expected_middle expected_right) expected_left)) + (!expect (^.multi {try.#Success [actual_left actual_middle actual_right]} + (and (/#= expected_left actual_left) + (/#= expected_middle actual_middle) + (/#= expected_right actual_right))))) + (|> (\\parser.result (\\parser.applied (all <>.and \\parser.any \\parser.any \\parser.any)) + (/.variant (list expected_left expected_middle expected_right))) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.not_application error)))))) + )))) + +(def test|parameter + Test + (do random.monad + [quantification ..primitive + argument ..primitive + not_parameter ..primitive + parameter random.nat] + (all _.and + (_.coverage [\\parser.not_parameter] + (|> (\\parser.result \\parser.parameter not_parameter) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.not_parameter error))))) + (_.coverage [\\parser.unknown_parameter] + (|> (\\parser.result \\parser.parameter {.#Parameter parameter}) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.unknown_parameter error))))) + (_.coverage [\\parser.with_extension] + (|> (\\parser.result (<| (\\parser.with_extension quantification) + (\\parser.with_extension argument) + \\parser.any) + not_parameter) + (!expect (^.multi {try.#Success [quantification::binding argument::binding actual]} + (same? not_parameter actual))))) + (_.coverage [\\parser.parameter] + (|> (\\parser.result (<| (\\parser.with_extension quantification) + (\\parser.with_extension argument) + \\parser.parameter) + {.#Parameter 0}) + (!expect {try.#Success [quantification::binding argument::binding _]}))) + (_.coverage [\\parser.argument] + (let [argument? (is (-> Nat Nat Bit) + (function (_ @ expected) + (|> (\\parser.result (<| (\\parser.with_extension quantification) + (\\parser.with_extension argument) + (\\parser.with_extension quantification) + (\\parser.with_extension argument) + (do <>.monad + [env \\parser.env + _ \\parser.any] + (in (\\parser.argument env @)))) + not_parameter) + (!expect (^.multi {try.#Success [_ _ _ _ actual]} + (n.= expected actual))))))] + (and (argument? 0 2) + (argument? 1 3) + (argument? 2 0)))) + (_.coverage [\\parser.wrong_parameter] + (|> (\\parser.result (<| (\\parser.with_extension quantification) + (\\parser.with_extension argument) + (\\parser.this_parameter 1)) + {.#Parameter 0}) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.wrong_parameter error))))) + (_.coverage [\\parser.this_parameter] + (|> (\\parser.result (<| (\\parser.with_extension quantification) + (\\parser.with_extension argument) + (\\parser.this_parameter 0)) + {.#Parameter 0}) + (!expect {try.#Success [quantification::binding argument::binding _]}))) + ))) + +(def test|polymorphic + Test + (do [! random.monad] + [not_polymorphic ..primitive + expected_inputs (at ! each (|>> (n.% 10) ++) random.nat)] + (all _.and + (_.coverage [\\parser.not_polymorphic] + (and (|> (\\parser.result (\\parser.polymorphic \\parser.any) + not_polymorphic) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.not_polymorphic error)))) + (|> (\\parser.result (\\parser.polymorphic \\parser.any) + (/.univ_q 0 not_polymorphic)) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.not_polymorphic error)))))) + (_.coverage [\\parser.polymorphic] + (|> (\\parser.result (\\parser.polymorphic \\parser.any) + (/.univ_q expected_inputs not_polymorphic)) + (!expect (^.multi {try.#Success [g!poly actual_inputs bodyT]} + (and (n.= expected_inputs (list.size actual_inputs)) + (same? not_polymorphic bodyT)))))) + ))) + +(def test|recursive + Test + (do random.monad + [expected ..primitive] + (all _.and + (_.coverage [\\parser.recursive] + (|> (.type_literal (Rec @ expected)) + (\\parser.result (\\parser.recursive \\parser.any)) + (!expect (^.multi {try.#Success [@self actual]} + (/#= expected actual))))) + (_.coverage [\\parser.recursive_self] + (|> (.type_literal (Rec @ @)) + (\\parser.result (\\parser.recursive \\parser.recursive_self)) + (!expect (^.multi {try.#Success [@expected @actual]} + (same? @expected @actual))))) + (_.coverage [\\parser.recursive_call] + (|> (.type_literal (All (self input) (self input))) + (\\parser.result (\\parser.polymorphic \\parser.recursive_call)) + (!expect {try.#Success [@self inputs ???]}))) + (_.coverage [\\parser.not_recursive] + (and (|> expected + (\\parser.result (\\parser.recursive \\parser.any)) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.not_recursive error)))) + (|> expected + (\\parser.result \\parser.recursive_self) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.not_recursive error)))))) + ))) + +(def \\parser + Test + (<| (_.covering \\parser._) + (_.for [\\parser.Parser]) + (all _.and + (do [! random.monad] + [expected ..primitive] + (_.coverage [\\parser.result \\parser.any] + (|> (\\parser.result \\parser.any expected) + (!expect (^.multi {try.#Success actual} + (/#= expected actual)))))) + (do [! random.monad] + [expected ..primitive] + (_.coverage [\\parser.next \\parser.unconsumed_input] + (and (|> (\\parser.result (do <>.monad + [actual \\parser.next + _ \\parser.any] + (in actual)) + expected) + (!expect (^.multi {try.#Success actual} + (/#= expected actual)))) + (|> (\\parser.result \\parser.next expected) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.unconsumed_input error))))))) + (do [! random.monad] + [expected ..primitive] + (_.coverage [\\parser.empty_input] + (`` (and (~~ (with_template [] + [(|> (\\parser.result (do <>.monad + [_ \\parser.any] + ) + expected) + (!expect (^.multi {try.#Failure error} + (exception.match? \\parser.empty_input error))))] + + [\\parser.any] + [\\parser.next] + )))))) + (do [! random.monad] + [expected ..primitive] + (_.coverage [\\parser.Env \\parser.env \\parser.fresh] + (|> (\\parser.result (do <>.monad + [env \\parser.env + _ \\parser.any] + (in env)) + expected) + (!expect (^.multi {try.#Success environment} + (same? \\parser.fresh environment)))))) + (do [! random.monad] + [expected ..primitive + dummy (random.only (|>> (/#= expected) not) + ..primitive)] + (_.coverage [\\parser.local] + (|> (\\parser.result (do <>.monad + [_ \\parser.any] + (\\parser.local (list expected) + \\parser.any)) + dummy) + (!expect (^.multi {try.#Success actual} + (/#= expected actual)))))) + (do [! random.monad] + [expected random.nat] + (_.coverage [\\parser.existential \\parser.not_existential] + (|> (\\parser.result \\parser.existential + {.#Ex expected}) + (!expect (^.multi {try.#Success actual} + (n.= expected actual)))))) + (do [! random.monad] + [expected_name (random.and (random.alpha_numeric 1) + (random.alpha_numeric 1)) + expected_type ..primitive] + (_.coverage [\\parser.named \\parser.not_named] + (|> (\\parser.result \\parser.named + {.#Named expected_name expected_type}) + (!expect (^.multi {try.#Success [actual_name actual_type]} + (and (symbol#= expected_name actual_name) + (/#= expected_type actual_type))))))) + ..test|aggregate + ..test|matches + ..test|parameter + ..test|polymorphic + ..test|recursive + ))) + (def short (Random Text) (do [! random.monad] @@ -249,6 +553,8 @@ (text#= (/.format left) (/.format right)))) )) + ..\\parser + /primitive.test /check.test /dynamic.test diff --git a/stdlib/source/test/lux/type/primitive.lux b/stdlib/source/test/lux/type/primitive.lux index 619b2b3f9..7b4500c00 100644 --- a/stdlib/source/test/lux/type/primitive.lux +++ b/stdlib/source/test/lux/type/primitive.lux @@ -7,15 +7,14 @@ [monad (.only do)]] [control ["[0]" try] - ["[0]" exception] - [parser - ["<[0]>" code]]] + ["[0]" exception]] [data ["[0]" text (.use "[1]#[0]" equivalence)]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code] - ["[0]" template]] + ["[0]" template] + ["[0]" code (.only) + ["<[1]>" \\parser]]] ["[0]" math (.only) ["[0]" random] [number diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index f8e44bcb4..a23f1cacf 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -11,16 +11,15 @@ ["[0]" try] ["[0]" exception (.only Exception)] [concurrency - ["[0]" async (.only Async)]] - [parser - ["<[0]>" code]]] + ["[0]" async (.only Async)]]] [data ["[0]" identity (.only Identity)] ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]]] ["[0]" macro (.only) [syntax (.only syntax)] - ["[0]" code]] + ["[0]" code (.only) + ["<[1]>" \\parser]]] [math ["[0]" random]]]] [\\library -- cgit v1.2.3