aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/parser
diff options
context:
space:
mode:
authorEduardo Julian2022-08-11 04:15:07 -0400
committerEduardo Julian2022-08-11 04:15:07 -0400
commit065e8a4d8122d4616b570496915d2c0e2c78cd6b (patch)
treef2bbdc3e40b796b34026ab04c9a478d8a3f082d5 /stdlib/source/parser
parent68d78235694c633c956bb9e8a007cad7d65370bc (diff)
Re-named the "case" macro to "when".
Diffstat (limited to 'stdlib/source/parser')
-rw-r--r--stdlib/source/parser/lux/data/binary.lux8
-rw-r--r--stdlib/source/parser/lux/data/collection/tree.lux2
-rw-r--r--stdlib/source/parser/lux/data/format/json.lux28
-rw-r--r--stdlib/source/parser/lux/data/format/xml.lux22
-rw-r--r--stdlib/source/parser/lux/data/text.lux24
-rw-r--r--stdlib/source/parser/lux/meta/code.lux34
-rw-r--r--stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux14
-rw-r--r--stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux18
-rw-r--r--stdlib/source/parser/lux/meta/type.lux28
-rw-r--r--stdlib/source/parser/lux/program.lux12
-rw-r--r--stdlib/source/parser/lux/world/environment.lux2
11 files changed, 96 insertions, 96 deletions
diff --git a/stdlib/source/parser/lux/data/binary.lux b/stdlib/source/parser/lux/data/binary.lux
index d1cf273f3..37fc881d3 100644
--- a/stdlib/source/parser/lux/data/binary.lux
+++ b/stdlib/source/parser/lux/data/binary.lux
@@ -56,7 +56,7 @@
(def .public (result parser input)
(All (_ a) (-> (Parser a) Binary (Try a)))
- (case (parser [0 input])
+ (when (parser [0 input])
{try.#Success [[end _] output]}
(let [length (/.size input)]
(if (n#= end length)
@@ -138,7 +138,7 @@
[flag (is (Parser Nat)
..bits_8)]
(with_expansions [<case>+' (template.spliced <case>+)]
- (case flag
+ (when flag
(^.with_template [<number> <tag> <parser>]
[<number> (`` (at ! each (|>> {(,, (template.spliced <tag>))}) <parser>))])
(<case>+')
@@ -170,14 +170,14 @@
(do //.monad
[value (is (Parser Nat)
..bits_8)]
- (case value
+ (when value
0 (in #0)
1 (in #1)
_ (//.lifted (exception.except ..not_a_bit [value])))))
(def .public (segment size)
(-> Nat (Parser Binary))
- (case size
+ (when size
0 (//#in (/.empty 0))
_ (function (_ [start binary])
(let [end (n#+ size start)]
diff --git a/stdlib/source/parser/lux/data/collection/tree.lux b/stdlib/source/parser/lux/data/collection/tree.lux
index 5d10ce15b..38132cdb4 100644
--- a/stdlib/source/parser/lux/data/collection/tree.lux
+++ b/stdlib/source/parser/lux/data/collection/tree.lux
@@ -35,7 +35,7 @@
[(def .public <name>
(All (_ t) (Parser t []))
(function (_ zipper)
- (case (<direction> zipper)
+ (when (<direction> zipper)
{.#None}
(exception.except ..cannot_move_further [])
diff --git a/stdlib/source/parser/lux/data/format/json.lux b/stdlib/source/parser/lux/data/format/json.lux
index d440cd091..e1c1178e0 100644
--- a/stdlib/source/parser/lux/data/format/json.lux
+++ b/stdlib/source/parser/lux/data/format/json.lux
@@ -33,9 +33,9 @@
(def .public (result parser json)
(All (_ a) (-> (Parser a) JSON (Try a)))
- (case (//.result parser (list json))
+ (when (//.result parser (list json))
{try.#Success [remainder output]}
- (case remainder
+ (when remainder
{.#End}
{try.#Success output}
@@ -48,7 +48,7 @@
(def .public any
(Parser JSON)
(<| (function (_ inputs))
- (case inputs
+ (when inputs
{.#End}
(exception.except ..empty_input [])
@@ -64,7 +64,7 @@
(Parser <type>)
(do //.monad
[head ..any]
- (case head
+ (when head
{<tag> value}
(in value)
@@ -88,7 +88,7 @@
(-> <type> (Parser Bit))
(do //.monad
[head ..any]
- (case head
+ (when head
{<tag> value}
(in (at <equivalence> = test value))
@@ -99,7 +99,7 @@
(-> <type> (Parser Any))
(do //.monad
[head ..any]
- (case head
+ (when head
{<tag> value}
(if (at <equivalence> = test value)
(in [])
@@ -122,14 +122,14 @@
(All (_ a) (-> (Parser a) (Parser a)))
(do //.monad
[head ..any]
- (case head
+ (when head
{/.#Array values}
- (case (//.result parser (sequence.list values))
+ (when (//.result parser (sequence.list values))
{try.#Failure error}
(//.failure error)
{try.#Success [remainder output]}
- (case remainder
+ (when remainder
{.#End}
(in output)
@@ -143,9 +143,9 @@
(All (_ a) (-> (Parser a) (Parser a)))
(do //.monad
[head ..any]
- (case head
+ (when head
{/.#Object kvs}
- (case (|> kvs
+ (when (|> kvs
dictionary.entries
(list#each (function (_ [key value])
(list {/.#String key} value)))
@@ -155,7 +155,7 @@
(//.failure error)
{try.#Success [remainder output]}
- (case remainder
+ (when remainder
{.#End}
(in output)
@@ -168,10 +168,10 @@
(def .public (field field_name parser)
(All (_ a) (-> Text (Parser a) (Parser a)))
(function (again inputs)
- (case inputs
+ (when inputs
(list.partial {/.#String key} value inputs')
(if (text#= key field_name)
- (case (//.result parser (list value))
+ (when (//.result parser (list value))
{try.#Success [{.#End} output]}
{try.#Success [inputs' output]}
diff --git a/stdlib/source/parser/lux/data/format/xml.lux b/stdlib/source/parser/lux/data/format/xml.lux
index 0a54431e2..38d0d33da 100644
--- a/stdlib/source/parser/lux/data/format/xml.lux
+++ b/stdlib/source/parser/lux/data/format/xml.lux
@@ -42,7 +42,7 @@
(def (result' parser attrs documents)
(All (_ a) (-> (Parser a) Attrs (List XML) (Try a)))
- (case (//.result parser [attrs documents])
+ (when (//.result parser [attrs documents])
{try.#Success [[attrs' remaining] output]}
(if (list.empty? remaining)
{try.#Success output}
@@ -58,12 +58,12 @@
(def .public text
(Parser Text)
(function (_ [attrs documents])
- (case documents
+ (when documents
{.#End}
(exception.except ..empty_input [])
{.#Item head tail}
- (case head
+ (when head
{/.#Text value}
{try.#Success [[attrs tail] value]}
@@ -73,12 +73,12 @@
(def .public tag
(Parser Tag)
(function (_ [attrs documents])
- (case documents
+ (when documents
{.#End}
(exception.except ..empty_input [])
{.#Item head _}
- (case head
+ (when head
{/.#Text _}
(exception.except ..unexpected_input [])
@@ -88,7 +88,7 @@
(def .public (attribute name)
(-> Attribute (Parser Text))
(function (_ [attrs documents])
- (case (dictionary.value name attrs)
+ (when (dictionary.value name attrs)
{.#None}
(exception.except ..unknown_attribute [name (dictionary.keys attrs)])
@@ -98,12 +98,12 @@
(def .public (node expected parser)
(All (_ a) (-> Tag (Parser a) (Parser a)))
(function (_ [attrs documents])
- (case documents
+ (when documents
{.#End}
(exception.except ..empty_input [])
{.#Item head tail}
- (case head
+ (when head
{/.#Text _}
(exception.except ..unexpected_input [])
@@ -117,7 +117,7 @@
(def .public any
(Parser XML)
(function (_ [attrs documents])
- (case documents
+ (when documents
{.#End}
(exception.except ..empty_input [])
@@ -129,12 +129,12 @@
(def .public (somewhere parser)
(All (_ a) (-> (Parser a) (Parser a)))
(function (again [attrs input])
- (case (//.result parser [attrs input])
+ (when (//.result parser [attrs input])
{try.#Success [[attrs remaining] output]}
{try.#Success [[attrs remaining] output]}
{try.#Failure error}
- (case input
+ (when input
{.#End}
(exception.except ..nowhere [])
diff --git a/stdlib/source/parser/lux/data/text.lux b/stdlib/source/parser/lux/data/text.lux
index 75c30816f..28320b351 100644
--- a/stdlib/source/parser/lux/data/text.lux
+++ b/stdlib/source/parser/lux/data/text.lux
@@ -45,7 +45,7 @@
(do //.monad
[[basis distance] parser]
(function (_ (^.let input [offset tape]))
- (case (/.clip basis distance tape)
+ (when (/.clip basis distance tape)
{.#Some output}
{try.#Success [input output]}
@@ -71,7 +71,7 @@
(def .public (result parser input)
(All (_ a) (-> (Parser a) Text (Try a)))
- (case (parser [..beginning input])
+ (when (parser [..beginning input])
{try.#Failure msg}
{try.#Failure msg}
@@ -100,7 +100,7 @@
(def .public any
(Parser Text)
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
{try.#Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]}
@@ -110,7 +110,7 @@
(def .public any!
(Parser Slice)
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some _}
{try.#Success [[("lux i64 +" 1 offset) tape]
[#basis offset
@@ -123,7 +123,7 @@
[(`` (def .public (<name> parser)
(All (_ a) (-> (Parser a) (Parser <type>)))
(function (_ input)
- (case (parser input)
+ (when (parser input)
{try.#Failure msg}
(<any> input)
@@ -141,7 +141,7 @@
(def .public (this reference)
(-> Text (Parser Any))
(function (_ [offset tape])
- (case (/.index_since offset reference tape)
+ (when (/.index_since offset reference tape)
{.#Some where}
(if (n.= offset where)
{try.#Success [[("lux i64 +" (/.size reference) offset) tape]
@@ -161,7 +161,7 @@
(def .public next
(Parser Text)
(function (_ (^.let input [offset tape]))
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
{try.#Success [input (/.of_char output)]}
@@ -244,7 +244,7 @@
[(def .public (<name> options)
(-> Text (Parser Text))
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
(let [output' (/.of_char output)]
(if (<modifier> (/.contains? output' options))
@@ -262,7 +262,7 @@
[(def .public (<name> options)
(-> Text (Parser Slice))
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
(let [output' (/.of_char output)]
(if (<modifier> (/.contains? output' options))
@@ -285,7 +285,7 @@
(def .public (satisfies parser)
(-> (-> Char Bit) (Parser Text))
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
(if (parser output)
{try.#Success [[("lux i64 +" 1 offset) tape] (/.of_char output)]}
@@ -297,7 +297,7 @@
(def .public (satisfies! parser)
(-> (-> Char Bit) (Parser Slice))
(function (_ [offset tape])
- (case (/.char offset tape)
+ (when (/.char offset tape)
{.#Some output}
(if (parser output)
{try.#Success [[("lux i64 +" 1 offset) tape]
@@ -390,7 +390,7 @@
(def .public (local local_input parser)
(All (_ a) (-> Text (Parser a) (Parser a)))
(function (_ real_input)
- (case (..result parser local_input)
+ (when (..result parser local_input)
{try.#Failure error}
{try.#Failure error}
diff --git a/stdlib/source/parser/lux/meta/code.lux b/stdlib/source/parser/lux/meta/code.lux
index 844c0e1c2..b0a23eb8c 100644
--- a/stdlib/source/parser/lux/meta/code.lux
+++ b/stdlib/source/parser/lux/meta/code.lux
@@ -23,7 +23,7 @@
(def (un_paired pairs)
(All (_ a) (-> (List [a a]) (List a)))
- (case pairs
+ (when pairs
{.#End}
{.#End}
@@ -42,7 +42,7 @@
(def .public any
(Parser Code)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#End}
{try.#Failure "There are no tokens to parse!"}
@@ -52,7 +52,7 @@
(def .public next
(Parser Code)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#End}
{try.#Failure "There are no tokens to parse!"}
@@ -64,7 +64,7 @@
(def .public <query>
(Parser <type>)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {<tag> x}] tokens']}
{try.#Success [tokens' x]}
@@ -74,7 +74,7 @@
(def .public (<check> expected)
(-> <type> (Parser Any))
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {<tag> actual}] tokens']}
(if (at <eq> = expected actual)
{try.#Success [tokens' []]}
@@ -95,7 +95,7 @@
(def .public (this code)
(-> Code (Parser Any))
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [token tokens']}
(if (code#= code token)
{try.#Success [tokens' []]}
@@ -109,7 +109,7 @@
(def .public local
(Parser Text)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {.#Symbol ["" x]}] tokens']}
{try.#Success [tokens' x]}
@@ -119,7 +119,7 @@
(def .public (this_local expected)
(-> Text (Parser Any))
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {.#Symbol ["" actual]}] tokens']}
(if (at text.equivalence = expected actual)
{try.#Success [tokens' []]}
@@ -132,7 +132,7 @@
(def .public global
(Parser Symbol)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {.#Symbol ["" short]}] tokens']}
<failure>
@@ -145,7 +145,7 @@
(def .public (this_global expected)
(-> Symbol (Parser Any))
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {.#Symbol ["" actual]}] tokens']}
<failure>
@@ -162,9 +162,9 @@
(All (_ a)
(-> (Parser a) (Parser a)))
(function (_ tokens)
- (case tokens
+ (when tokens
{.#Item [[_ {<tag> members}] tokens']}
- (case (p members)
+ (when (p members)
{try.#Success [{.#End} x]} {try.#Success [tokens' x]}
_ {try.#Failure (all text#composite "Parser was expected to fully consume " <desc> (remaining_inputs tokens))})
@@ -179,25 +179,25 @@
(def .public end
(Parser Any)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#End} {try.#Success [tokens []]}
_ {try.#Failure (all text#composite "Expected list of tokens to be empty!" (remaining_inputs tokens))})))
(def .public end?
(Parser Bit)
(function (_ tokens)
- {try.#Success [tokens (case tokens
+ {try.#Success [tokens (when tokens
{.#End} true
_ false)]}))
(def .public (result parser inputs)
(All (_ a) (-> (Parser a) (List Code) (Try a)))
- (case (parser inputs)
+ (when (parser inputs)
{try.#Failure error}
{try.#Failure error}
{try.#Success [unconsumed value]}
- (case unconsumed
+ (when unconsumed
{.#End}
{try.#Success value}
@@ -220,6 +220,6 @@
[sample ..next
result (//.or parser
..any)]
- (case result
+ (when result
{.#Left _} (//.failure (text#composite "Did NOT expect to parse code: " (code.format sample)))
{.#Right output} (in output))))
diff --git a/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
index e8be9f6dc..0d98f3bd4 100644
--- a/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
+++ b/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux
@@ -50,7 +50,7 @@
(def .public (result parser input)
(All (_ a) (-> (Parser a) (List Analysis) (Try a)))
- (case (parser input)
+ (when (parser input)
{try.#Failure error}
{try.#Failure error}
@@ -63,7 +63,7 @@
(def .public any
(Parser Analysis)
(function (_ input)
- (case input
+ (when input
{.#End}
(exception.except ..cannot_parse input)
@@ -73,7 +73,7 @@
(def .public end
(Parser Any)
(function (_ tokens)
- (case tokens
+ (when tokens
{.#End} {try.#Success [tokens []]}
_ {try.#Failure (format "Expected list of tokens to be empty!"
(remaining_inputs tokens))})))
@@ -81,7 +81,7 @@
(def .public end?
(Parser Bit)
(function (_ tokens)
- {try.#Success [tokens (case tokens
+ {try.#Success [tokens (when tokens
{.#End} true
_ false)]}))
@@ -89,7 +89,7 @@
[(`` (these (def .public <query>
(Parser <type>)
(function (_ input)
- (case input
+ (when input
(list.partial (<tag> x) input')
{try.#Success [input' x]}
@@ -99,7 +99,7 @@
(def .public (<assertion> expected)
(-> <type> (Parser Any))
(function (_ input)
- (case input
+ (when input
(list.partial (<tag> actual) input')
(if (at <eq> = expected actual)
{try.#Success [input' []]}
@@ -122,7 +122,7 @@
(def .public (tuple parser)
(All (_ a) (-> (Parser a) (Parser a)))
(function (_ input)
- (case input
+ (when input
(list.partial (/.tuple head) tail)
(do try.monad
[output (..result parser head)]
diff --git a/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux b/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux
index 9431da2a7..fda40e0cd 100644
--- a/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux
@@ -55,7 +55,7 @@
(def .public (result parser input)
(All (_ a) (-> (Parser a) (List Synthesis) (Try a)))
- (case (parser input)
+ (when (parser input)
{try.#Failure error}
{try.#Failure error}
@@ -68,7 +68,7 @@
(def .public any
(Parser Synthesis)
(.function (_ input)
- (case input
+ (when input
{.#End}
(exception.except ..empty_input [])
@@ -78,14 +78,14 @@
(def .public end
(Parser Any)
(.function (_ tokens)
- (case tokens
+ (when tokens
{.#End} {try.#Success [tokens []]}
_ (exception.except ..expected_empty_input [tokens]))))
(def .public end?
(Parser Bit)
(.function (_ tokens)
- {try.#Success [tokens (case tokens
+ {try.#Success [tokens (when tokens
{.#End} true
_ false)]}))
@@ -93,7 +93,7 @@
[(`` (def .public <query>
(Parser <type>)
(.function (_ input)
- (case input
+ (when input
(list.partial (<tag> x) input')
{try.#Success [input' x]}
@@ -103,7 +103,7 @@
(`` (def .public (<assertion> expected)
(-> <type> (Parser Any))
(.function (_ input)
- (case input
+ (when input
(list.partial (<tag> actual) input')
(if (at <eq> = expected actual)
{try.#Success [input' []]}
@@ -124,7 +124,7 @@
(def .public (tuple parser)
(All (_ a) (-> (Parser a) (Parser a)))
(.function (_ input)
- (case input
+ (when input
(list.partial (/.tuple head) tail)
(do try.monad
[output (..result parser head)]
@@ -136,7 +136,7 @@
(def .public (function expected parser)
(All (_ a) (-> Arity (Parser a) (Parser [(Environment Synthesis) a])))
(.function (_ input)
- (case input
+ (when input
(list.partial (/.function/abstraction [environment actual body]) tail)
(if (n.= expected actual)
(do try.monad
@@ -150,7 +150,7 @@
(def .public (loop init_parsers iteration_parser)
(All (_ a b) (-> (Parser a) (Parser b) (Parser [Register a b])))
(.function (_ input)
- (case input
+ (when input
(list.partial (/.loop/scope [start inits iteration]) tail)
(do try.monad
[inits (..result init_parsers inits)
diff --git a/stdlib/source/parser/lux/meta/type.lux b/stdlib/source/parser/lux/meta/type.lux
index b7cc07bef..f93efcd6d 100644
--- a/stdlib/source/parser/lux/meta/type.lux
+++ b/stdlib/source/parser/lux/meta/type.lux
@@ -77,12 +77,12 @@
(def (result' env poly types)
(All (_ a) (-> Env (Parser a) (List Type) (Try a)))
- (case (//.result poly [env types])
+ (when (//.result poly [env types])
{try.#Failure error}
{try.#Failure error}
{try.#Success [[env' remaining] output]}
- (case remaining
+ (when remaining
{.#End}
{try.#Success output}
@@ -101,7 +101,7 @@
(def (with_env temp poly)
(All (_ a) (-> Env (Parser a) (Parser a)))
(.function (_ [env inputs])
- (case (//.result poly [temp inputs])
+ (when (//.result poly [temp inputs])
{try.#Failure error}
{try.#Failure error}
@@ -111,7 +111,7 @@
(def .public next
(Parser Type)
(.function (_ [env inputs])
- (case inputs
+ (when inputs
{.#End}
(exception.except ..empty_input [])
@@ -121,7 +121,7 @@
(def .public any
(Parser Type)
(.function (_ [env inputs])
- (case inputs
+ (when inputs
{.#End}
(exception.except ..empty_input [])
@@ -131,7 +131,7 @@
(def .public (local types poly)
(All (_ a) (-> (List Type) (Parser a) (Parser a)))
(.function (_ [env pass_through])
- (case (result' env poly types)
+ (when (result' env poly types)
{try.#Failure error}
{try.#Failure error}
@@ -147,7 +147,7 @@
(.function (_ [env inputs])
(let [current_id (dictionary.size env)
g!var (label current_id)]
- (case (//.result poly
+ (when (//.result poly
[(dictionary.has current_id [type g!var] env)
inputs])
{try.#Failure error}
@@ -261,9 +261,9 @@
(do //.monad
[env ..env
headT any]
- (case headT
+ (when headT
{.#Parameter idx}
- (case (dictionary.value (..argument env idx) env)
+ (when (dictionary.value (..argument env idx) env)
{.#Some [poly_type poly_code]}
(in poly_code)
@@ -278,7 +278,7 @@
(do //.monad
[env ..env
headT any]
- (case headT
+ (when headT
{.#Parameter idx}
(if (n.= id (..argument env idx))
(in [])
@@ -291,7 +291,7 @@
(Parser Nat)
(do //.monad
[headT any]
- (case headT
+ (when headT
{.#Ex ex_id}
(in ex_id)
@@ -302,7 +302,7 @@
(Parser [Symbol Type])
(do //.monad
[inputT any]
- (case inputT
+ (when inputT
{.#Named name anonymousT}
(in [name anonymousT])
@@ -313,7 +313,7 @@
(All (_ a) (-> (Parser a) (Parser [Code a])))
(do [! //.monad]
[headT any]
- (case (/.anonymous headT)
+ (when (/.anonymous headT)
{.#Apply (|recursion_dummy|) {.#UnivQ _ headT'}}
(do !
[[recT _ output] (|> poly
@@ -330,7 +330,7 @@
(do //.monad
[env ..env
headT any]
- (case (/.anonymous headT)
+ (when (/.anonymous headT)
(^.multi {.#Apply (|recursion_dummy|) {.#Parameter funcT_idx}}
(n.= 0 (..argument env funcT_idx))
[(dictionary.value 0 env) {.#Some [self_type self_call]}])
diff --git a/stdlib/source/parser/lux/program.lux b/stdlib/source/parser/lux/program.lux
index eff42b3ad..c9ec8b72a 100644
--- a/stdlib/source/parser/lux/program.lux
+++ b/stdlib/source/parser/lux/program.lux
@@ -15,9 +15,9 @@
(def .public (result parser inputs)
(All (_ a) (-> (Parser a) (List Text) (Try a)))
- (case (//.result parser inputs)
+ (when (//.result parser inputs)
{try.#Success [remaining output]}
- (case remaining
+ (when remaining
{.#End}
{try.#Success output}
@@ -30,7 +30,7 @@
(def .public any
(Parser Text)
(function (_ inputs)
- (case inputs
+ (when inputs
{.#Item arg inputs'}
{try.#Success [inputs' arg]}
@@ -58,9 +58,9 @@
(All (_ a) (-> (Parser a) (Parser a)))
(function (_ inputs)
(loop (again [immediate inputs])
- (case (//.result cli immediate)
+ (when (//.result cli immediate)
{try.#Failure try}
- (case immediate
+ (when immediate
{.#End}
{try.#Failure try}
@@ -76,7 +76,7 @@
(def .public end
(Parser Any)
(function (_ inputs)
- (case inputs
+ (when inputs
{.#End} {try.#Success [inputs []]}
_ {try.#Failure (format "Unknown parameters: " (text.interposed " " inputs))})))
diff --git a/stdlib/source/parser/lux/world/environment.lux b/stdlib/source/parser/lux/world/environment.lux
index 311048fdf..10230d5a1 100644
--- a/stdlib/source/parser/lux/world/environment.lux
+++ b/stdlib/source/parser/lux/world/environment.lux
@@ -32,7 +32,7 @@
(def .public (property name)
(-> Property (Parser Text))
(function (_ environment)
- (case (dictionary.value name environment)
+ (when (dictionary.value name environment)
{.#Some value}
{try.#Success [environment value]}