diff options
Diffstat (limited to '')
25 files changed, 389 insertions, 505 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index 1819cb426..6e008a209 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -27,7 +27,6 @@ ["[1][0]" meta] ["[1][0]" program] ["[1][0]" static] - ["[1][0]" target] ["[1][0]" test] ["[1][0]" time] ["[1][0]" tool] ... TODO: Documentation for this @@ -899,7 +898,6 @@ /meta.documentation /program.documentation /static.documentation - /target.documentation /test.documentation /time.documentation /tool.documentation diff --git a/stdlib/source/documentation/lux/control/parser/json.lux b/stdlib/source/documentation/lux/control/parser/json.lux deleted file mode 100644 index 89ab7f9f1..000000000 --- a/stdlib/source/documentation/lux/control/parser/json.lux +++ /dev/null @@ -1,93 +0,0 @@ -(.require - [library - [lux (.except) - ["$" documentation (.only documentation:)] - [data - [text (.only \n) - ["%" \\format (.only format)]]] - [meta - [macro - ["[0]" template]]]]] - [\\library - ["[0]" /]]) - -(documentation: (/.Parser it) - "A JSON parser.") - -(documentation: /.result - (format "Executes the parser against a JSON object." - \n "Verifies that all of the JSON was consumed by the parser.") - [(result parser json)]) - -(documentation: /.any - "Just returns the JSON input without applying any logic.") - -(with_template [<name>] - [(`` (documentation: <name> - (format "Reads a JSON value as " (,, (template.text [<name>])) ".")))] - - [/.null] - [/.boolean] - [/.number] - [/.string] - ) - -(with_template [<test> <check> <read>] - [(`` (documentation: <test> - (format "Asks whether a JSON value is a " (,, (template.text [<read>])) "."))) - (`` (documentation: <check> - (format "Ensures a JSON value is a " (,, (template.text [<read>])) ".")))] - - [/.boolean? /.this_boolean ..boolean] - [/.number? /.this_number ..number] - [/.string? /.this_string ..string] - ) - -(documentation: /.nullable - "Enhances parser by adding NULL-handling." - [(nullable parser)]) - -(documentation: /.array - "Parses the contents of a JSON array." - [(array parser)]) - -(documentation: /.object - (format "Parses the contents of a JSON object." - \n "Use this with the 'field' combinator.") - [(object parser)]) - -(documentation: /.field - (format "Parses a field inside a JSON object." - \n "Use this inside the 'object' combinator.") - [(field field_name parser)]) - -(documentation: /.dictionary - "Parses a dictionary-like JSON object.") - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Parser - ..result - ..any - - ..null - ..boolean - ..number - ..string - - ..boolean? ..this_boolean - ..number? ..this_number - ..string? ..this_string - - ..nullable - ..array - ..object - ..field - ..dictionary - ($.default /.unconsumed_input) - ($.default /.empty_input) - ($.default /.unexpected_value) - ($.default /.value_mismatch)] - [])) diff --git a/stdlib/source/documentation/lux/control/parser/text.lux b/stdlib/source/documentation/lux/control/parser/text.lux deleted file mode 100644 index aa0641d5b..000000000 --- a/stdlib/source/documentation/lux/control/parser/text.lux +++ /dev/null @@ -1,215 +0,0 @@ -(.require - [library - [lux (.except and not local) - ["$" documentation (.only documentation:)] - [data - [text (.only \n) - ["%" \\format (.only format)]]] - [meta - [macro - ["[0]" template]]]]] - [\\library - ["[0]" /]]) - -(documentation: /.Offset - "An offset into a block of text.") - -(documentation: (/.Parser it) - "A parser for text.") - -(documentation: /.Slice - "A slice of a block of text.") - -(documentation: /.result - (format "Executes a parser against a block of text." - \n "Verifies that the entire input has been processed.") - [(result parser input)]) - -(documentation: /.offset - "Yields the current offset into the input.") - -(documentation: /.any - "Yields the next character without applying any logic.") - -(documentation: /.any! - "Yields the next character (as a slice) without applying any logic.") - -(with_template [<name> <caveat>] - [(`` (documentation: <name> - (format "Produce a character" (,, (template.text [<caveat>])) " if the parser fails.")))] - - [/.not ""] - [/.not! " (as a slice)"] - ) - -(documentation: /.this - "Checks that a specific text shows up in the input." - [(this reference)]) - -(documentation: /.end - "Ensure the parser's input is empty.") - -(documentation: /.next - "Yields the next character (without consuming it from the input).") - -(documentation: /.remaining - "Get all of the remaining input (without consuming it).") - -(documentation: /.range - "Only yields characters within a range." - [(range bottom top)]) - -(with_template [<name> <desc>] - [(documentation: <name> - (format "Only yields " <desc> " characters."))] - - [/.upper "uppercase"] - [/.lower "lowercase"] - [/.decimal "decimal"] - [/.octal "octal"] - ) - -(documentation: /.alpha - "Yields alphabetic characters.") - -(documentation: /.alpha_num - "Yields alphanumeric characters.") - -(documentation: /.hexadecimal - "Yields hexadecimal digits.") - -(with_template [<name> <description_modifier>] - [(documentation: <name> - (format "Yields characters that are" <description_modifier> " part of a piece of text."))] - - [/.one_of ""] - [/.none_of " not"] - ) - -(with_template [<name> <description_modifier>] - [(documentation: <name> - (format "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text."))] - - [/.one_of! ""] - [/.none_of! " not"] - ) - -(documentation: /.satisfies - "Yields characters that satisfy a predicate." - [(satisfies parser)]) - -(documentation: /.space - "Yields white-space.") - -(documentation: /.and - "Yields the outputs of both parsers composed together." - [(and left right)]) - -(documentation: /.and! - "Yields the outputs of both parsers composed together (as a slice)." - [(and! left right)]) - -(with_template [<text> <slice>] - [(`` (documentation: <text> - (format "Yields " (,, (template.text [<name>])) " characters as a single continuous text."))) - (`` (documentation: <slice> - (format "Yields " (,, (template.text [<name>])) " characters as a single continuous text (as a slice).")))] - - [/.some /.some!] - [/.many /.many!] - ) - -(with_template [<text> <slice> <doc_modifier>] - [(`` (documentation: <text> - (format "Yields " <doc_modifier> " N characters."))) - (`` (documentation: <slice> - (format "Yields " <doc_modifier> " N characters (as a slice).")))] - - [/.exactly /.exactly! "exactly"] - [/.at_most /.at_most! "at most"] - [/.at_least /.at_least! "at least"] - ) - -(documentation: /.between - "" - [(between minimum additional parser)]) - -(documentation: /.between! - "" - [(between! minimum additional parser)]) - -(documentation: /.enclosed - "" - [(enclosed [start end] parser)]) - -(documentation: /.local - "Applies a parser against the given input." - [(local local_input parser)]) - -(documentation: /.slice - "Converts a slice to a block of text." - [(slice parser)]) - -(documentation: /.then - "Embeds a text parser into an arbitrary parser that yields text." - [(then structured text)]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Offset - ..Parser - ..Slice - ..result - ..offset - - ..any ..any! - ..not ..not! - - ..this - ..end - ..next - ..remaining - ..range - - ..upper - ..lower - ..decimal - ..octal - - ..alpha - ..alpha_num - ..hexadecimal - - ..one_of ..one_of! - ..none_of ..none_of! - - ..satisfies - ..space - ..and ..and! - - ..some ..some! - ..many ..many! - - - ..exactly ..exactly! - ..at_most ..at_most! - ..at_least ..at_least! - - ..between - ..between! - ..enclosed - ..local - ..slice - ..then - - ($.default /.unconsumed_input) - ($.default /.expected_to_fail) - ($.default /.cannot_parse) - ($.default /.cannot_slice) - ($.default /.cannot_match) - ($.default /.character_should_be) - ($.default /.character_should_not_be) - ($.default /.character_does_not_satisfy_predicate)] - [])) diff --git a/stdlib/source/documentation/lux/control/parser/tree.lux b/stdlib/source/documentation/lux/control/parser/tree.lux deleted file mode 100644 index e9c4cd289..000000000 --- a/stdlib/source/documentation/lux/control/parser/tree.lux +++ /dev/null @@ -1,70 +0,0 @@ -(.require - [library - [lux (.except left right) - ["$" documentation (.only documentation:)] - [data - [text (.only \n) - ["%" \\format (.only format)]]]]] - [\\library - ["[0]" /]]) - -(documentation: (/.Parser it) - "A parser of arbitrary trees.") - -(documentation: /.result' - "Applies the parser against a tree zipper." - [(result' parser zipper)]) - -(documentation: /.result - "Applies the parser against a tree." - [(result parser tree)]) - -(documentation: /.value - "Yields the value inside the current tree node.") - -(with_template [<name> <doc>] - [(documentation: <name> - <doc>)] - - [/.down "Move down."] - [/.up "Move up."] - - [/.right "Move to the right."] - [/.rightmost "Move to the rightmost node."] - - [/.left "Move to the left."] - [/.leftmost "Move to the leftmost node."] - - [/.next "Move to the next node."] - [/.end "Move to the last node."] - - [/.previous "Move to the previous node."] - [/.start "Move to the root node."] - ) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Parser - ..result' - ..result - ..value - - ..down - ..up - - ..right - ..rightmost - - ..left - ..leftmost - - ..next - ..end - - ..previous - ..start - - ($.default /.cannot_move_further)] - [])) diff --git a/stdlib/source/documentation/lux/control/parser/xml.lux b/stdlib/source/documentation/lux/control/parser/xml.lux deleted file mode 100644 index c5ca5af74..000000000 --- a/stdlib/source/documentation/lux/control/parser/xml.lux +++ /dev/null @@ -1,58 +0,0 @@ -(.require - [library - [lux (.except) - ["$" documentation (.only documentation:)] - [data - [text (.only \n) - ["%" \\format (.only format)]]]]] - [\\library - ["[0]" /]]) - -(documentation: (/.Parser it) - "A parser of XML-encoded data.") - -(documentation: /.result - (format "Applies a parser against a stream of XML documents." - \n "Verifies that all of the inputs are consumed by the parser.") - [(result parser documents)]) - -(documentation: /.text - "Yields text from a text node.") - -(documentation: /.tag - "Yields the tag from the next node.") - -(documentation: /.attribute - "Yields the value of an attribute in the current node." - [(attribute name)]) - -(documentation: /.node - "Parses the contents of the next node if the tag matches." - [(node expected parser)]) - -(documentation: /.any - "Yields the next node.") - -(documentation: /.somewhere - "Applies the parser somewhere among the remaining inputs; instead of demanding that the parser succeeds against the immediate inputs." - [(somewhere parser)]) - -(.def .public documentation - (.List $.Module) - ($.module /._ - "" - [..Parser - ..result - ..text - ..tag - ..attribute - ..node - ..any - ..somewhere - ($.default /.empty_input) - ($.default /.unexpected_input) - ($.default /.wrong_tag) - ($.default /.unknown_attribute) - ($.default /.unconsumed_inputs) - ($.default /.nowhere)] - [])) diff --git a/stdlib/source/documentation/lux/data/collection/tree.lux b/stdlib/source/documentation/lux/data/collection/tree.lux index f0d165a5b..fca76d251 100644 --- a/stdlib/source/documentation/lux/data/collection/tree.lux +++ b/stdlib/source/documentation/lux/data/collection/tree.lux @@ -5,12 +5,54 @@ [data ["[0]" text (.only \n) ["%" \\format (.only format)]]]]] + ["[0]" \\parser] [\\library ["[0]" /]] ["[0]" / ["[1][0]" finger] ["[1][0]" zipper]]) +(`` (.def \\parser + (.List $.Module) + ($.module \\parser._ + "" + [($.default \\parser.cannot_move_further) + + ($.documentation (\\parser.Parser it) + "A parser of arbitrary trees.") + + ($.documentation \\parser.result' + "Applies the parser against a tree zipper." + [(result' parser zipper)]) + + ($.documentation \\parser.result + "Applies the parser against a tree." + [(result parser tree)]) + + ($.documentation \\parser.value + "Yields the value inside the current tree node.") + + (,, (with_template [<name> <doc>] + [($.documentation <name> + <doc>)] + + [\\parser.down "Move down."] + [\\parser.up "Move up."] + + [\\parser.right "Move to the right."] + [\\parser.rightmost "Move to the rightmost node."] + + [\\parser.left "Move to the left."] + [\\parser.leftmost "Move to the leftmost node."] + + [\\parser.next "Move to the next node."] + [\\parser.end "Move to the last node."] + + [\\parser.previous "Move to the previous node."] + [\\parser.start "Move to the root node."] + ))] + []))) + (.def .public documentation (.List $.Module) ($.module /._ @@ -41,5 +83,7 @@ {34 {} 56 {} 78 {90 {}}}))])] - [/finger.documentation + [..\\parser + + /finger.documentation /zipper.documentation])) diff --git a/stdlib/source/documentation/lux/data/format/json.lux b/stdlib/source/documentation/lux/data/format/json.lux index 25026ef6f..d263a0dfa 100644 --- a/stdlib/source/documentation/lux/data/format/json.lux +++ b/stdlib/source/documentation/lux/data/format/json.lux @@ -4,10 +4,77 @@ ["$" documentation] [data [text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]]] + [meta + [macro + ["[0]" template]]]]] + ["[0]" \\parser] [\\library ["[0]" /]]) +(`` (.def \\parser + (.List $.Module) + ($.module \\parser._ + "" + [($.default \\parser.unconsumed_input) + ($.default \\parser.empty_input) + ($.default \\parser.unexpected_value) + ($.default \\parser.value_mismatch) + + ($.documentation (\\parser.Parser it) + "A JSON parser.") + + ($.documentation \\parser.result + (format "Executes the parser against a JSON object." + \n "Verifies that all of the JSON was consumed by the parser.") + [(result parser json)]) + + ($.documentation \\parser.any + "Just returns the JSON input without applying any logic.") + + (,, (with_template [<name>] + [(`` ($.documentation <name> + (format "Reads a JSON value as " (,, (template.text [<name>])) ".")))] + + [\\parser.null] + [\\parser.boolean] + [\\parser.number] + [\\parser.string] + )) + + (,, (with_template [<test> <check> <read>] + [(`` ($.documentation <test> + (format "Asks whether a JSON value is a " (,, (template.text [<read>])) "."))) + (`` ($.documentation <check> + (format "Ensures a JSON value is a " (,, (template.text [<read>])) ".")))] + + [\\parser.boolean? \\parser.this_boolean ..boolean] + [\\parser.number? \\parser.this_number ..number] + [\\parser.string? \\parser.this_string ..string] + )) + + ($.documentation \\parser.nullable + "Enhances parser by adding NULL-handling." + [(nullable parser)]) + + ($.documentation \\parser.array + "Parses the contents of a JSON array." + [(array parser)]) + + ($.documentation \\parser.object + (format "Parses the contents of a JSON object." + \n "Use this with the 'field' combinator.") + [(object parser)]) + + ($.documentation \\parser.field + (format "Parses a field inside a JSON object." + \n "Use this inside the 'object' combinator.") + [(field field_name parser)]) + + ($.documentation \\parser.dictionary + "Parses a dictionary-like JSON object.")] + []))) + (`` (.def .public documentation (.List $.Module) ($.module /._ @@ -63,4 +130,4 @@ [/.array_field "arrays"] [/.object_field "objects"] ))] - []))) + [..\\parser]))) diff --git a/stdlib/source/documentation/lux/data/format/xml.lux b/stdlib/source/documentation/lux/data/format/xml.lux index d49299af6..70f4855b0 100644 --- a/stdlib/source/documentation/lux/data/format/xml.lux +++ b/stdlib/source/documentation/lux/data/format/xml.lux @@ -5,9 +5,51 @@ [data [text (.only \n) ["%" \\format (.only format)]]]]] + ["[0]" \\parser] [\\library ["[0]" /]]) +(.def \\parser + (.List $.Module) + ($.module \\parser._ + "" + [($.default \\parser.empty_input) + ($.default \\parser.unexpected_input) + ($.default \\parser.wrong_tag) + ($.default \\parser.unknown_attribute) + ($.default \\parser.unconsumed_inputs) + ($.default \\parser.nowhere) + + ($.documentation (\\parser.Parser it) + "A parser of XML-encoded data.") + + ($.documentation \\parser.result + (format "Applies a parser against a stream of XML documents." + \n "Verifies that all of the inputs are consumed by the parser.") + [(result parser documents)]) + + ($.documentation \\parser.text + "Yields text from a text node.") + + ($.documentation \\parser.tag + "Yields the tag from the next node.") + + ($.documentation \\parser.attribute + "Yields the value of an attribute in the current node." + [(attribute name)]) + + ($.documentation \\parser.node + "Parses the contents of the next node if the tag matches." + [(node expected parser)]) + + ($.documentation \\parser.any + "Yields the next node.") + + ($.documentation \\parser.somewhere + "Applies the parser somewhere among the remaining inputs; instead of demanding that the parser succeeds against the immediate inputs." + [(somewhere parser)])] + [])) + (.def .public documentation (.List $.Module) ($.module /._ @@ -28,4 +70,4 @@ ($.documentation /.attribute "The text format of a XML attribute.")] - [])) + [..\\parser])) diff --git a/stdlib/source/documentation/lux/data/text.lux b/stdlib/source/documentation/lux/data/text.lux index 3be4f68f6..03023fcc1 100644 --- a/stdlib/source/documentation/lux/data/text.lux +++ b/stdlib/source/documentation/lux/data/text.lux @@ -1,16 +1,20 @@ (.require [library [lux (.except) - ["$" documentation]]] + ["$" documentation] + [meta + [macro + ["[0]" template]]]]] ["[0]" / ["[1][0]" buffer] ["[1][0]" encoding] ["[1][0]" escape] ["[1][0]" regex] ["[1][0]" unicode]] - ["[0]" \\format] + ["[0]" \\format (.only format)] + ["[0]" \\parser] [\\library - ["[0]" /]]) + ["[0]" / (.only \n)]]) (.def \\format (.List $.Module) @@ -70,6 +74,163 @@ [(format "Static part " (text static) " does not match URI: " uri)])] [])) +(`` (.def \\parser + (.List $.Module) + ($.module \\parser._ + "" + [($.default \\parser.unconsumed_input) + ($.default \\parser.expected_to_fail) + ($.default \\parser.cannot_parse) + ($.default \\parser.cannot_slice) + ($.default \\parser.cannot_match) + ($.default \\parser.character_should_be) + ($.default \\parser.character_should_not_be) + ($.default \\parser.character_does_not_satisfy_predicate) + + ($.documentation \\parser.Offset + "An offset into a block of text.") + + ($.documentation (\\parser.Parser it) + "A parser for text.") + + ($.documentation \\parser.Slice + "A slice of a block of text.") + + ($.documentation \\parser.result + (format "Executes a parser against a block of text." + \n "Verifies that the entire input has been processed.") + [(result parser input)]) + + ($.documentation \\parser.offset + "Yields the current offset into the input.") + + ($.documentation \\parser.any + "Yields the next character without applying any logic.") + + ($.documentation \\parser.any! + "Yields the next character (as a slice) without applying any logic.") + + (,, (with_template [<name> <caveat>] + [(`` ($.documentation <name> + (format "Produce a character" (,, (template.text [<caveat>])) " if the parser fails.")))] + + [\\parser.not ""] + [\\parser.not! " (as a slice)"] + )) + + ($.documentation \\parser.this + "Checks that a specific text shows up in the input." + [(this reference)]) + + ($.documentation \\parser.end + "Ensure the parser's input is empty.") + + ($.documentation \\parser.next + "Yields the next character (without consuming it from the input).") + + ($.documentation \\parser.remaining + "Get all of the remaining input (without consuming it).") + + ($.documentation \\parser.range + "Only yields characters within a range." + [(range bottom top)]) + + (,, (with_template [<name> <desc>] + [($.documentation <name> + (format "Only yields " <desc> " characters."))] + + [\\parser.upper "uppercase"] + [\\parser.lower "lowercase"] + [\\parser.decimal "decimal"] + [\\parser.octal "octal"] + )) + + ($.documentation \\parser.alpha + "Yields alphabetic characters.") + + ($.documentation \\parser.alpha_num + "Yields alphanumeric characters.") + + ($.documentation \\parser.hexadecimal + "Yields hexadecimal digits.") + + (,, (with_template [<name> <description_modifier>] + [($.documentation <name> + (format "Yields characters that are" <description_modifier> " part of a piece of text."))] + + [\\parser.one_of ""] + [\\parser.none_of " not"] + )) + + (,, (with_template [<name> <description_modifier>] + [($.documentation <name> + (format "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text."))] + + [\\parser.one_of! ""] + [\\parser.none_of! " not"] + )) + + ($.documentation \\parser.satisfies + "Yields characters that satisfy a predicate." + [(satisfies parser)]) + + ($.documentation \\parser.space + "Yields white-space.") + + ($.documentation \\parser.and + "Yields the outputs of both parsers composed together." + [(and left right)]) + + ($.documentation \\parser.and! + "Yields the outputs of both parsers composed together (as a slice)." + [(and! left right)]) + + (,, (with_template [<text> <slice>] + [(`` ($.documentation <text> + (format "Yields " (,, (template.text [<name>])) " characters as a single continuous text."))) + (`` ($.documentation <slice> + (format "Yields " (,, (template.text [<name>])) " characters as a single continuous text (as a slice).")))] + + [\\parser.some \\parser.some!] + [\\parser.many \\parser.many!] + )) + + (,, (with_template [<text> <slice> <doc_modifier>] + [(`` ($.documentation <text> + (format "Yields " <doc_modifier> " N characters."))) + (`` ($.documentation <slice> + (format "Yields " <doc_modifier> " N characters (as a slice).")))] + + [\\parser.exactly \\parser.exactly! "exactly"] + [\\parser.at_most \\parser.at_most! "at most"] + [\\parser.at_least \\parser.at_least! "at least"] + )) + + ($.documentation \\parser.between + "" + [(between minimum additional parser)]) + + ($.documentation \\parser.between! + "" + [(between! minimum additional parser)]) + + ($.documentation \\parser.enclosed + "" + [(enclosed [start end] parser)]) + + ($.documentation \\parser.local + "Applies a parser against the given input." + [(local local_input parser)]) + + ($.documentation \\parser.slice + "Converts a slice to a block of text." + [(slice parser)]) + + ($.documentation \\parser.then + "Embeds a text parser into an arbitrary parser that yields text." + [(then structured text)])] + []))) + (.def .public documentation (.List $.Module) ($.module /._ @@ -197,6 +358,7 @@ "Checks whether the character is white-space." [(space? char)])] [..\\format + ..\\parser /buffer.documentation /encoding.documentation diff --git a/stdlib/source/documentation/lux/ffi.jvm.lux b/stdlib/source/documentation/lux/ffi.jvm.lux index bc804020f..e095e8a15 100644 --- a/stdlib/source/documentation/lux/ffi.jvm.lux +++ b/stdlib/source/documentation/lux/ffi.jvm.lux @@ -182,11 +182,11 @@ (dosomething else) (finish the computation)))]) - ($.documentation /.do_to + ($.documentation /.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))]) + [(to object + (ClassName::method1 arg0 arg1 arg2) + (ClassName::method2 arg3 arg4 arg5))]) ($.documentation /.import "Allows importing JVM classes, and using them as types." diff --git a/stdlib/source/documentation/lux/ffi.old.lux b/stdlib/source/documentation/lux/ffi.old.lux index 5bc8cd6cc..e0e667494 100644 --- a/stdlib/source/documentation/lux/ffi.old.lux +++ b/stdlib/source/documentation/lux/ffi.old.lux @@ -138,11 +138,11 @@ (do_something else) (finish the computation)))]) - ($.documentation /.do_to + ($.documentation /.to "Call a variety of methods on an object. Then, return the object." - [(do_to object - (ClassName::method0 arg0 arg1 arg2) - (ClassName::method1 arg3 arg4 arg5))]) + [(to object + (ClassName::method0 arg0 arg1 arg2) + (ClassName::method1 arg3 arg4 arg5))]) ($.documentation /.import (format "Allows importing JVM classes, and using them as types." diff --git a/stdlib/source/documentation/lux/meta.lux b/stdlib/source/documentation/lux/meta.lux index 7a0ab78d6..71dc925dd 100644 --- a/stdlib/source/documentation/lux/meta.lux +++ b/stdlib/source/documentation/lux/meta.lux @@ -12,7 +12,8 @@ ["[1][0]" location] ["[1][0]" symbol] ["[1][0]" type] - ["[1][0]" macro]]) + ["[1][0]" macro] + ["[1][0]" target]]) (.def .public documentation (.List $.Module) @@ -167,4 +168,5 @@ /location.documentation /symbol.documentation /type.documentation - /macro.documentation])) + /macro.documentation + /target.documentation])) diff --git a/stdlib/source/documentation/lux/world/console.lux b/stdlib/source/documentation/lux/world/console.lux index ecda5918d..b2a2f1d15 100644 --- a/stdlib/source/documentation/lux/world/console.lux +++ b/stdlib/source/documentation/lux/world/console.lux @@ -2,10 +2,11 @@ [library [lux (.except) ["$" documentation] - ["@" target] [data ["[0]" text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]]] + [meta + ["@" target]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/documentation/lux/world/file.lux b/stdlib/source/documentation/lux/world/file.lux index 61ed8c379..04ba576a5 100644 --- a/stdlib/source/documentation/lux/world/file.lux +++ b/stdlib/source/documentation/lux/world/file.lux @@ -2,10 +2,11 @@ [library [lux (.except) ["$" documentation] - ["@" target] [data ["[0]" text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]]] + [meta + ["@" target]]]] [\\library ["[0]" /]] ["[0]" / diff --git a/stdlib/source/documentation/lux/world/file/watch.lux b/stdlib/source/documentation/lux/world/file/watch.lux index 5f7e7d311..75ca237dd 100644 --- a/stdlib/source/documentation/lux/world/file/watch.lux +++ b/stdlib/source/documentation/lux/world/file/watch.lux @@ -2,10 +2,11 @@ [library [lux (.except) ["$" documentation] - ["@" target] [data ["[0]" text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]]] + [meta + ["@" target]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/documentation/lux/world/net/http/client.lux b/stdlib/source/documentation/lux/world/net/http/client.lux index 3a98dd668..fe77ae817 100644 --- a/stdlib/source/documentation/lux/world/net/http/client.lux +++ b/stdlib/source/documentation/lux/world/net/http/client.lux @@ -2,11 +2,11 @@ [library [lux (.except) ["$" documentation] - ["@" target] [data ["[0]" text (.only \n) ["%" \\format (.only format)]]] [meta + ["@" target] [macro ["[0]" template]]]]] [\\library diff --git a/stdlib/source/documentation/lux/world/shell.lux b/stdlib/source/documentation/lux/world/shell.lux index 851d4009e..f551aa6ce 100644 --- a/stdlib/source/documentation/lux/world/shell.lux +++ b/stdlib/source/documentation/lux/world/shell.lux @@ -2,10 +2,11 @@ [library [lux (.except) ["$" documentation] - ["@" target] [data ["[0]" text (.only \n) - ["%" \\format (.only format)]]]]] + ["%" \\format (.only format)]]] + [meta + ["@" target]]]] [\\library ["[0]" /]]) diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux index 43fcd5c3c..f465089d7 100644 --- a/stdlib/source/library/lux/ffi.jvm.lux +++ b/stdlib/source/library/lux/ffi.jvm.lux @@ -1461,7 +1461,7 @@ body <code>.any]) (in (list (` ("jvm object synchronized" (, lock) (, body))))))) -(def .public do_to +(def .public to (syntax (_ [obj <code>.any methods (<>.some partial_call^)]) (with_symbols [g!obj] diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux index 99158d8a9..e9385c61a 100644 --- a/stdlib/source/library/lux/ffi.old.lux +++ b/stdlib/source/library/lux/ffi.old.lux @@ -1315,7 +1315,7 @@ body <code>.any]) (in (list (` ("jvm object synchronized" (, lock) (, body))))))) -(def .public do_to +(def .public to (syntax (_ [obj <code>.any methods (<>.some partial_call^)]) (with_symbols [g!obj] diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux index 611028e8e..a1bb5d944 100644 --- a/stdlib/source/library/lux/meta.lux +++ b/stdlib/source/library/lux/meta.lux @@ -242,7 +242,8 @@ (case (|> lux (the [.#type_context .#var_bindings]) (type_variable var)) - (^.or {.#None} {.#Some {.#Var _}}) + (^.or {.#None} + {.#Some {.#Var _}}) {try.#Success [lux type]} {.#Some type'} diff --git a/stdlib/source/library/lux/meta/target/jvm/loader.lux b/stdlib/source/library/lux/meta/target/jvm/loader.lux index cb423bba7..627b10cd5 100644 --- a/stdlib/source/library/lux/meta/target/jvm/loader.lux +++ b/stdlib/source/library/lux/meta/target/jvm/loader.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except) - ["[0]" ffi (.only import object do_to)] + ["[0]" ffi (.only import object to)] [abstract [monad (.only do)]] [control @@ -76,10 +76,10 @@ (java/lang/Integer::TYPE))) (ffi.write! 3 (as <elemT> (java/lang/Integer::TYPE))))] - (do_to (java/lang/Class::getDeclaredMethod (ffi.as_string "defineClass") - signature - (ffi.class_for java/lang/ClassLoader)) - (java/lang/reflect/AccessibleObject::setAccessible true))))) + (to (java/lang/Class::getDeclaredMethod (ffi.as_string "defineClass") + signature + (ffi.class_for java/lang/ClassLoader)) + (java/lang/reflect/AccessibleObject::setAccessible true))))) (def .public (define class_name bytecode loader) (-> Text Binary java/lang/ClassLoader (Try java/lang/Object)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux index 1212056f5..0e1ec0f97 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/host.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except Definition) - ["[0]" ffi (.only import do_to object)] + ["[0]" ffi (.only import object)] [abstract [monad (.only do)]] [control diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux index 63e347408..b783f1262 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux @@ -1,7 +1,7 @@ (.require [library [lux (.except Module Definition) - ["[0]" ffi (.only import do_to)] + ["[0]" ffi (.only import to)] [abstract ["[0]" monad (.only Monad do)]] [control @@ -136,19 +136,19 @@ (def (manifest program) (-> (Maybe unit.ID) java/util/jar/Manifest) (let [manifest (java/util/jar/Manifest::new) - attrs (do_to (java/util/jar/Manifest::getMainAttributes manifest) - (java/util/jar/Attributes::put (java/util/jar/Attributes$Name::MANIFEST_VERSION) - (ffi.as_string ..manifest_version)))] + attrs (to (java/util/jar/Manifest::getMainAttributes manifest) + (java/util/jar/Attributes::put (java/util/jar/Attributes$Name::MANIFEST_VERSION) + (ffi.as_string ..manifest_version)))] (exec (case program {.#Some program} - (do_to attrs - (java/util/jar/Attributes::put (java/util/jar/Attributes$Name::MAIN_CLASS) - (|> program - runtime.class_name - name.internal - name.external - ffi.as_string))) + (to attrs + (java/util/jar/Attributes::put (java/util/jar/Attributes$Name::MAIN_CLASS) + (|> program + runtime.class_name + name.internal + name.external + ffi.as_string))) {.#None} attrs) @@ -165,10 +165,10 @@ (do try.monad [_ (java/util/jar/JarOutputStream::putNextEntry (java/util/jar/JarEntry::new (ffi.as_string class_path)) sink)] - (in (do_to sink - (java/util/zip/ZipOutputStream::write content (ffi.as_int +0) (ffi.as_int (.int (binary.size content)))) - (java/io/Flushable::flush) - (java/util/zip/ZipOutputStream::closeEntry)))))) + (in (to sink + (java/util/zip/ZipOutputStream::write content (ffi.as_int +0) (ffi.as_int (.int (binary.size content)))) + (java/io/Flushable::flush) + (java/util/zip/ZipOutputStream::closeEntry)))))) (def (write_module static necessary_dependencies [module output] sink) (-> Context (Set unit.ID) [module.ID Output] java/util/jar/JarOutputStream @@ -260,10 +260,10 @@ (let [[entry_size entry_data] (read_jar_entry entry input)] (again (set.has entry_path entries) duplicates - (do_to sink - (java/util/zip/ZipOutputStream::write entry_data (ffi.as_int +0) (ffi.as_int (.int entry_size))) - (java/io/Flushable::flush) - (java/util/zip/ZipOutputStream::closeEntry))))) + (to sink + (java/util/zip/ZipOutputStream::write entry_data (ffi.as_int +0) (ffi.as_int (.int entry_size))) + (java/io/Flushable::flush) + (java/util/zip/ZipOutputStream::closeEntry))))) (again entries duplicates sink)))))))) @@ -286,9 +286,9 @@ [(set.empty text.hash) (set.empty text.hash) sink])) - .let [_ (do_to sink - (java/io/Flushable::flush) - (java/io/Closeable::close))]] + .let [_ (to sink + (java/io/Flushable::flush) + (java/io/Closeable::close))]] (in (|> buffer java/io/ByteArrayOutputStream::toByteArray {.#Left}))))) diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index 755312f27..9e900469a 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -615,10 +615,10 @@ dummy/0 random_long dummy/1 random_long dummy/2 random_long - .let [object/9 (/.do_to (is (test/TestClass9 java/lang/Long) - (test/TestClass9::new dummy/0)) - (test/TestClass9::set_actual9 dummy/1) - (test/TestClass9::set_actual9 dummy/2)) + .let [object/9 (/.to (is (test/TestClass9 java/lang/Long) + (test/TestClass9::new dummy/0)) + (test/TestClass9::set_actual9 dummy/1) + (test/TestClass9::set_actual9 dummy/2)) example/9! (|> object/9 test/TestClass9::get_actual9 @@ -663,7 +663,7 @@ )) (_.coverage [/.cannot_write_to_field] example/11!) - (_.coverage [/.do_to] + (_.coverage [/.to] example/9!) ))) diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index a5beca2bb..e16dbd84d 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -213,11 +213,11 @@ (|> (/.class_for java/lang/Class) java/lang/Class::getName (text#= "java.lang.Class"))) - (_.coverage [/.class /.do_to] - (|> (/.do_to (test/lux/ffi/TestClass::new increase counter) - (test/lux/ffi/TestClass::upC) - (test/lux/ffi/TestClass::upC) - (test/lux/ffi/TestClass::downC)) + (_.coverage [/.class /.to] + (|> (/.to (test/lux/ffi/TestClass::new increase counter) + (test/lux/ffi/TestClass::upC) + (test/lux/ffi/TestClass::upC) + (test/lux/ffi/TestClass::downC)) test/lux/ffi/TestClass::currentC (i.= (i.+ increase counter)))) (_.coverage [/.interface /.object] |