diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/control/parser/xml.lux | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux index 6a1eb1206..71fb6fab9 100644 --- a/stdlib/source/library/lux/control/parser/xml.lux +++ b/stdlib/source/library/lux/control/parser/xml.lux @@ -42,13 +42,13 @@ (def: (result' parser attrs documents) (All (_ a) (-> (Parser a) Attrs (List XML) (Try a))) (case (//.result parser [attrs documents]) - {#try.Success [[attrs' remaining] output]} + {try.#Success [[attrs' remaining] output]} (if (list.empty? remaining) - {#try.Success output} + {try.#Success output} (exception.except ..unconsumed_inputs remaining)) - {#try.Failure error} - {#try.Failure error})) + {try.#Failure error} + {try.#Failure error})) (def: .public (result parser documents) (All (_ a) (-> (Parser a) (List XML) (Try a))) @@ -58,55 +58,55 @@ (Parser Text) (function (_ [attrs documents]) (case documents - #.End + {.#End} (exception.except ..empty_input []) - {#.Item head tail} + {.#Item head tail} (case head - {#/.Text value} - {#try.Success [[attrs tail] value]} + {/.#Text value} + {try.#Success [[attrs tail] value]} - {#/.Node _} + {/.#Node _} (exception.except ..unexpected_input []))))) (def: .public tag (Parser Tag) (function (_ [attrs documents]) (case documents - #.End + {.#End} (exception.except ..empty_input []) - {#.Item head _} + {.#Item head _} (case head - {#/.Text _} + {/.#Text _} (exception.except ..unexpected_input []) - {#/.Node tag _ _} - {#try.Success [[attrs documents] tag]})))) + {/.#Node tag _ _} + {try.#Success [[attrs documents] tag]})))) (def: .public (attribute name) (-> Attribute (Parser Text)) (function (_ [attrs documents]) (case (dictionary.value name attrs) - #.None + {.#None} (exception.except ..unknown_attribute [name (dictionary.keys attrs)]) - {#.Some value} - {#try.Success [[attrs documents] value]}))) + {.#Some value} + {try.#Success [[attrs documents] value]}))) (def: .public (node expected parser) (All (_ a) (-> Tag (Parser a) (Parser a))) (function (_ [attrs documents]) (case documents - #.End + {.#End} (exception.except ..empty_input []) - {#.Item head tail} + {.#Item head tail} (case head - {#/.Text _} + {/.#Text _} (exception.except ..unexpected_input []) - {#/.Node actual attrs' children} + {/.#Node actual attrs' children} (if (name\= expected actual) (|> children (..result' parser attrs') @@ -117,11 +117,11 @@ (Parser XML) (function (_ [attrs documents]) (case documents - #.End + {.#End} (exception.except ..empty_input []) - {#.Item head tail} - {#try.Success [[attrs tail] head]}))) + {.#Item head tail} + {try.#Success [[attrs tail] head]}))) (exception: .public nowhere) @@ -129,16 +129,16 @@ (All (_ a) (-> (Parser a) (Parser a))) (function (recur [attrs input]) (case (//.result parser [attrs input]) - {#try.Success [[attrs remaining] output]} - {#try.Success [[attrs remaining] output]} + {try.#Success [[attrs remaining] output]} + {try.#Success [[attrs remaining] output]} - {#try.Failure error} + {try.#Failure error} (case input - #.End + {.#End} (exception.except ..nowhere []) - {#.Item head tail} + {.#Item head tail} (do try.monad [[[attrs tail'] output] (recur [attrs tail])] - (in [[attrs {#.Item head tail'}] + (in [[attrs {.#Item head tail'}] output])))))) |