From 374ccf07246484eb7beb2cd87f3fc88396373ee1 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 20 Aug 2021 03:12:49 -0400 Subject: More fixes. --- stdlib/source/documentation/lux.lux | 15 +- stdlib/source/documentation/lux/data.lux | 29 +- stdlib/source/documentation/lux/data/format.lux | 23 ++ .../documentation/lux/data/format/binary.lux | 93 ++++++ .../source/documentation/lux/data/format/json.lux | 75 +++++ .../source/documentation/lux/data/format/tar.lux | 89 ++++++ .../source/documentation/lux/data/format/xml.lux | 36 +++ stdlib/source/documentation/lux/data/identity.lux | 25 ++ stdlib/source/documentation/lux/data/name.lux | 29 ++ stdlib/source/documentation/lux/data/product.lux | 52 ++++ stdlib/source/documentation/lux/data/sum.lux | 40 +++ stdlib/source/documentation/lux/data/text.lux | 27 ++ .../source/documentation/lux/data/text/buffer.lux | 25 ++ .../documentation/lux/data/text/encoding.lux | 318 +++++++++++++++++++ .../documentation/lux/data/text/encoding/utf8.lux | 18 ++ .../source/documentation/lux/data/text/escape.lux | 40 +++ .../source/documentation/lux/data/text/format.lux | 68 +++++ .../source/documentation/lux/data/text/regex.lux | 79 +++++ .../source/documentation/lux/data/text/unicode.lux | 19 ++ .../documentation/lux/data/text/unicode/block.lux | 265 ++++++++++++++++ .../documentation/lux/data/text/unicode/set.lux | 42 +++ stdlib/source/documentation/lux/debug.lux | 80 +++++ stdlib/source/documentation/lux/documentation.lux | 49 +++ stdlib/source/documentation/lux/ffi.lux | 336 +++++++++++++++++++++ stdlib/source/documentation/lux/program.lux | 33 ++ 25 files changed, 1883 insertions(+), 22 deletions(-) create mode 100644 stdlib/source/documentation/lux/data/format.lux create mode 100644 stdlib/source/documentation/lux/data/format/binary.lux create mode 100644 stdlib/source/documentation/lux/data/format/json.lux create mode 100644 stdlib/source/documentation/lux/data/format/tar.lux create mode 100644 stdlib/source/documentation/lux/data/format/xml.lux create mode 100644 stdlib/source/documentation/lux/data/identity.lux create mode 100644 stdlib/source/documentation/lux/data/name.lux create mode 100644 stdlib/source/documentation/lux/data/product.lux create mode 100644 stdlib/source/documentation/lux/data/sum.lux create mode 100644 stdlib/source/documentation/lux/data/text.lux create mode 100644 stdlib/source/documentation/lux/data/text/buffer.lux create mode 100644 stdlib/source/documentation/lux/data/text/encoding.lux create mode 100644 stdlib/source/documentation/lux/data/text/encoding/utf8.lux create mode 100644 stdlib/source/documentation/lux/data/text/escape.lux create mode 100644 stdlib/source/documentation/lux/data/text/format.lux create mode 100644 stdlib/source/documentation/lux/data/text/regex.lux create mode 100644 stdlib/source/documentation/lux/data/text/unicode.lux create mode 100644 stdlib/source/documentation/lux/data/text/unicode/block.lux create mode 100644 stdlib/source/documentation/lux/data/text/unicode/set.lux create mode 100644 stdlib/source/documentation/lux/debug.lux create mode 100644 stdlib/source/documentation/lux/documentation.lux create mode 100644 stdlib/source/documentation/lux/ffi.lux create mode 100644 stdlib/source/documentation/lux/program.lux (limited to 'stdlib/source/documentation') diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 987d9cce5..2376510b5 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -12,21 +12,21 @@ ["#." abstract] ["#." control] ["#." data] - ... ["#." debug] - ... ["#." documentation] + ["#." debug] + ["#." documentation] + ["#." ffi] ... ["#." locale] ... ["#." macro ... ["#/." code]] ... ["#." math] ... ["#." meta] - ... ["#." program] + ["#." program] ... ["#." target] ... ["#." test] ... ["#." time] ... ... ["#." tool] ... TODO: Update & expand tests for this ... ["#." type] ... ["#." world] - ... ["#." ffi] ... ["#." extension] ... ["#." target #_ ... ] @@ -49,7 +49,12 @@ [..:of] [/abstract.documentation /control.documentation - /data.documentation])) + /data.documentation + /debug.documentation + /documentation.documentation + /ffi.documentation + + /program.documentation])) (program: inputs (io.io (debug.log! ($.documentation ..documentation)))) diff --git a/stdlib/source/documentation/lux/data.lux b/stdlib/source/documentation/lux/data.lux index 0939016a1..0187c2a51 100644 --- a/stdlib/source/documentation/lux/data.lux +++ b/stdlib/source/documentation/lux/data.lux @@ -12,17 +12,12 @@ ["#." bit] ["#." collection] ["#." color] - ... ["#." identity] - ... ["#." name] - ... ["#." product] - ... ["#." sum] - ... ["#." text] - ... ["#." format #_ - ... ["#/." binary] - ... ["#/." json] - ... ["#/." tar] - ... ["#/." xml]] - ]) + ["#." format] + ["#." identity] + ["#." name] + ["#." product] + ["#." sum] + ["#." text]]) (.def: .public documentation (.List $.Module) @@ -31,10 +26,10 @@ /bit.documentation /collection.documentation /color.documentation - ... /identity.documentation - ... /name.documentation - ... /product.documentation - ... /sum.documentation - ... /text.documentation - ... /format.documentation + /format.documentation + /identity.documentation + /name.documentation + /product.documentation + /sum.documentation + /text.documentation ))) diff --git a/stdlib/source/documentation/lux/data/format.lux b/stdlib/source/documentation/lux/data/format.lux new file mode 100644 index 000000000..9758699e5 --- /dev/null +++ b/stdlib/source/documentation/lux/data/format.lux @@ -0,0 +1,23 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]] + [collection + ["." list]]]]] + ["." / #_ + ["#." binary] + ["#." json] + ["#." tar] + ["#." xml]]) + +(.def: .public documentation + (.List $.Module) + (list.together + (list /binary.documentation + /json.documentation + /tar.documentation + /xml.documentation + ))) diff --git a/stdlib/source/documentation/lux/data/format/binary.lux b/stdlib/source/documentation/lux/data/format/binary.lux new file mode 100644 index 000000000..229f262b0 --- /dev/null +++ b/stdlib/source/documentation/lux/data/format/binary.lux @@ -0,0 +1,93 @@ +(.module: + [library + [lux (#- nat int rev list type or and) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.Mutation + "A mutation of binary data, tracking where in the data to transform.") + +(documentation: /.Specification + "A description of how to transform binary data.") + +(documentation: /.no_op + "A specification for empty binary data.") + +(documentation: /.instance + "Given a specification of how to construct binary data, yields a binary blob that matches it.") + +(documentation: /.Writer + "An operation that knows how to write information into a binary blob.") + +(documentation: /.result + "Yields a binary blob with all the information written to it." + [(result writer value)]) + +(documentation: /.or + "" + [(or left right)]) + +(documentation: /.and + "" + [(and pre post)]) + +(documentation: /.rec + "A combinator for recursive writers." + [(rec body)]) + +(documentation: /.segment + "Writes at most 'size' bytes of an input binary blob." + [(segment size)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Mutation + ..Specification + ..no_op + ..instance + ..Writer + ..result + ..or + ..and + ..rec + ..segment + ($.default /.monoid) + ($.default /.bits/8) + ($.default /.bits/16) + ($.default /.bits/32) + ($.default /.bits/64) + ($.default /.any) + ($.default /.bit) + ($.default /.nat) + ($.default /.int) + ($.default /.rev) + ($.default /.frac) + ($.default /.binary/8) + ($.default /.binary/16) + ($.default /.binary/32) + ($.default /.binary/64) + ($.default /.utf8/8) + ($.default /.utf8/16) + ($.default /.utf8/32) + ($.default /.utf8/64) + ($.default /.text) + ($.default /.row/8) + ($.default /.row/16) + ($.default /.row/32) + ($.default /.row/64) + ($.default /.maybe) + ($.default /.list) + ($.default /.set) + ($.default /.name) + ($.default /.type) + ($.default /.location) + ($.default /.code)] + [])) diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux new file mode 100644 index 000000000..5b55ad75d --- /dev/null +++ b/stdlib/source/documentation/lux/data/format/json.lux @@ -0,0 +1,75 @@ +(.module: + [library + [lux (#- nat int rev list type or and) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.json + "A simple way to produce JSON literals." + [(json #null)] + [(json #1)] + [(json +123.456)] + [(json "this is a string")] + [(json ["this" "is" "an" "array"])] + [(json {"this" "is" + "an" "object"})]) + +(documentation: /.fields + "Get all the fields in a JSON object." + [(fields json)]) + +(documentation: /.field + "A JSON object field getter." + [(field key json)]) + +(documentation: /.has + "A JSON object field setter." + [(has key value json)]) + +(template [ ] + [(documentation: + (format "A JSON object field getter for " ".") + [( key json)])] + + [/.boolean_field "booleans"] + [/.number_field "numbers"] + [/.string_field "strings"] + [/.array_field "arrays"] + [/.object_field "objects"] + ) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + (format "Functionality for reading and writing values in the JSON format." + \n "For more information, please see: http://www.json.org/") + [..json + ..fields + ..field + ..has + + ..boolean_field + ..number_field + ..string_field + ..array_field + ..object_field + + ($.default /.Null) + ($.default /.Boolean) + ($.default /.Number) + ($.default /.String) + ($.default /.JSON) + ($.default /.Array) + ($.default /.Object) + ($.default /.null?) + ($.default /.object) + ($.default /.equivalence) + ($.default /.format) + ($.default /.codec)] + [])) diff --git a/stdlib/source/documentation/lux/data/format/tar.lux b/stdlib/source/documentation/lux/data/format/tar.lux new file mode 100644 index 000000000..85b658b59 --- /dev/null +++ b/stdlib/source/documentation/lux/data/format/tar.lux @@ -0,0 +1,89 @@ +(.module: + [library + [lux (#- nat int rev list type or and) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.not_a_small_number) + ($.default /.small_limit) + ($.default /.Small) + ($.default /.small) + ($.default /.from_small) + + ($.default /.not_a_big_number) + ($.default /.big_limit) + ($.default /.Big) + ($.default /.big) + ($.default /.from_big) + + ($.default /.wrong_character) + ($.default /.not_ascii) + ($.default /.name_size) + ($.default /.path_size) + + ($.default /.Name) + ($.default /.name_is_too_long) + ($.default /.name) + ($.default /.from_name) + ($.default /.anonymous) + + ($.default /.Path) + ($.default /.path_is_too_long) + ($.default /.path) + ($.default /.from_path) + ($.default /.no_path) + + ($.default /.invalid_link_flag) + ($.default /.Mode) + ($.default /.mode) + ($.default /.and) + ($.default /.invalid_mode) + + ($.default /.none) + + ($.default /.execute_by_other) + ($.default /.write_by_other) + ($.default /.read_by_other) + + ($.default /.execute_by_group) + ($.default /.write_by_group) + ($.default /.read_by_group) + + ($.default /.execute_by_owner) + ($.default /.write_by_owner) + ($.default /.read_by_owner) + + ($.default /.save_text) + ($.default /.set_group_id_on_execution) + ($.default /.set_user_id_on_execution) + + ($.default /.Content) + ($.default /.content) + ($.default /.data) + ($.default /.ID) + ($.default /.no_id) + ($.default /.Owner) + ($.default /.Ownership) + ($.default /.File) + ($.default /.Normal) + ($.default /.Symbolic_Link) + ($.default /.Directory) + ($.default /.Contiguous) + ($.default /.Entry) + ($.default /.Tar) + ($.default /.writer) + ($.default /.wrong_checksum) + ($.default /.wrong_link_flag) + ($.default /.invalid_end_of_archive) + ($.default /.parser)] + [])) diff --git a/stdlib/source/documentation/lux/data/format/xml.lux b/stdlib/source/documentation/lux/data/format/xml.lux new file mode 100644 index 000000000..d02722170 --- /dev/null +++ b/stdlib/source/documentation/lux/data/format/xml.lux @@ -0,0 +1,36 @@ +(.module: + [library + [lux (#- nat int rev list type or and) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.attributes + "An empty set of XML attributes.") + +(documentation: /.tag + "The text format of a XML tag." + [(tag name)]) + +(documentation: /.attribute + "The text format of a XML attribute.") + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..attributes + ..tag + ..attribute + ($.default /.Tag) + ($.default /.Attribute) + ($.default /.Attrs) + ($.default /.XML) + ($.default /.codec) + ($.default /.equivalence)] + [])) diff --git a/stdlib/source/documentation/lux/data/identity.lux b/stdlib/source/documentation/lux/data/identity.lux new file mode 100644 index 000000000..b67f8470b --- /dev/null +++ b/stdlib/source/documentation/lux/data/identity.lux @@ -0,0 +1,25 @@ +(.module: + [library + [lux (#- nat int rev list type or and) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.Identity + "A value, as is, without any extra structure super-imposed on it.") + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Identity + ($.default /.functor) + ($.default /.apply) + ($.default /.monad) + ($.default /.comonad)] + [])) diff --git a/stdlib/source/documentation/lux/data/name.lux b/stdlib/source/documentation/lux/data/name.lux new file mode 100644 index 000000000..1cf422bcf --- /dev/null +++ b/stdlib/source/documentation/lux/data/name.lux @@ -0,0 +1,29 @@ +(.module: + [library + [lux (#- nat int rev list type or and) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.module + "The module part of a name.") + +(documentation: /.short + "The short part of a name.") + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..module + ..short + ($.default /.hash) + ($.default /.equivalence) + ($.default /.order) + ($.default /.codec)] + [])) diff --git a/stdlib/source/documentation/lux/data/product.lux b/stdlib/source/documentation/lux/data/product.lux new file mode 100644 index 000000000..78d0d5aaa --- /dev/null +++ b/stdlib/source/documentation/lux/data/product.lux @@ -0,0 +1,52 @@ +(.module: + [library + [lux (#- nat int rev list type or and) + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.left + "The left side of a pair.") + +(documentation: /.right + "The right side of a pair.") + +(documentation: /.curried + "Converts a 2-argument function into nested single-argument functions." + [(curried f)]) + +(documentation: /.uncurried + "Converts nested single-argument functions into a 2-argument function." + [(uncurried f)]) + +(documentation: /.swapped + "" + [(swapped [left right])]) + +(documentation: /.then + "Apply functions to both sides of a pair." + [(then f g)]) + +(documentation: /.forked + "Yields a pair by applying both functions to a single value." + [(forked f g)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..left + ..right + ..curried + ..uncurried + ..swapped + ..then + ..forked + ($.default /.equivalence) + ($.default /.hash)] + [])) diff --git a/stdlib/source/documentation/lux/data/sum.lux b/stdlib/source/documentation/lux/data/sum.lux new file mode 100644 index 000000000..5db8a4df3 --- /dev/null +++ b/stdlib/source/documentation/lux/data/sum.lux @@ -0,0 +1,40 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.left + "Lifts value to the left side of a 2-variant.") + +(documentation: /.right + "Lifts value to the right side of a 2-variant.") + +(documentation: /.either + "Applies a function to either side of a 2-variant." + [(either on_left on_right)]) + +(documentation: /.then + "Applies functions to both sides of a 2-variant." + [(then on_left on_right)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "Functionality for working with variants (particularly 2-variants)." + [..left + ..right + ..either + ..then + ($.default /.lefts) + ($.default /.rights) + ($.default /.partition) + ($.default /.equivalence) + ($.default /.hash)] + [])) diff --git a/stdlib/source/documentation/lux/data/text.lux b/stdlib/source/documentation/lux/data/text.lux new file mode 100644 index 000000000..51c28a5ef --- /dev/null +++ b/stdlib/source/documentation/lux/data/text.lux @@ -0,0 +1,27 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]] + [collection + ["." list]]]]] + ["." / #_ + ["#." buffer] + ["#." encoding] + ["#." escape] + ["#." format] + ["#." regex] + ["#." unicode]]) + +(.def: .public documentation + (.List $.Module) + (list.together + (list /buffer.documentation + /encoding.documentation + /escape.documentation + /format.documentation + /regex.documentation + /unicode.documentation + ))) diff --git a/stdlib/source/documentation/lux/data/text/buffer.lux b/stdlib/source/documentation/lux/data/text/buffer.lux new file mode 100644 index 000000000..b392992f1 --- /dev/null +++ b/stdlib/source/documentation/lux/data/text/buffer.lux @@ -0,0 +1,25 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.Buffer + "Immutable text buffer for efficient text concatenation.") + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Buffer + ($.default /.empty) + ($.default /.then) + ($.default /.size) + ($.default /.text)] + [])) diff --git a/stdlib/source/documentation/lux/data/text/encoding.lux b/stdlib/source/documentation/lux/data/text/encoding.lux new file mode 100644 index 000000000..b0cef359b --- /dev/null +++ b/stdlib/source/documentation/lux/data/text/encoding.lux @@ -0,0 +1,318 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]] + ["." / #_ + ["#." utf8]]) + +(documentation: /.Encoding + "Encoding formats for text.") + +(template [] + [(documentation: + (format "'" (/.name ) "' text encoding. "))] + + [/.ascii] + + [/.ibm_037] + [/.ibm_273] + [/.ibm_277] + [/.ibm_278] + [/.ibm_280] + [/.ibm_284] + [/.ibm_285] + [/.ibm_290] + [/.ibm_297] + [/.ibm_300] + [/.ibm_420] + [/.ibm_424] + [/.ibm_437] + [/.ibm_500] + [/.ibm_737] + [/.ibm_775] + [/.ibm_833] + [/.ibm_834] + [/.ibm_838] + [/.ibm_850] + [/.ibm_852] + [/.ibm_855] + [/.ibm_856] + [/.ibm_857] + [/.ibm_858] + [/.ibm_860] + [/.ibm_861] + [/.ibm_862] + [/.ibm_863] + [/.ibm_864] + [/.ibm_865] + [/.ibm_866] + [/.ibm_868] + [/.ibm_869] + [/.ibm_870] + [/.ibm_871] + [/.ibm_874] + [/.ibm_875] + [/.ibm_918] + [/.ibm_921] + [/.ibm_922] + [/.ibm_930] + [/.ibm_933] + [/.ibm_935] + [/.ibm_937] + [/.ibm_939] + [/.ibm_942] + [/.ibm_942c] + [/.ibm_943] + [/.ibm_943c] + [/.ibm_948] + [/.ibm_949] + [/.ibm_949c] + [/.ibm_950] + [/.ibm_964] + [/.ibm_970] + [/.ibm_1006] + [/.ibm_1025] + [/.ibm_1026] + [/.ibm_1046] + [/.ibm_1047] + [/.ibm_1097] + [/.ibm_1098] + [/.ibm_1112] + [/.ibm_1122] + [/.ibm_1123] + [/.ibm_1124] + [/.ibm_1140] + [/.ibm_1141] + [/.ibm_1142] + [/.ibm_1143] + [/.ibm_1144] + [/.ibm_1145] + [/.ibm_1146] + [/.ibm_1147] + [/.ibm_1148] + [/.ibm_1149] + [/.ibm_1166] + [/.ibm_1364] + [/.ibm_1381] + [/.ibm_1383] + [/.ibm_33722] + + [/.iso_2022_cn] + [/.iso2022_cn_cns] + [/.iso2022_cn_gb] + [/.iso_2022_jp] + [/.iso_2022_jp_2] + [/.iso_2022_kr] + [/.iso_8859_1] + [/.iso_8859_2] + [/.iso_8859_3] + [/.iso_8859_4] + [/.iso_8859_5] + [/.iso_8859_6] + [/.iso_8859_7] + [/.iso_8859_8] + [/.iso_8859_9] + [/.iso_8859_11] + [/.iso_8859_13] + [/.iso_8859_15] + + [/.mac_arabic] + [/.mac_central_europe] + [/.mac_croatian] + [/.mac_cyrillic] + [/.mac_dingbat] + [/.mac_greek] + [/.mac_hebrew] + [/.mac_iceland] + [/.mac_roman] + [/.mac_romania] + [/.mac_symbol] + [/.mac_thai] + [/.mac_turkish] + [/.mac_ukraine] + + [/.utf_8] + [/.utf_16] + [/.utf_32] + + [/.windows_31j] + [/.windows_874] + [/.windows_949] + [/.windows_950] + [/.windows_1250] + [/.windows_1252] + [/.windows_1251] + [/.windows_1253] + [/.windows_1254] + [/.windows_1255] + [/.windows_1256] + [/.windows_1257] + [/.windows_1258] + [/.windows_iso2022jp] + [/.windows_50220] + [/.windows_50221] + + [/.cesu_8] + [/.koi8_r] + [/.koi8_u] + ) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Encoding + + ..ascii + + ..ibm_037 + ..ibm_273 + ..ibm_277 + ..ibm_278 + ..ibm_280 + ..ibm_284 + ..ibm_285 + ..ibm_290 + ..ibm_297 + ..ibm_300 + ..ibm_420 + ..ibm_424 + ..ibm_437 + ..ibm_500 + ..ibm_737 + ..ibm_775 + ..ibm_833 + ..ibm_834 + ..ibm_838 + ..ibm_850 + ..ibm_852 + ..ibm_855 + ..ibm_856 + ..ibm_857 + ..ibm_858 + ..ibm_860 + ..ibm_861 + ..ibm_862 + ..ibm_863 + ..ibm_864 + ..ibm_865 + ..ibm_866 + ..ibm_868 + ..ibm_869 + ..ibm_870 + ..ibm_871 + ..ibm_874 + ..ibm_875 + ..ibm_918 + ..ibm_921 + ..ibm_922 + ..ibm_930 + ..ibm_933 + ..ibm_935 + ..ibm_937 + ..ibm_939 + ..ibm_942 + ..ibm_942c + ..ibm_943 + ..ibm_943c + ..ibm_948 + ..ibm_949 + ..ibm_949c + ..ibm_950 + ..ibm_964 + ..ibm_970 + ..ibm_1006 + ..ibm_1025 + ..ibm_1026 + ..ibm_1046 + ..ibm_1047 + ..ibm_1097 + ..ibm_1098 + ..ibm_1112 + ..ibm_1122 + ..ibm_1123 + ..ibm_1124 + ..ibm_1140 + ..ibm_1141 + ..ibm_1142 + ..ibm_1143 + ..ibm_1144 + ..ibm_1145 + ..ibm_1146 + ..ibm_1147 + ..ibm_1148 + ..ibm_1149 + ..ibm_1166 + ..ibm_1364 + ..ibm_1381 + ..ibm_1383 + ..ibm_33722 + + ..iso_2022_cn + ..iso2022_cn_cns + ..iso2022_cn_gb + ..iso_2022_jp + ..iso_2022_jp_2 + ..iso_2022_kr + ..iso_8859_1 + ..iso_8859_2 + ..iso_8859_3 + ..iso_8859_4 + ..iso_8859_5 + ..iso_8859_6 + ..iso_8859_7 + ..iso_8859_8 + ..iso_8859_9 + ..iso_8859_11 + ..iso_8859_13 + ..iso_8859_15 + + ..mac_arabic + ..mac_central_europe + ..mac_croatian + ..mac_cyrillic + ..mac_dingbat + ..mac_greek + ..mac_hebrew + ..mac_iceland + ..mac_roman + ..mac_romania + ..mac_symbol + ..mac_thai + ..mac_turkish + ..mac_ukraine + + ..utf_8 + ..utf_16 + ..utf_32 + + ..windows_31j + ..windows_874 + ..windows_949 + ..windows_950 + ..windows_1250 + ..windows_1252 + ..windows_1251 + ..windows_1253 + ..windows_1254 + ..windows_1255 + ..windows_1256 + ..windows_1257 + ..windows_1258 + ..windows_iso2022jp + ..windows_50220 + ..windows_50221 + + ..cesu_8 + ..koi8_r + ..koi8_u + + ($.default /.name)] + [/utf8.documentation])) diff --git a/stdlib/source/documentation/lux/data/text/encoding/utf8.lux b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux new file mode 100644 index 000000000..cfe8aee01 --- /dev/null +++ b/stdlib/source/documentation/lux/data/text/encoding/utf8.lux @@ -0,0 +1,18 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [($.default /.codec)] + [])) diff --git a/stdlib/source/documentation/lux/data/text/escape.lux b/stdlib/source/documentation/lux/data/text/escape.lux new file mode 100644 index 000000000..e9c8637fb --- /dev/null +++ b/stdlib/source/documentation/lux/data/text/escape.lux @@ -0,0 +1,40 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.escaped + "Yields a escaped version of the text." + [(escaped text)]) + +(documentation: /.un_escaped + (format "Yields an un-escaped text." + \n "Fails if it was improperly escaped.") + [(un_escaped text)]) + +(documentation: /.literal + "If given a escaped text literal, expands to an un-escaped version." + [(/.literal "Line 1\nLine 2") + "=>" + (format "Line 1" \n + "Line 2")]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..escaped + ..un_escaped + ..literal + ($.default /.escapable?) + ($.default /.dangling_escape) + ($.default /.invalid_escape) + ($.default /.invalid_unicode_escape)] + [])) diff --git a/stdlib/source/documentation/lux/data/text/format.lux b/stdlib/source/documentation/lux/data/text/format.lux new file mode 100644 index 000000000..4f823901e --- /dev/null +++ b/stdlib/source/documentation/lux/data/text/format.lux @@ -0,0 +1,68 @@ +(.module: + [library + [lux (#- nat int rev type list) + ["$" documentation (#+ documentation:)] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.Format + "A way to produce readable text from values.") + +(documentation: /.format + "Text interpolation." + [(format "Static part " (text static) " does not match URI: " uri)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Format + ..format + ($.default /.functor) + + ($.default /.bit) + ($.default /.nat) + ($.default /.int) + ($.default /.rev) + ($.default /.frac) + ($.default /.text) + + ($.default /.ratio) + ($.default /.name) + ($.default /.location) + ($.default /.code) + ($.default /.type) + + ($.default /.instant) + ($.default /.duration) + ($.default /.date) + ($.default /.time) + ($.default /.day) + ($.default /.month) + + ($.default /.xml) + ($.default /.json) + + ($.default /.nat/2) + ($.default /.nat/8) + ($.default /.nat/10) + ($.default /.nat/16) + ($.default /.int/2) + ($.default /.int/8) + ($.default /.int/10) + ($.default /.int/16) + ($.default /.rev/2) + ($.default /.rev/8) + ($.default /.rev/10) + ($.default /.rev/16) + ($.default /.frac/2) + ($.default /.frac/8) + ($.default /.frac/10) + ($.default /.frac/16) + + ($.default /.mod) + ($.default /.list) + ($.default /.maybe)] + [])) diff --git a/stdlib/source/documentation/lux/data/text/regex.lux b/stdlib/source/documentation/lux/data/text/regex.lux new file mode 100644 index 000000000..2538af472 --- /dev/null +++ b/stdlib/source/documentation/lux/data/text/regex.lux @@ -0,0 +1,79 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.regex + "Create lexers using regular-expression syntax." + ["Literals" + (regex "a")] + ["Wildcards" + (regex ".")] + ["Escaping" + (regex "\.")] + ["Character classes" + (regex "\d") + (regex "\p{Lower}") + (regex "[abc]") + (regex "[a-z]") + (regex "[a-zA-Z]") + (regex "[a-z&&[def]]")] + ["Negation" + (regex "[^abc]") + (regex "[^a-z]") + (regex "[^a-zA-Z]") + (regex "[a-z&&[^bc]]") + (regex "[a-z&&[^m-p]]")] + ["Combinations" + (regex "aa") + (regex "a?") + (regex "a*") + (regex "a+")] + ["Specific amounts" + (regex "a{2}")] + ["At least" + (regex "a{1,}")] + ["At most" + (regex "a{,1}")] + ["Between" + (regex "a{1,2}")] + ["Groups" + (regex "a(.)c") + (regex "a(b+)c") + (regex "(\d{3})-(\d{3})-(\d{4})") + (regex "(\d{3})-(?:\d{3})-(\d{4})") + (regex "(?\d{3})-\k-(\d{4})") + (regex "(?\d{3})-\k-(\d{4})-\0") + (regex "(\d{3})-((\d{3})-(\d{4}))")] + ["Alternation" + (regex "a|b") + (regex "a(.)(.)|b(.)(.)")]) + +(documentation: /.^regex + "Allows you to test text against regular expressions." + [(case some_text + (^regex "(\d{3})-(\d{3})-(\d{4})" + [_ country_code area_code place_code]) + do_some_thing_when_number + + (^regex "\w+") + do_some_thing_when_word + + _ + do_something_else)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..regex + ..^regex + ($.default /.incorrect_quantification)] + [])) diff --git a/stdlib/source/documentation/lux/data/text/unicode.lux b/stdlib/source/documentation/lux/data/text/unicode.lux new file mode 100644 index 000000000..b170ae516 --- /dev/null +++ b/stdlib/source/documentation/lux/data/text/unicode.lux @@ -0,0 +1,19 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]] + [collection + ["." list]]]]] + ["." / #_ + ["#." block] + ["#." set]]) + +(.def: .public documentation + (.List $.Module) + (list.together + (list /block.documentation + /set.documentation + ))) diff --git a/stdlib/source/documentation/lux/data/text/unicode/block.lux b/stdlib/source/documentation/lux/data/text/unicode/block.lux new file mode 100644 index 000000000..703ac9f58 --- /dev/null +++ b/stdlib/source/documentation/lux/data/text/unicode/block.lux @@ -0,0 +1,265 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + ["." text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]] + [math + [number + ["." nat ("#\." hex)]]]]] + [\\library + ["." /]]) + +(documentation: /.Block + "A block of valid unicode characters.") + +(documentation: /.block + "" + [(block start additional)]) + +(documentation: /.within? + "" + [(within? block char)]) + +(template [] + [(documentation: + (let [[_ name] (name_of )] + (format (nat\encode (/.start )) + "-" (nat\encode (/.end )) + " | " (text.replaced "_" " " name))))] + + [/.basic_latin] + [/.latin_1_supplement] + [/.latin_extended_a] + [/.latin_extended_b] + [/.ipa_extensions] + [/.spacing_modifier_letters] + [/.combining_diacritical_marks] + [/.greek_and_coptic] + [/.cyrillic] + [/.cyrillic_supplementary] + [/.armenian] + [/.hebrew] + [/.arabic] + [/.syriac] + [/.thaana] + [/.devanagari] + [/.bengali] + [/.gurmukhi] + [/.gujarati] + [/.oriya] + [/.tamil] + [/.telugu] + [/.kannada] + [/.malayalam] + [/.sinhala] + [/.thai] + [/.lao] + [/.tibetan] + [/.myanmar] + [/.georgian] + [/.hangul_jamo] + [/.ethiopic] + [/.cherokee] + [/.unified_canadian_aboriginal_syllabics] + [/.ogham] + [/.runic] + [/.tagalog] + [/.hanunoo] + [/.buhid] + [/.tagbanwa] + [/.khmer] + [/.mongolian] + [/.limbu] + [/.tai_le] + [/.khmer_symbols] + [/.phonetic_extensions] + [/.latin_extended_additional] + [/.greek_extended] + [/.general_punctuation] + [/.superscripts_and_subscripts] + [/.currency_symbols] + [/.combining_diacritical_marks_for_symbols] + [/.letterlike_symbols] + [/.number_forms] + [/.arrows] + [/.mathematical_operators] + [/.miscellaneous_technical] + [/.control_pictures] + [/.optical_character_recognition] + [/.enclosed_alphanumerics] + [/.box_drawing] + [/.block_elements] + [/.geometric_shapes] + [/.miscellaneous_symbols] + [/.dingbats] + [/.miscellaneous_mathematical_symbols_a] + [/.supplemental_arrows_a] + [/.braille_patterns] + [/.supplemental_arrows_b] + [/.miscellaneous_mathematical_symbols_b] + [/.supplemental_mathematical_operators] + [/.miscellaneous_symbols_and_arrows] + [/.cjk_radicals_supplement] + [/.kangxi_radicals] + [/.ideographic_description_characters] + [/.cjk_symbols_and_punctuation] + [/.hiragana] + [/.katakana] + [/.bopomofo] + [/.hangul_compatibility_jamo] + [/.kanbun] + [/.bopomofo_extended] + [/.katakana_phonetic_extensions] + [/.enclosed_cjk_letters_and_months] + [/.cjk_compatibility] + [/.cjk_unified_ideographs_extension_a] + [/.yijing_hexagram_symbols] + [/.cjk_unified_ideographs] + [/.yi_syllables] + [/.yi_radicals] + [/.hangul_syllables] + [/.high_surrogates] + [/.high_private_use_surrogates] + [/.low_surrogates] + [/.private_use_area] + [/.cjk_compatibility_ideographs] + [/.alphabetic_presentation_forms] + [/.arabic_presentation_forms_a] + [/.variation_selectors] + [/.combining_half_marks] + [/.cjk_compatibility_forms] + [/.small_form_variants] + [/.arabic_presentation_forms_b] + [/.halfwidth_and_fullwidth_forms] + [/.specials] + [/.basic_latin/decimal] + [/.basic_latin/upper] + [/.basic_latin/lower] + ) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Block + ..block + ..within? + ..basic_latin + ..latin_1_supplement + ..latin_extended_a + ..latin_extended_b + ..ipa_extensions + ..spacing_modifier_letters + ..combining_diacritical_marks + ..greek_and_coptic + ..cyrillic + ..cyrillic_supplementary + ..armenian + ..hebrew + ..arabic + ..syriac + ..thaana + ..devanagari + ..bengali + ..gurmukhi + ..gujarati + ..oriya + ..tamil + ..telugu + ..kannada + ..malayalam + ..sinhala + ..thai + ..lao + ..tibetan + ..myanmar + ..georgian + ..hangul_jamo + ..ethiopic + ..cherokee + ..unified_canadian_aboriginal_syllabics + ..ogham + ..runic + ..tagalog + ..hanunoo + ..buhid + ..tagbanwa + ..khmer + ..mongolian + ..limbu + ..tai_le + ..khmer_symbols + ..phonetic_extensions + ..latin_extended_additional + ..greek_extended + ..general_punctuation + ..superscripts_and_subscripts + ..currency_symbols + ..combining_diacritical_marks_for_symbols + ..letterlike_symbols + ..number_forms + ..arrows + ..mathematical_operators + ..miscellaneous_technical + ..control_pictures + ..optical_character_recognition + ..enclosed_alphanumerics + ..box_drawing + ..block_elements + ..geometric_shapes + ..miscellaneous_symbols + ..dingbats + ..miscellaneous_mathematical_symbols_a + ..supplemental_arrows_a + ..braille_patterns + ..supplemental_arrows_b + ..miscellaneous_mathematical_symbols_b + ..supplemental_mathematical_operators + ..miscellaneous_symbols_and_arrows + ..cjk_radicals_supplement + ..kangxi_radicals + ..ideographic_description_characters + ..cjk_symbols_and_punctuation + ..hiragana + ..katakana + ..bopomofo + ..hangul_compatibility_jamo + ..kanbun + ..bopomofo_extended + ..katakana_phonetic_extensions + ..enclosed_cjk_letters_and_months + ..cjk_compatibility + ..cjk_unified_ideographs_extension_a + ..yijing_hexagram_symbols + ..cjk_unified_ideographs + ..yi_syllables + ..yi_radicals + ..hangul_syllables + ..high_surrogates + ..high_private_use_surrogates + ..low_surrogates + ..private_use_area + ..cjk_compatibility_ideographs + ..alphabetic_presentation_forms + ..arabic_presentation_forms_a + ..variation_selectors + ..combining_half_marks + ..cjk_compatibility_forms + ..small_form_variants + ..arabic_presentation_forms_b + ..halfwidth_and_fullwidth_forms + ..specials + ..basic_latin/decimal + ..basic_latin/upper + ..basic_latin/lower + ($.default /.monoid) + ($.default /.start) + ($.default /.end) + ($.default /.size) + ($.default /.equivalence) + ($.default /.hash)] + [])) diff --git a/stdlib/source/documentation/lux/data/text/unicode/set.lux b/stdlib/source/documentation/lux/data/text/unicode/set.lux new file mode 100644 index 000000000..55a114882 --- /dev/null +++ b/stdlib/source/documentation/lux/data/text/unicode/set.lux @@ -0,0 +1,42 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [data + [text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.set + "" + [(set [head tail])]) + +(documentation: /.member? + "" + [(member? set character)]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..set + ..member? + ($.default /.Set) + ($.default /.composite) + ($.default /.character) + ($.default /.non_character) + ($.default /.full) + ($.default /.start) + ($.default /.end) + ($.default /.equivalence) + + ($.default /.ascii) + ($.default /.ascii/alpha) + ($.default /.ascii/alpha_num) + ($.default /.ascii/numeric) + ($.default /.ascii/upper) + ($.default /.ascii/lower)] + [])) diff --git a/stdlib/source/documentation/lux/debug.lux b/stdlib/source/documentation/lux/debug.lux new file mode 100644 index 000000000..37832c4bf --- /dev/null +++ b/stdlib/source/documentation/lux/debug.lux @@ -0,0 +1,80 @@ +(.module: + [library + [lux (#- private) + ["$" documentation (#+ documentation:)] + [data + ["." text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.inspection + "A best-effort attempt to generate a textual representation of a value, without knowing its type." + [(inspection value)]) + +(documentation: /.representation + "A best-effort attempt to generate a textual representation of a value, while knowing its type." + [(representation type value)]) + +(documentation: /.private + "Allows access to un-exported definitions in other modules." + ["Module A" + (def: .private (secret_definition input) + (-> ??? ???) + (foo (bar (baz input)))) + "Module B" + ((/.private secret_definition) my_input)]) + +(documentation: /.log! + "Prints/writes a message to standard output." + [(log! message)]) + +(documentation: /.:hole + (format "A typed 'hole'." + \n "Reveals the type expected of the expression that should go in the hole.") + [(: (-> Nat Text) + (function (_ number) + (:hole))) + "=>" + .Text]) + +(documentation: /.here + "Shows the names and values of local bindings available around the call to 'here'." + [(let [foo 123 + bar +456 + baz +789.0] + (: Any + (here))) + "=>" + "foo: +123" + "bar: +456" + "baz: +789.0" + []] + ["Can optionally be given a list of definitions to focus on." + "These definitions to focus on can include custom format to represent the values." + (let [foo 123 + bar +456 + baz +789.0] + (: Any + (here {foo %.nat} baz))) + "=>" + "foo: 123" + "baz: +789.0" + []]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..inspection + ..representation + ..private + ..log! + ..:hole + ..here + ($.default /.cannot_represent_value) + ($.default /.type_hole) + ($.default /.unknown_local_binding)] + [])) diff --git a/stdlib/source/documentation/lux/documentation.lux b/stdlib/source/documentation/lux/documentation.lux new file mode 100644 index 000000000..0c8b0722f --- /dev/null +++ b/stdlib/source/documentation/lux/documentation.lux @@ -0,0 +1,49 @@ +(.module: + [library + [lux #* + [data + ["." text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(/.documentation: /.default + "" + [(: /.Definition + (default ..definition))]) + +(/.documentation: /.documentation: + "" + [(documentation: /.default + "" + [(: /.Definition + (default ..definition))])]) + +(/.documentation: /.module + "" + [(: (.List /.Module) + (module /._ + "" + [..default + ..documentation: + ..module + (/.default /.unqualified_identifier) + (/.default /.Definition) + (/.default /.Module) + (/.default /.documentation)] + []))]) + +(.def: .public documentation + (.List /.Module) + (/.module /._ + "" + [..default + ..documentation: + ..module + (/.default /.unqualified_identifier) + (/.default /.Definition) + (/.default /.Module) + (/.default /.documentation)] + [])) diff --git a/stdlib/source/documentation/lux/ffi.lux b/stdlib/source/documentation/lux/ffi.lux new file mode 100644 index 000000000..89829884b --- /dev/null +++ b/stdlib/source/documentation/lux/ffi.lux @@ -0,0 +1,336 @@ +(.module: + [library + [lux (#- int char interface: type :as) + ["$" documentation (#+ documentation:)] + [data + ["." text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(template [] + [(`` (documentation: + (format "The type of a (boxed) " (~~ (template.text [])) " object.")))] + + [/.Boolean] + [/.Byte] + [/.Short] + [/.Integer] + [/.Long] + [/.Float] + [/.Double] + [/.Character] + ) + +(template [] + [(`` (documentation: + (format "The type of an (unboxed) " (~~ (template.text [])) " value.")))] + + [/.boolean] + [/.byte] + [/.short] + [/.int] + [/.long] + [/.float] + [/.double] + [/.char] + ) + +(template [ ] + [(`` (documentation: + "Type converter." + [(: + ( (: foo)))]))] + + [/.byte_to_long Byte Long] + + [/.short_to_long Short Long] + + [/.double_to_int Double Integer] + [/.double_to_long Double Long] + [/.double_to_float Double Float] + + [/.float_to_int Float Integer] + [/.float_to_long Float Long] + [/.float_to_double Float Double] + + [/.int_to_byte Integer Byte] + [/.int_to_short Integer Short] + [/.int_to_long Integer Long] + [/.int_to_float Integer Float] + [/.int_to_double Integer Double] + [/.int_to_char Integer Character] + + [/.long_to_byte Long Byte] + [/.long_to_short Long Short] + [/.long_to_int Long Integer] + [/.long_to_float Long Float] + [/.long_to_double Long Double] + + [/.char_to_byte Character Byte] + [/.char_to_short Character Short] + [/.char_to_int Character Integer] + [/.char_to_long Character Long] + + [/.long_to_char Long Character] + [/.byte_to_int Byte Integer] + [/.short_to_int Short Integer] + [/.byte_to_char Byte Character] + [/.short_to_char Short Character] + ) + +(documentation: /.class: + "Allows defining JVM classes in Lux code." + [(class: #final (TestClass A) [Runnable] + ... Fields + (#private foo boolean) + (#private bar A) + (#private baz java/lang/Object) + ... Methods + (#public [] (new [value A]) [] + (exec + (:= ::foo #1) + (:= ::bar value) + (:= ::baz "") + [])) + (#public (virtual) java/lang/Object + "") + (#public #static (static) java/lang/Object + "") + (Runnable [] (run) void + []) + ) + + "The tuple corresponds to parent interfaces." + "An optional super-class can be specified before the tuple. If not specified, java.lang.Object will be assumed." + "Fields and methods defined in the class can be used with special syntax." + "For example:" + "::resolved, for accessing the 'resolved' field." + "(:= ::resolved #1) for modifying it." + "(::new! []) for calling the class's constructor." + "(::resolve! container [value]) for calling the 'resolve' method."]) + +(documentation: /.interface: + "Allows defining JVM interfaces." + [(interface: TestInterface + ([] foo [boolean String] void #throws [Exception]))]) + +(documentation: /.object + "Allows defining anonymous classes." + ["The 1st tuple corresponds to class-level type-variables." + "The 2nd tuple corresponds to parent interfaces." + "The 3rd tuple corresponds to arguments to the super class constructor." + "An optional super-class can be specified before the 1st tuple. If not specified, java.lang.Object will be assumed." + (object [] [Runnable] + [] + (Runnable [] (run self) void + (exec + (do_something some_value) + [])))]) + +(documentation: /.null + "The null pointer." + [(null)]) + +(documentation: /.null? + "Test for the null pointer." + [(= true + (null? (null)))] + [(= false + (null? "YOLO"))]) + +(documentation: /.??? + "Takes a (potentially null) ObjectType reference and creates a (Maybe ObjectType) for it." + [(= (??? (: java/lang/String (null))) + #.None)] + [(= (??? "YOLO") + (#.Some "YOLO"))]) + +(documentation: /.!!! + (format "Takes a (Maybe ObjectType) and returns a ObjectType." + \n "A #.None would get translated into a (null).") + [(= (null) + (!!! (??? (: java/lang/Thread (null)))))] + [(= "foo" + (!!! (??? "foo")))]) + +(documentation: /.check + (format "Checks whether an object is an instance of a particular class." + \n "Caveat emptor: Cannot check for polymorphism, so avoid using parameterized classes.") + [(case (check String "YOLO") + (#.Some value_as_string) + #.None)]) + +(documentation: /.synchronized + "Evaluates body, while holding a lock on a given object." + [(synchronized object_to_be_locked + (exec + (do something) + (dosomething else) + (finish the computation)))]) + +(documentation: /.do_to + "Call a variety of methods on an object. Then, return the object." + [(do_to object + (ClassName::method1 arg0 arg1 arg2) + (ClassName::method2 arg3 arg4 arg5))]) + +(documentation: /.import: + "Allows importing JVM classes, and using them as types." + ["Their methods, fields and enum options can also be imported." + (import: java/lang/Object + ["#::." + (new []) + (equals [java/lang/Object] boolean) + (wait [int] #io #try void)])] + ["Special options can also be given for the return values." + "#? means that the values will be returned inside a Maybe type. That way, null becomes #.None." + "#try means that the computation might throw an exception, and the return value will be wrapped by the Try type." + "#io means the computation has side effects, and will be wrapped by the IO type." + "These options must show up in the following order [#io #try #?] (although, each option can be used independently)." + (import: java/lang/String + ["#::." + (new [[byte]]) + (#static valueOf [char] java/lang/String) + (#static valueOf #as int_valueOf [int] java/lang/String)]) + + (import: (java/util/List e) + ["#::." + (size [] int) + (get [int] e)]) + + (import: (java/util/ArrayList a) + ["#::." + ([T] toArray [[T]] [T])])] + ["The class-type that is generated is of the fully-qualified name." + "This avoids a clash between the java.util.List type, and Lux's own List type." + "All enum options to be imported must be specified." + (import: java/lang/Character$UnicodeScript + ["#::." + (#enum ARABIC CYRILLIC LATIN)])] + ["It should also be noted, the only types that may show up in method arguments or return values may be Java classes, arrays, primitives, void or type-vars." + "Lux types, such as Maybe cannot be named (otherwise, they'd be confused for Java classes)." + (import: (lux/concurrency/async/JvmAsync A) + ["#::." + (resolve [A] boolean) + (poll [] A) + (wasResolved [] boolean) + (waitOn [lux/Function] void) + (#static [A] make [A] (lux/concurrency/async/JvmAsync A))])] + ["Also, the names of the imported members will look like Class::member" + (java/lang/Object::new []) + (java/lang/Object::equals [other_object] my_object) + (java/util/List::size [] my_list) + java/lang/Character$UnicodeScript::LATIN]) + +(documentation: /.array + "Create an array of the given type, with the given size." + [(array java/lang/Object 10)]) + +(documentation: /.length + "Gives the length of an array." + [(length my_array)]) + +(documentation: /.read! + "Loads an element from an array." + [(read! 10 my_array)]) + +(documentation: /.write! + "Stores an element into an array." + [(write! 10 my_object my_array)]) + +(documentation: /.class_for + "Loads the class as a java.lang.Class object." + [(class_for java/lang/String)]) + +(documentation: /.type + "" + [(: Type + (type java/lang/String))]) + +(documentation: /.:as + "" + [(:as java/lang/Object + (: java/lang/String + ???))]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..Boolean + ..Byte + ..Short + ..Integer + ..Long + ..Float + ..Double + ..Character + + ..boolean + ..byte + ..short + ..int + ..long + ..float + ..double + ..char + + ..byte_to_long + ..short_to_long + ..double_to_int + ..double_to_long + ..double_to_float + ..float_to_int + ..float_to_long + ..float_to_double + ..int_to_byte + ..int_to_short + ..int_to_long + ..int_to_float + ..int_to_double + ..int_to_char + ..long_to_byte + ..long_to_short + ..long_to_int + ..long_to_float + ..long_to_double + ..char_to_byte + ..char_to_short + ..char_to_int + ..char_to_long + ..long_to_char + ..byte_to_int + ..short_to_int + ..byte_to_char + ..short_to_char + + ..class: + ..interface: + ..object + ..null + ..null? + ..??? + ..!!! + ..check + ..synchronized + ..do_to + ..import: + ..array + ..length + ..read! + ..write! + ..class_for + ..type + ..:as + ($.default /.Privacy) + ($.default /.State) + ($.default /.Inheritance) + ($.default /.class_names_cannot_contain_periods) + ($.default /.class_name_cannot_be_a_type_variable) + ($.default /.unexpected_type_variable) + ($.default /.cannot_convert_to_jvm_type) + ($.default /.cannot_cast_to_non_object)] + [])) diff --git a/stdlib/source/documentation/lux/program.lux b/stdlib/source/documentation/lux/program.lux new file mode 100644 index 000000000..15a916d71 --- /dev/null +++ b/stdlib/source/documentation/lux/program.lux @@ -0,0 +1,33 @@ +(.module: + [library + [lux #* + ["$" documentation (#+ documentation:)] + [control + ["." io]] + [data + ["." text (#+ \n) + ["%" format (#+ format)]]] + [macro + ["." template]]]] + [\\library + ["." /]]) + +(documentation: /.program: + "Defines the entry-point to a program (similar to the 'main' function/method in other programming languages)." + ["Can take a list of all the input parameters to the program." + (program: all_arguments + (do io.monad + [foo (initialize program)] + (do_something_with all_arguments)))] + ["Can also parse them using CLI parsers from the library/lux/control/parser/cli module." + (program: [config configuration_parser] + (do io.monad + [data (initialize program with config)] + (do_something_with data)))]) + +(.def: .public documentation + (.List $.Module) + ($.module /._ + "" + [..program:] + [])) -- cgit v1.2.3