aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/parser/lux/meta/code.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/parser/lux/meta/code.lux34
1 files changed, 17 insertions, 17 deletions
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))))