aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/format/xml.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/data/format/xml.lux')
-rw-r--r--stdlib/source/library/lux/data/format/xml.lux58
1 files changed, 29 insertions, 29 deletions
diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux
index ff08ad834..41ec13be0 100644
--- a/stdlib/source/library/lux/data/format/xml.lux
+++ b/stdlib/source/library/lux/data/format/xml.lux
@@ -31,7 +31,7 @@
(type: .public Attrs
(Dictionary Attribute Text))
-(def: .public attributes
+(def .public attributes
Attrs
(dictionary.empty symbol.hash))
@@ -41,10 +41,10 @@
{#Text Text}
{#Node Tag Attrs (List XML)})))
-(def: namespace_separator
+(def namespace_separator
":")
-(def: xml_standard_escape_char^
+(def xml_standard_escape_char^
(Parser Text)
(all <>.either
(<>.after (<text>.this "&lt;") (<>#in "<"))
@@ -54,7 +54,7 @@
(<>.after (<text>.this "&quot;") (<>#in text.double_quote))
))
-(def: xml_unicode_escape_char^
+(def xml_unicode_escape_char^
(Parser Text)
(|> (do [! <>.monad]
[hex? (<>.maybe (<text>.this "x"))]
@@ -71,17 +71,17 @@
(<>.before (<text>.this ";"))
(<>.after (<text>.this "&#"))))
-(def: xml_escape_char^
+(def xml_escape_char^
(Parser Text)
(<>.either xml_standard_escape_char^
xml_unicode_escape_char^))
-(def: xml_char^
+(def xml_char^
(Parser Text)
(<>.either (<text>.none_of (all text#composite "<>&" text.double_quote))
xml_escape_char^))
-(def: xml_identifier
+(def xml_identifier
(Parser Text)
(<text>.slice
(all <text>.and!
@@ -90,7 +90,7 @@
(<text>.some! (<>.either (<text>.one_of! "_.-")
<text>.alpha_num!)))))
-(def: namespaced_symbol^
+(def namespaced_symbol^
(Parser Symbol)
(do <>.monad
[first_part xml_identifier
@@ -102,22 +102,22 @@
{.#Some second_part}
(in [first_part second_part]))))
-(def: tag^ namespaced_symbol^)
-(def: attr_name^ namespaced_symbol^)
+(def tag^ namespaced_symbol^)
+(def attr_name^ namespaced_symbol^)
-(def: spaced^
+(def spaced^
(All (_ a) (-> (Parser a) (Parser a)))
(let [white_space^ (<>.some <text>.space)]
(|>> (<>.before white_space^)
(<>.after white_space^))))
-(def: attr_value^
+(def attr_value^
(Parser Text)
(let [value^ (<text>.some xml_char^)]
(<>.either (<text>.enclosed [text.double_quote text.double_quote] value^)
(<text>.enclosed ["'" "'"] value^))))
-(def: attrs^
+(def attrs^
(Parser Attrs)
(<| (at <>.monad each (dictionary.of_list symbol.hash))
<>.some
@@ -125,7 +125,7 @@
(<>.after (<text>.this "="))
(..spaced^ attr_value^)))
-(def: (close_tag^ expected)
+(def (close_tag^ expected)
(-> Tag (Parser []))
(do <>.monad
[actual (|> tag^
@@ -137,21 +137,21 @@
" Actual: " (symbol#encoded actual) \n)
(symbol#= expected actual))))
-(def: comment^
+(def comment^
(Parser Slice)
(|> (<text>.not! (<text>.this "--"))
<text>.some!
(<text>.enclosed ["<!--" "-->"])
..spaced^))
-(def: xml_header^
+(def xml_header^
(Parser Attrs)
(|> (..spaced^ attrs^)
(<>.before (<text>.this "?>"))
(<>.after (<text>.this "<?xml"))
..spaced^))
-(def: cdata^
+(def cdata^
(Parser Slice)
(let [end (<text>.this "]]>")]
(|> (<text>.some! (<text>.not! end))
@@ -159,17 +159,17 @@
(<>.after (<text>.this "<![CDATA["))
..spaced^)))
-(def: text^
+(def text^
(Parser XML)
(|> (..spaced^ (<text>.many xml_char^))
(<>.either (<text>.slice cdata^))
(<>#each (|>> {#Text}))))
-(def: null^
+(def null^
(Parser Any)
(<text>.this (text.of_char 0)))
-(def: xml^
+(def xml^
(Parser XML)
(|> (<>.rec
(function (_ node^)
@@ -202,7 +202,7 @@
(<>.before (<>.some ..null^))
(<>.after (<>.maybe ..xml_header^))))
-(def: (sanitize_value input)
+(def (sanitize_value input)
(-> Text Text)
(|> input
(text.replaced "&" "&amp;")
@@ -211,17 +211,17 @@
(text.replaced "'" "&apos;")
(text.replaced text.double_quote "&quot;")))
-(def: .public (tag [namespace name])
+(def .public (tag [namespace name])
(-> Tag Text)
(case namespace
"" name
_ (all text#composite namespace ..namespace_separator name)))
-(def: .public attribute
+(def .public attribute
(-> Attribute Text)
..tag)
-(def: xml_header
+(def xml_header
Text
(let [quote (is (-> Text Text)
(function (_ value)
@@ -232,10 +232,10 @@
" encoding=" (quote "UTF-8")
"?>")))
-(def: .public codec
+(def .public codec
(Codec Text XML)
(implementation
- (def: encoded
+ (def encoded
(let [attributes (is (-> Attrs Text)
(function (_ attrs)
(|> attrs
@@ -275,13 +275,13 @@
text.together)
text.new_line prefix "</" tag ">")))))
))))
- (def: decoded
+ (def decoded
(<text>.result ..xml^))))
-(def: .public equivalence
+(def .public equivalence
(Equivalence XML)
(implementation
- (def: (= reference sample)
+ (def (= reference sample)
(case [reference sample]
[{#Text reference/value} {#Text sample/value}]
(text#= reference/value sample/value)