diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/macro/syntax.lux | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index edee25af3..02c3ad1ae 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -40,7 +40,7 @@ (Syntax Code) (function (_ tokens) (case tokens - #.Nil (#error.Error "There are no tokens to parse!") + #.Nil (#error.Failure "There are no tokens to parse!") (#.Cons [t tokens']) (#error.Success [tokens' t])))) (do-template [<get-name> <type> <tag> <eq> <desc>] @@ -53,7 +53,7 @@ (#error.Success [tokens' x]) _ - (#error.Error ($_ text/compose "Cannot parse " <desc> (remaining-inputs tokens))))))] + (#error.Failure ($_ text/compose "Cannot parse " <desc> (remaining-inputs tokens))))))] [ bit Bit #.Bit bit.Equivalence<Bit> "bit"] [ nat Nat #.Nat number.Equivalence<Nat> "nat"] @@ -88,11 +88,11 @@ (#.Cons [token tokens']) (if (code/= ast token) (#error.Success [tokens' []]) - (#error.Error ($_ text/compose "Expected a " (code.to-text ast) " but instead got " (code.to-text token) - (remaining-inputs tokens)))) + (#error.Failure ($_ text/compose "Expected a " (code.to-text ast) " but instead got " (code.to-text token) + (remaining-inputs tokens)))) _ - (#error.Error "There are no tokens to parse!")))) + (#error.Failure "There are no tokens to parse!")))) (do-template [<name> <tag> <desc>] [(def: #export <name> @@ -104,7 +104,7 @@ (#error.Success [tokens' x]) _ - (#error.Error ($_ text/compose "Cannot parse local " <desc> (remaining-inputs tokens))))))] + (#error.Failure ($_ text/compose "Cannot parse local " <desc> (remaining-inputs tokens))))))] [local-identifier #.Identifier "identifier"] [ local-tag #.Tag "tag"] @@ -120,10 +120,10 @@ (#.Cons [[_ (<tag> members)] tokens']) (case (p members) (#error.Success [#.Nil x]) (#error.Success [tokens' x]) - _ (#error.Error ($_ text/compose "Syntax was expected to fully consume " <desc> (remaining-inputs tokens)))) + _ (#error.Failure ($_ text/compose "Syntax was expected to fully consume " <desc> (remaining-inputs tokens)))) _ - (#error.Error ($_ text/compose "Cannot parse " <desc> (remaining-inputs tokens))))))] + (#error.Failure ($_ text/compose "Cannot parse " <desc> (remaining-inputs tokens))))))] [ form #.Form "form"] [tuple #.Tuple "tuple"] @@ -138,10 +138,10 @@ (#.Cons [[_ (#.Record pairs)] tokens']) (case (p (join-pairs pairs)) (#error.Success [#.Nil x]) (#error.Success [tokens' x]) - _ (#error.Error ($_ text/compose "Syntax was expected to fully consume record" (remaining-inputs tokens)))) + _ (#error.Failure ($_ text/compose "Syntax was expected to fully consume record" (remaining-inputs tokens)))) _ - (#error.Error ($_ text/compose "Cannot parse record" (remaining-inputs tokens)))))) + (#error.Failure ($_ text/compose "Cannot parse record" (remaining-inputs tokens)))))) (def: #export end! {#.doc "Ensures there are no more inputs."} @@ -149,7 +149,7 @@ (function (_ tokens) (case tokens #.Nil (#error.Success [tokens []]) - _ (#error.Error ($_ text/compose "Expected list of tokens to be empty!" (remaining-inputs tokens)))))) + _ (#error.Failure ($_ text/compose "Expected list of tokens to be empty!" (remaining-inputs tokens)))))) (def: #export end? {#.doc "Checks whether there are no more inputs."} @@ -163,8 +163,8 @@ (All [a] (-> (Error a) (Syntax a))) (function (_ input) (case outcome - (#error.Error error) - (#error.Error error) + (#error.Failure error) + (#error.Failure error) (#error.Success value) (#error.Success [input value]) @@ -173,8 +173,8 @@ (def: #export (run inputs syntax) (All [a] (-> (List Code) (Syntax a) (Error a))) (case (syntax inputs) - (#error.Error error) - (#error.Error error) + (#error.Failure error) + (#error.Failure error) (#error.Success [unconsumed value]) (case unconsumed @@ -182,9 +182,9 @@ (#error.Success value) _ - (#error.Error (text/compose "Unconsumed inputs: " - (|> (list/map code.to-text unconsumed) - (text.join-with ", "))))))) + (#error.Failure (text/compose "Unconsumed inputs: " + (|> (list/map code.to-text unconsumed) + (text.join-with ", "))))))) (def: #export (local inputs syntax) {#.doc "Run a syntax parser with the given list of inputs, instead of the real ones."} @@ -264,8 +264,8 @@ ({(#error.Success (~ g!body)) ((~ g!body) (~ g!state)) - (#error.Error (~ g!error)) - (#error.Error ((~! text.join-with) ": " (list (~ error-msg) (~ g!error))))} + (#error.Failure (~ g!error)) + (#error.Failure ((~! text.join-with) ": " (list (~ error-msg) (~ g!error))))} ((~! ..run) (~ g!tokens) (: ((~! ..Syntax) (Meta (List Code))) ((~! do) (~! p.Monad<Parser>) |