aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/data/format/json.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/documentation/lux/data/format/json.lux71
1 files changed, 69 insertions, 2 deletions
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])))