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.lux64
1 files changed, 32 insertions, 32 deletions
diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux
index f2064c166..42f5aafcf 100644
--- a/stdlib/source/library/lux/data/format/xml.lux
+++ b/stdlib/source/library/lux/data/format/xml.lux
@@ -7,14 +7,14 @@
[codec {"+" [Codec]}]]
[control
[try {"+" [Try]}]
- ["<>" parser ("[1]\[0]" monad)
+ ["<>" parser ("[1]#[0]" monad)
["<[0]>" text {"+" [Parser]}]]]
[data
["[0]" product]
- ["[0]" name ("[1]\[0]" equivalence codec)]
- ["[0]" text ("[1]\[0]" equivalence monoid)]
+ ["[0]" name ("[1]#[0]" equivalence codec)]
+ ["[0]" text {"+" [\n]} ("[1]#[0]" equivalence monoid)]
[collection
- ["[0]" list ("[1]\[0]" functor)]
+ ["[0]" list ("[1]#[0]" functor)]
["[0]" dictionary {"+" [Dictionary]}]]]
[math
[number
@@ -46,11 +46,11 @@
(def: xml_standard_escape_char^
(Parser Text)
($_ <>.either
- (<>.after (<text>.this "&lt;") (<>\in "<"))
- (<>.after (<text>.this "&gt;") (<>\in ">"))
- (<>.after (<text>.this "&amp;") (<>\in "&"))
- (<>.after (<text>.this "&apos;") (<>\in "'"))
- (<>.after (<text>.this "&quot;") (<>\in text.double_quote))
+ (<>.after (<text>.this "&lt;") (<>#in "<"))
+ (<>.after (<text>.this "&gt;") (<>#in ">"))
+ (<>.after (<text>.this "&amp;") (<>#in "&"))
+ (<>.after (<text>.this "&apos;") (<>#in "'"))
+ (<>.after (<text>.this "&quot;") (<>#in text.double_quote))
))
(def: xml_unicode_escape_char^
@@ -74,7 +74,7 @@
(def: xml_char^
(Parser Text)
- (<>.either (<text>.none_of ($_ text\composite "<>&" text.double_quote))
+ (<>.either (<text>.none_of ($_ text#composite "<>&" text.double_quote))
xml_escape_char^))
(def: xml_identifier
@@ -84,7 +84,7 @@
<text>.alpha)
tail (<text>.some (<>.either (<text>.one_of "_.-")
<text>.alpha_num))]
- (in ($_ text\composite head tail))))
+ (in ($_ text#composite head tail))))
(def: namespaced_symbol^
(Parser Name)
@@ -115,7 +115,7 @@
(def: attrs^
(Parser Attrs)
- (<| (\ <>.monad each (dictionary.of_list name.hash))
+ (<| (# <>.monad each (dictionary.of_list name.hash))
<>.some
(<>.and (..spaced^ attr_name^))
(<>.after (<text>.this "="))
@@ -128,10 +128,10 @@
..spaced^
(<>.after (<text>.this "/"))
(<text>.enclosed ["<" ">"]))]
- (<>.assertion ($_ text\composite "Close tag does not match open tag." text.new_line
- "Expected: " (name\encoded expected) text.new_line
- " Actual: " (name\encoded actual) text.new_line)
- (name\= expected actual))))
+ (<>.assertion ($_ text#composite "Close tag does not match open tag." \n
+ "Expected: " (name#encoded expected) \n
+ " Actual: " (name#encoded actual) \n)
+ (name#= expected actual))))
(def: comment^
(Parser Text)
@@ -159,7 +159,7 @@
(Parser XML)
(|> (..spaced^ (<text>.many xml_char^))
(<>.either cdata^)
- (<>\each (|>> {#Text}))))
+ (<>#each (|>> {#Text}))))
(def: null^
(Parser Any)
@@ -211,7 +211,7 @@
(-> Tag Text)
(case namespace
"" name
- _ ($_ text\composite namespace ..namespace_separator name)))
+ _ ($_ text#composite namespace ..namespace_separator name)))
(def: .public attribute
(-> Attribute Text)
@@ -221,8 +221,8 @@
Text
(let [quote (: (-> Text Text)
(function (_ value)
- ($_ text\composite text.double_quote value text.double_quote)))]
- ($_ text\composite
+ ($_ text#composite text.double_quote value text.double_quote)))]
+ ($_ text#composite
"<?xml"
" version=" (quote "1.0")
" encoding=" (quote "UTF-8")
@@ -236,11 +236,11 @@
(function (_ attrs)
(|> attrs
dictionary.entries
- (list\each (function (_ [key value])
- ($_ text\composite (..attribute key) "=" text.double_quote (sanitize_value value) text.double_quote)))
+ (list#each (function (_ [key value])
+ ($_ text#composite (..attribute key) "=" text.double_quote (sanitize_value value) text.double_quote)))
(text.interposed " "))))]
(function (_ input)
- ($_ text\composite
+ ($_ text#composite
..xml_header text.new_line
(loop [prefix ""
input input]
@@ -252,8 +252,8 @@
(let [tag (..tag xml_tag)
attrs (if (dictionary.empty? xml_attrs)
""
- ($_ text\composite " " (attributes xml_attrs)))]
- ($_ text\composite
+ ($_ text#composite " " (attributes xml_attrs)))]
+ ($_ text#composite
prefix "<" tag attrs ">"
(sanitize_value value)
"</" tag ">"))
@@ -262,12 +262,12 @@
(let [tag (..tag xml_tag)
attrs (if (dictionary.empty? xml_attrs)
""
- ($_ text\composite " " (attributes xml_attrs)))]
+ ($_ text#composite " " (attributes xml_attrs)))]
(if (list.empty? xml_children)
- ($_ text\composite prefix "<" tag attrs "/>")
- ($_ text\composite prefix "<" tag attrs ">"
+ ($_ text#composite prefix "<" tag attrs "/>")
+ ($_ text#composite prefix "<" tag attrs ">"
(|> xml_children
- (list\each (|>> (recur (text\composite prefix text.tab)) (text\composite text.new_line)))
+ (list#each (|>> (recur (text#composite prefix text.tab)) (text#composite text.new_line)))
text.together)
text.new_line prefix "</" tag ">")))))
))))
@@ -280,12 +280,12 @@
(def: (= reference sample)
(case [reference sample]
[{#Text reference/value} {#Text sample/value}]
- (text\= reference/value sample/value)
+ (text#= reference/value sample/value)
[{#Node reference/tag reference/attrs reference/children}
{#Node sample/tag sample/attrs sample/children}]
- (and (name\= reference/tag sample/tag)
- (\ (dictionary.equivalence text.equivalence) = reference/attrs sample/attrs)
+ (and (name#= reference/tag sample/tag)
+ (# (dictionary.equivalence text.equivalence) = reference/attrs sample/attrs)
(n.= (list.size reference/children)
(list.size sample/children))
(|> (list.zipped/2 reference/children sample/children)