aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/control/parser/text.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/control/parser/text.lux62
1 files changed, 31 insertions, 31 deletions
diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux
index 9c847ad5c..8594dc353 100644
--- a/stdlib/source/library/lux/control/parser/text.lux
+++ b/stdlib/source/library/lux/control/parser/text.lux
@@ -58,18 +58,18 @@
(def: .public (result parser input)
(All (_ a) (-> (Parser a) Text (Try a)))
(case (parser [start_offset input])
- (#try.Failure msg)
- (#try.Failure msg)
+ {#try.Failure msg}
+ {#try.Failure msg}
- (#try.Success [[end_offset _] output])
+ {#try.Success [[end_offset _] output]}
(if (n.= end_offset (/.size input))
- (#try.Success output)
+ {#try.Success output}
(exception.except ..unconsumed_input [end_offset input]))))
(def: .public offset
(Parser Offset)
(function (_ (^@ input [offset tape]))
- (#try.Success [input offset])))
+ {#try.Success [input offset]}))
(def: (with_slices parser)
(-> (Parser (List Slice)) (Parser Slice))
@@ -87,8 +87,8 @@
(Parser Text)
(function (_ [offset tape])
(case (/.char offset tape)
- (#.Some output)
- (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_char output)])
+ {#.Some output}
+ {#try.Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]}
_
(exception.except ..cannot_parse []))))
@@ -97,10 +97,10 @@
(Parser Slice)
(function (_ [offset tape])
(case (/.char offset tape)
- (#.Some _)
- (#try.Success [[("lux i64 +" 1 offset) tape]
+ {#.Some _}
+ {#try.Success [[("lux i64 +" 1 offset) tape]
[#basis offset
- #distance 1]])
+ #distance 1]]}
_
(exception.except ..cannot_slice []))))
@@ -110,7 +110,7 @@
(All (_ a) (-> (Parser a) (Parser <type>)))
(function (_ input)
(case (parser input)
- (#try.Failure msg)
+ {#try.Failure msg}
(<any> input)
_
@@ -128,10 +128,10 @@
(-> Text (Parser Any))
(function (_ [offset tape])
(case (/.index_since offset reference tape)
- (#.Some where)
+ {#.Some where}
(if (n.= offset where)
- (#try.Success [[("lux i64 +" (/.size reference) offset) tape]
- []])
+ {#try.Success [[("lux i64 +" (/.size reference) offset) tape]
+ []]}
(exception.except ..cannot_match [reference]))
_
@@ -141,15 +141,15 @@
(Parser Any)
(function (_ (^@ input [offset tape]))
(if (n.= offset (/.size tape))
- (#try.Success [input []])
+ {#try.Success [input []]}
(exception.except ..unconsumed_input input))))
(def: .public next
(Parser Text)
(function (_ (^@ input [offset tape]))
(case (/.char offset tape)
- (#.Some output)
- (#try.Success [input (/.of_char output)])
+ {#.Some output}
+ {#try.Success [input (/.of_char output)]}
_
(exception.except ..cannot_parse []))))
@@ -157,7 +157,7 @@
(def: .public remaining
(Parser Text)
(function (_ (^@ input [offset tape]))
- (#try.Success [input (..left_over offset tape)])))
+ {#try.Success [input (..left_over offset tape)]}))
(def: .public (range bottom top)
(-> Nat Nat (Parser Text))
@@ -211,10 +211,10 @@
(-> Text (Parser Text))
(function (_ [offset tape])
(case (/.char offset tape)
- (#.Some output)
+ {#.Some output}
(let [output' (/.of_char output)]
(if (<modifier> (/.contains? output' options))
- (#try.Success [[("lux i64 +" 1 offset) tape] output'])
+ {#try.Success [[("lux i64 +" 1 offset) tape] output']}
(exception.except <exception> [options output])))
_
@@ -229,12 +229,12 @@
(-> Text (Parser Slice))
(function (_ [offset tape])
(case (/.char offset tape)
- (#.Some output)
+ {#.Some output}
(let [output' (/.of_char output)]
(if (<modifier> (/.contains? output' options))
- (#try.Success [[("lux i64 +" 1 offset) tape]
+ {#try.Success [[("lux i64 +" 1 offset) tape]
[#basis offset
- #distance 1]])
+ #distance 1]]}
(exception.except <exception> [options output])))
_
@@ -252,9 +252,9 @@
(-> (-> Char Bit) (Parser Text))
(function (_ [offset tape])
(case (/.char offset tape)
- (#.Some output)
+ {#.Some output}
(if (parser output)
- (#try.Success [[("lux i64 +" 1 offset) tape] (/.of_char output)])
+ {#try.Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]}
(exception.except ..character_does_not_satisfy_predicate [output]))
_
@@ -340,11 +340,11 @@
(All (_ a) (-> Text (Parser a) (Parser a)))
(function (_ real_input)
(case (..result parser local_input)
- (#try.Failure error)
- (#try.Failure error)
+ {#try.Failure error}
+ {#try.Failure error}
- (#try.Success value)
- (#try.Success [real_input value]))))
+ {#try.Success value}
+ {#try.Success [real_input value]})))
(def: .public (slice parser)
(-> (Parser Slice) (Parser Text))
@@ -352,8 +352,8 @@
[[basis distance] parser]
(function (_ (^@ input [offset tape]))
(case (/.clip basis distance tape)
- (#.Some output)
- (#try.Success [input output])
+ {#.Some output}
+ {#try.Success [input output]}
#.None
(exception.except ..cannot_slice [])))))