diff options
Diffstat (limited to 'stdlib/source/library/lux/control/parser/xml.lux')
-rw-r--r-- | stdlib/source/library/lux/control/parser/xml.lux | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux index 91fd7e67c..14072c73c 100644 --- a/stdlib/source/library/lux/control/parser/xml.lux +++ b/stdlib/source/library/lux/control/parser/xml.lux @@ -17,24 +17,24 @@ ["/" xml (#+ Attribute Attrs Tag XML)]]]]] ["." //]) -(type: #export (Parser a) +(type: .public (Parser a) {#.doc (doc "A parser of XML-encoded data.")} (//.Parser [Attrs (List XML)] a)) -(exception: #export empty_input) -(exception: #export unexpected_input) +(exception: .public empty_input) +(exception: .public unexpected_input) -(exception: #export (wrong_tag {expected Tag} {actual Tag}) +(exception: .public (wrong_tag {expected Tag} {actual Tag}) (exception.report ["Expected" (%.text (/.tag expected))] ["Actual" (%.text (/.tag actual))])) -(exception: #export (unknown_attribute {expected Attribute} {available (List Attribute)}) +(exception: .public (unknown_attribute {expected Attribute} {available (List Attribute)}) (exception.report ["Expected" (%.text (/.attribute expected))] ["Available" (exception.listing (|>> /.attribute %.text) available)])) -(exception: #export (unconsumed_inputs {inputs (List XML)}) +(exception: .public (unconsumed_inputs {inputs (List XML)}) (exception.report ["Inputs" (exception.listing (\ /.codec encode) inputs)])) @@ -49,13 +49,13 @@ (#try.Failure error) (#try.Failure error))) -(def: #export (run parser documents) +(def: .public (run parser documents) {#.doc (doc "Applies a parser against a stream of XML documents." "Verifies that all of the inputs are consumed by the parser.")} (All [a] (-> (Parser a) (List XML) (Try a))) (..run' parser /.attributes documents)) -(def: #export text +(def: .public text {#.doc (doc "Yields text from a text node.")} (Parser Text) (function (_ [attrs documents]) @@ -71,7 +71,7 @@ (#/.Node _) (exception.except ..unexpected_input []))))) -(def: #export tag +(def: .public tag {#.doc (doc "Yields the tag from the next node.")} (Parser Tag) (function (_ [attrs documents]) @@ -87,7 +87,7 @@ (#/.Node tag _ _) (#try.Success [[attrs documents] tag]))))) -(def: #export (attribute name) +(def: .public (attribute name) {#.doc (doc "Yields the value of an attribute in the current node.")} (-> Attribute (Parser Text)) (function (_ [attrs documents]) @@ -98,7 +98,7 @@ (#.Some value) (#try.Success [[attrs documents] value])))) -(def: #export (node expected parser) +(def: .public (node expected parser) {#.doc (doc "Parses the contents of the next node if the tag matches.")} (All [a] (-> Tag (Parser a) (Parser a))) (function (_ [attrs documents]) @@ -118,7 +118,7 @@ (try\map (|>> [[attrs tail]]))) (exception.except ..wrong_tag [expected actual])))))) -(def: #export ignore +(def: .public ignore {#.doc (doc "Skips the next node.")} (Parser Any) (function (_ [attrs documents]) @@ -129,9 +129,9 @@ (#.Item head tail) (#try.Success [[attrs tail] []])))) -(exception: #export nowhere) +(exception: .public nowhere) -(def: #export (somewhere parser) +(def: .public (somewhere parser) {#.doc (doc "Applies the parser somewhere among the remaining inputs; instead of demanding that the parser succeeds against the immediate inputs.")} (All [a] (-> (Parser a) (Parser a))) (function (recur [attrs input]) |