aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/world
diff options
context:
space:
mode:
authorEduardo Julian2021-08-25 16:47:50 -0400
committerEduardo Julian2021-08-25 16:47:50 -0400
commitb216900093c905b3b20dd45c69e577b192e2f7a3 (patch)
tree4d6ac7d257752a8c54ca77dd58df9753ce357ab6 /stdlib/source/documentation/lux/world
parent36303d6cb2ce3ab9e36d045b9516c997bd461862 (diff)
Updates to the Lua compiler.
Diffstat (limited to 'stdlib/source/documentation/lux/world')
-rw-r--r--stdlib/source/documentation/lux/world/console.lux43
-rw-r--r--stdlib/source/documentation/lux/world/file.lux76
-rw-r--r--stdlib/source/documentation/lux/world/file/watch.lux58
-rw-r--r--stdlib/source/documentation/lux/world/input/keyboard.lux112
-rw-r--r--stdlib/source/documentation/lux/world/net.lux36
-rw-r--r--stdlib/source/documentation/lux/world/net/http/client.lux54
-rw-r--r--stdlib/source/documentation/lux/world/net/http/status.lux171
-rw-r--r--stdlib/source/documentation/lux/world/net/uri.lux24
-rw-r--r--stdlib/source/documentation/lux/world/output/video/resolution.lux69
-rw-r--r--stdlib/source/documentation/lux/world/program.lux37
-rw-r--r--stdlib/source/documentation/lux/world/shell.lux54
11 files changed, 734 insertions, 0 deletions
diff --git a/stdlib/source/documentation/lux/world/console.lux b/stdlib/source/documentation/lux/world/console.lux
new file mode 100644
index 000000000..80841123d
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/console.lux
@@ -0,0 +1,43 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Console
+ "An interface to console/terminal I/O.")
+
+(documentation: /.write_line
+ "Writes the message on the console and appends a new-line/line-feed at the end."
+ [(write_line message console)])
+
+(documentation: /.Mock
+ (format "A mock/simulation of a console."
+ \n "Useful for testing."))
+
+(documentation: /.mock
+ ""
+ [(mock mock init)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Console
+ ..write_line
+ ..Mock
+ ..mock
+ ($.default /.async)
+ ($.default /.cannot_open)
+ ($.default /.cannot_close)
+ ($.default /.default)]
+ []))
diff --git a/stdlib/source/documentation/lux/world/file.lux b/stdlib/source/documentation/lux/world/file.lux
new file mode 100644
index 000000000..06596ef56
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/file.lux
@@ -0,0 +1,76 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]]
+ ["." / #_
+ ["#." watch]])
+
+(documentation: /.Path
+ "A path to a file or a directory in a file-system.")
+
+(documentation: /.System
+ "An interface to a file-system.")
+
+(documentation: /.parent
+ "If a path represents a nested file/directory, extracts its parent directory."
+ [(parent fs path)])
+
+(documentation: /.name
+ "The un-nested name of a file/directory."
+ [(name fs path)])
+
+(documentation: /.rooted
+ "A nested path for a file/directory, given a root/parent path and a file/directory name within it."
+ [(rooted fs parent child)])
+
+(documentation: /.exists?
+ "Checks if either a file or a directory exists at the given path."
+ [(exists? monad fs path)])
+
+(documentation: /.mock
+ (format "A purely in-memory simulation of a file-system."
+ \n "Useful for testing.")
+ [(mock separator)])
+
+(documentation: /.make_directories
+ (format "Creates the directory specified by the given path."
+ \n "Also, creates every super-directory necessary to make the given path valid.")
+ [(make_directories monad fs path)])
+
+(documentation: /.make_file
+ "Creates a new file with the given content if-and-only-if the file does not already exist."
+ [(make_file monad fs content path)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Path
+ ..System
+ ..parent
+ ..name
+ ..rooted
+ ..exists?
+ ..mock
+ ..make_directories
+ ..make_file
+ ($.default /.async)
+ ($.default /.cannot_make_file)
+ ($.default /.cannot_find_file)
+ ($.default /.cannot_delete)
+ ($.default /.cannot_make_directory)
+ ($.default /.cannot_find_directory)
+ ($.default /.cannot_read_all_data)
+ ($.default /.cannot_modify_file)
+ ($.default /.default)]
+ [/watch.documentation]))
diff --git a/stdlib/source/documentation/lux/world/file/watch.lux b/stdlib/source/documentation/lux/world/file/watch.lux
new file mode 100644
index 000000000..e310d8d2d
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/file/watch.lux
@@ -0,0 +1,58 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Concern
+ "A particular concern to watch-out for.")
+
+(documentation: /.also
+ ""
+ [(also left right)])
+
+(documentation: /.Watcher
+ "Machinery for watching a file-system for changes to files and directories.")
+
+(documentation: /.polling
+ (format "A simple watcher that works for any file-system."
+ "Polls files and directories to detect changes.")
+ [(polling fs)])
+
+(documentation: /.mock
+ (format "A fake/emulated watcher."
+ \n "Must be given a path separator for the file-system.")
+ [(mock separator)])
+
+(documentation: /.default
+ "The default watcher for the default file-system.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Concern
+ ..also
+ ..Watcher
+ ..polling
+ ..mock
+ ..default
+ ($.default /.creation)
+ ($.default /.creation?)
+ ($.default /.modification)
+ ($.default /.modification?)
+ ($.default /.deletion)
+ ($.default /.deletion?)
+ ($.default /.all)
+ ($.default /.not_being_watched)
+ ($.default /.cannot_poll_a_non_existent_directory)]
+ []))
diff --git a/stdlib/source/documentation/lux/world/input/keyboard.lux b/stdlib/source/documentation/lux/world/input/keyboard.lux
new file mode 100644
index 000000000..8c63ade98
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/input/keyboard.lux
@@ -0,0 +1,112 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Key
+ "A key from a keyboard, identify by a numeric ID.")
+
+(documentation: /.Press
+ "A key-press for a key.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Key
+ ..Press
+ ($.default /.back_space)
+ ($.default /.enter)
+ ($.default /.shift)
+ ($.default /.control)
+ ($.default /.alt)
+ ($.default /.caps_lock)
+ ($.default /.escape)
+ ($.default /.space)
+ ($.default /.page_up)
+ ($.default /.page_down)
+ ($.default /.end)
+ ($.default /.home)
+ ($.default /.left)
+ ($.default /.up)
+ ($.default /.right)
+ ($.default /.down)
+ ($.default /.a)
+ ($.default /.b)
+ ($.default /.c)
+ ($.default /.d)
+ ($.default /.e)
+ ($.default /.f)
+ ($.default /.g)
+ ($.default /.h)
+ ($.default /.i)
+ ($.default /.j)
+ ($.default /.k)
+ ($.default /.l)
+ ($.default /.m)
+ ($.default /.n)
+ ($.default /.o)
+ ($.default /.p)
+ ($.default /.q)
+ ($.default /.r)
+ ($.default /.s)
+ ($.default /.t)
+ ($.default /.u)
+ ($.default /.v)
+ ($.default /.w)
+ ($.default /.x)
+ ($.default /.y)
+ ($.default /.z)
+ ($.default /.num_pad_0)
+ ($.default /.num_pad_1)
+ ($.default /.num_pad_2)
+ ($.default /.num_pad_3)
+ ($.default /.num_pad_4)
+ ($.default /.num_pad_5)
+ ($.default /.num_pad_6)
+ ($.default /.num_pad_7)
+ ($.default /.num_pad_8)
+ ($.default /.num_pad_9)
+ ($.default /.delete)
+ ($.default /.num_lock)
+ ($.default /.scroll_lock)
+ ($.default /.print_screen)
+ ($.default /.insert)
+ ($.default /.windows)
+ ($.default /.f1)
+ ($.default /.f2)
+ ($.default /.f3)
+ ($.default /.f4)
+ ($.default /.f5)
+ ($.default /.f6)
+ ($.default /.f7)
+ ($.default /.f8)
+ ($.default /.f9)
+ ($.default /.f10)
+ ($.default /.f11)
+ ($.default /.f12)
+ ($.default /.f13)
+ ($.default /.f14)
+ ($.default /.f15)
+ ($.default /.f16)
+ ($.default /.f17)
+ ($.default /.f18)
+ ($.default /.f19)
+ ($.default /.f20)
+ ($.default /.f21)
+ ($.default /.f22)
+ ($.default /.f23)
+ ($.default /.f24)
+ ($.default /.release)
+ ($.default /.press)]
+ []))
diff --git a/stdlib/source/documentation/lux/world/net.lux b/stdlib/source/documentation/lux/world/net.lux
new file mode 100644
index 000000000..f6247b2e2
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/net.lux
@@ -0,0 +1,36 @@
+(.module:
+ [library
+ [lux #*
+ [program (#+ program:)]
+ ["$" documentation (#+ documentation:)]
+ ["." debug]
+ [control
+ ["." io]]]]
+ [\\library
+ ["." /]]
+ ["." / #_
+ ["#." uri]
+ ["#." http #_
+ ["#/." client]
+ ["#/." status]]])
+
+(documentation: /.Address
+ "A TCP/IP address.")
+
+(documentation: /.Port
+ "A TCP/IP port.")
+
+(documentation: /.URL
+ "A Uniform Resource Locator.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Address
+ ..Port
+ ..URL
+ ($.default /.Location)]
+ [/uri.documentation
+ /http/client.documentation
+ /http/status.documentation]))
diff --git a/stdlib/source/documentation/lux/world/net/http/client.lux b/stdlib/source/documentation/lux/world/net/http/client.lux
new file mode 100644
index 000000000..3534ebc6a
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/net/http/client.lux
@@ -0,0 +1,54 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Client
+ "A HTTP client capable of issuing requests to a HTTP server.")
+
+(template [<name>]
+ [(documentation: <name>
+ (format "A " (text.upper_cased (template.text [<name>])) " request."))]
+
+ [/.post]
+ [/.get]
+ [/.put]
+ [/.patch]
+ [/.delete]
+ [/.head]
+ [/.connect]
+ [/.options]
+ [/.trace]
+ [/.default]
+ [/.async]
+ [/.headers]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Client
+ ..post
+ ..get
+ ..put
+ ..patch
+ ..delete
+ ..head
+ ..connect
+ ..options
+ ..trace
+ ..default
+ ..async
+ ..headers]
+ []))
diff --git a/stdlib/source/documentation/lux/world/net/http/status.lux b/stdlib/source/documentation/lux/world/net/http/status.lux
new file mode 100644
index 000000000..f0623b88d
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/net/http/status.lux
@@ -0,0 +1,171 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(template [<name>]
+ [(documentation: <name>
+ (|> (template.text [<name>])
+ (text.replaced "_" " ")
+ text.upper_cased
+ (format (%.nat <name>) ": ")))]
+
+ ... 1xx Informational response
+ [/.continue]
+ [/.switching_protocols]
+ [/.processing]
+ [/.early_hints]
+
+ ... 2xx Success
+ [/.ok]
+ [/.created]
+ [/.accepted]
+ [/.non_authoritative_information]
+ [/.no_content]
+ [/.reset_content]
+ [/.partial_content]
+ [/.multi_status]
+ [/.already_reported]
+ [/.im_used]
+
+ ... 3xx Redirection
+ [/.multiple_choices]
+ [/.moved_permanently]
+ [/.found]
+ [/.see_other]
+ [/.not_modified]
+ [/.use_proxy]
+ [/.switch_proxy]
+ [/.temporary_redirect]
+ [/.permanent_redirect]
+
+ ... 4xx Client errors
+ [/.bad_request]
+ [/.unauthorized]
+ [/.payment_required]
+ [/.forbidden]
+ [/.not_found]
+ [/.method_not_allowed]
+ [/.not_acceptable]
+ [/.proxy_authentication_required]
+ [/.request_timeout]
+ [/.conflict]
+ [/.gone]
+ [/.length_required]
+ [/.precondition_failed]
+ [/.payload_too_large]
+ [/.uri_too_long]
+ [/.unsupported_media_type]
+ [/.range_not_satisfiable]
+ [/.expectation_failed]
+ [/.im_a_teapot]
+ [/.misdirected_request]
+ [/.unprocessable_entity]
+ [/.locked]
+ [/.failed_dependency]
+ [/.upgrade_required]
+ [/.precondition_required]
+ [/.too_many_requests]
+ [/.request_header_fields_too_large]
+ [/.unavailable_for_legal_reasons]
+
+ ... 5xx Server errors
+ [/.internal_server_error]
+ [/.not_implemented]
+ [/.bad_gateway]
+ [/.service_unavailable]
+ [/.gateway_timeout]
+ [/.http_version_not_supported]
+ [/.variant_also_negotiates]
+ [/.insufficient_storage]
+ [/.loop_detected]
+ [/.not_extended]
+ [/.network_authentication_required]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [ ... 1xx Informational response
+ ..continue
+ ..switching_protocols
+ ..processing
+ ..early_hints
+
+ ... 2xx Success
+ ..ok
+ ..created
+ ..accepted
+ ..non_authoritative_information
+ ..no_content
+ ..reset_content
+ ..partial_content
+ ..multi_status
+ ..already_reported
+ ..im_used
+
+ ... 3xx Redirection
+ ..multiple_choices
+ ..moved_permanently
+ ..found
+ ..see_other
+ ..not_modified
+ ..use_proxy
+ ..switch_proxy
+ ..temporary_redirect
+ ..permanent_redirect
+
+ ... 4xx Client errors
+ ..bad_request
+ ..unauthorized
+ ..payment_required
+ ..forbidden
+ ..not_found
+ ..method_not_allowed
+ ..not_acceptable
+ ..proxy_authentication_required
+ ..request_timeout
+ ..conflict
+ ..gone
+ ..length_required
+ ..precondition_failed
+ ..payload_too_large
+ ..uri_too_long
+ ..unsupported_media_type
+ ..range_not_satisfiable
+ ..expectation_failed
+ ..im_a_teapot
+ ..misdirected_request
+ ..unprocessable_entity
+ ..locked
+ ..failed_dependency
+ ..upgrade_required
+ ..precondition_required
+ ..too_many_requests
+ ..request_header_fields_too_large
+ ..unavailable_for_legal_reasons
+
+ ... 5xx Server errors
+ ..internal_server_error
+ ..not_implemented
+ ..bad_gateway
+ ..service_unavailable
+ ..gateway_timeout
+ ..http_version_not_supported
+ ..variant_also_negotiates
+ ..insufficient_storage
+ ..loop_detected
+ ..not_extended
+ ..network_authentication_required]
+ []))
diff --git a/stdlib/source/documentation/lux/world/net/uri.lux b/stdlib/source/documentation/lux/world/net/uri.lux
new file mode 100644
index 000000000..710bf4b7c
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/net/uri.lux
@@ -0,0 +1,24 @@
+(.module:
+ [library
+ [lux #*
+ [program (#+ program:)]
+ ["$" documentation (#+ documentation:)]
+ ["." debug]
+ [control
+ ["." io]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.URI
+ "A Uniform Resource Identifier.")
+
+(documentation: /.separator
+ "A separator for the pieces of a URI.")
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..URI
+ ..separator]
+ []))
diff --git a/stdlib/source/documentation/lux/world/output/video/resolution.lux b/stdlib/source/documentation/lux/world/output/video/resolution.lux
new file mode 100644
index 000000000..6425902c8
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/output/video/resolution.lux
@@ -0,0 +1,69 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Resolution
+ "A screen resolution.")
+
+(template [<name>]
+ [(documentation: <name>
+ (let [name (|> (template.text [<name>])
+ (text.replaced "/" " ")
+ (text.replaced "_" " ")
+ text.upper_cased)]
+ (format name " resolution: "
+ (%.nat (value@ #/.width <name>))
+ "x" (%.nat (value@ #/.height <name>))
+ ".")))]
+
+ [/.svga]
+ [/.wsvga]
+ [/.xga]
+ [/.xga+]
+ [/.wxga/16:9]
+ [/.wxga/5:3]
+ [/.wxga/16:10]
+ [/.sxga]
+ [/.wxga+]
+ [/.hd+]
+ [/.wsxga+]
+ [/.fhd]
+ [/.wuxga]
+ [/.wqhd]
+ [/.uhd_4k]
+ )
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Resolution
+ ..svga
+ ..wsvga
+ ..xga
+ ..xga+
+ ..wxga/16:9
+ ..wxga/5:3
+ ..wxga/16:10
+ ..sxga
+ ..wxga+
+ ..hd+
+ ..wsxga+
+ ..fhd
+ ..wuxga
+ ..wqhd
+ ..uhd_4k
+ ($.default /.hash)
+ ($.default /.equivalence)]
+ []))
diff --git a/stdlib/source/documentation/lux/world/program.lux b/stdlib/source/documentation/lux/world/program.lux
new file mode 100644
index 000000000..d61db573b
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/program.lux
@@ -0,0 +1,37 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Program
+ "Access to ambient program data and the capacity to exit the program.")
+
+(documentation: /.environment
+ "Assembles the environment variables available to the program."
+ [(environment monad program)])
+
+(documentation: /.mock
+ ""
+ [(mock environment home directory)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Program
+ ..environment
+ ..mock
+ ($.default /.unknown_environment_variable)
+ ($.default /.async)
+ ($.default /.default)]
+ []))
diff --git a/stdlib/source/documentation/lux/world/shell.lux b/stdlib/source/documentation/lux/world/shell.lux
new file mode 100644
index 000000000..43264c503
--- /dev/null
+++ b/stdlib/source/documentation/lux/world/shell.lux
@@ -0,0 +1,54 @@
+(.module:
+ [library
+ [lux #*
+ ["$" documentation (#+ documentation:)]
+ [control
+ ["<>" parser
+ ["<.>" code]]]
+ [data
+ ["." text (#+ \n)
+ ["%" format (#+ format)]]]
+ [macro
+ ["." template]]]]
+ [\\library
+ ["." /]])
+
+(documentation: /.Exit
+ "A program exit code.")
+
+(documentation: /.Process
+ "The means for communicating with a program/process being executed by the operating system.")
+
+(documentation: /.Command
+ "A command that can be executed by the operating system.")
+
+(documentation: /.Argument
+ "A parameter for a command.")
+
+(documentation: /.Shell
+ "The means for issuing commands to the operating system.")
+
+(documentation: /.Mock
+ "A simulated process.")
+
+(documentation: /.mock
+ ""
+ [(mock mock init)])
+
+(.def: .public documentation
+ (.List $.Module)
+ ($.module /._
+ ""
+ [..Exit
+ ..Process
+ ..Command
+ ..Argument
+ ..Shell
+ ..Mock
+ ..mock
+ ($.default /.normal)
+ ($.default /.error)
+ ($.default /.async)
+ ($.default /.no_more_output)
+ ($.default /.default)]
+ []))