aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/control/parser/xml.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/control/parser/xml.lux')
-rw-r--r--stdlib/source/library/lux/control/parser/xml.lux36
1 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux
index 14072c73c..6e7dfe3e1 100644
--- a/stdlib/source/library/lux/control/parser/xml.lux
+++ b/stdlib/source/library/lux/control/parser/xml.lux
@@ -18,7 +18,7 @@
["." //])
(type: .public (Parser a)
- {#.doc (doc "A parser of XML-encoded data.")}
+ {#.doc (example "A parser of XML-encoded data.")}
(//.Parser [Attrs (List XML)] a))
(exception: .public empty_input)
@@ -38,9 +38,9 @@
(exception.report
["Inputs" (exception.listing (\ /.codec encode) inputs)]))
-(def: (run' parser attrs documents)
+(def: (result' parser attrs documents)
(All [a] (-> (Parser a) Attrs (List XML) (Try a)))
- (case (//.run parser [attrs documents])
+ (case (//.result parser [attrs documents])
(#try.Success [[attrs' remaining] output])
(if (list.empty? remaining)
(#try.Success output)
@@ -49,14 +49,14 @@
(#try.Failure error)
(#try.Failure error)))
-(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.")}
+(def: .public (result parser documents)
+ {#.doc (example "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))
+ (..result' parser /.attributes documents))
(def: .public text
- {#.doc (doc "Yields text from a text node.")}
+ {#.doc (example "Yields text from a text node.")}
(Parser Text)
(function (_ [attrs documents])
(case documents
@@ -72,7 +72,7 @@
(exception.except ..unexpected_input [])))))
(def: .public tag
- {#.doc (doc "Yields the tag from the next node.")}
+ {#.doc (example "Yields the tag from the next node.")}
(Parser Tag)
(function (_ [attrs documents])
(case documents
@@ -88,7 +88,7 @@
(#try.Success [[attrs documents] tag])))))
(def: .public (attribute name)
- {#.doc (doc "Yields the value of an attribute in the current node.")}
+ {#.doc (example "Yields the value of an attribute in the current node.")}
(-> Attribute (Parser Text))
(function (_ [attrs documents])
(case (dictionary.get name attrs)
@@ -99,7 +99,7 @@
(#try.Success [[attrs documents] value]))))
(def: .public (node expected parser)
- {#.doc (doc "Parses the contents of the next node if the tag matches.")}
+ {#.doc (example "Parses the contents of the next node if the tag matches.")}
(All [a] (-> Tag (Parser a) (Parser a)))
(function (_ [attrs documents])
(case documents
@@ -114,28 +114,28 @@
(#/.Node actual attrs' children)
(if (name\= expected actual)
(|> children
- (..run' parser attrs')
+ (..result' parser attrs')
(try\map (|>> [[attrs tail]])))
(exception.except ..wrong_tag [expected actual]))))))
-(def: .public ignore
- {#.doc (doc "Skips the next node.")}
- (Parser Any)
+(def: .public any
+ {#.doc (example "Yields the next node.")}
+ (Parser XML)
(function (_ [attrs documents])
(case documents
#.End
(exception.except ..empty_input [])
(#.Item head tail)
- (#try.Success [[attrs tail] []]))))
+ (#try.Success [[attrs tail] head]))))
(exception: .public nowhere)
(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.")}
+ {#.doc (example "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])
- (case (//.run parser [attrs input])
+ (case (//.result parser [attrs input])
(#try.Success [[attrs remaining] output])
(#try.Success [[attrs remaining] output])