diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/control/parser/synthesis.lux | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/source/lux/control/parser/synthesis.lux b/stdlib/source/lux/control/parser/synthesis.lux index e5b0bda2a..ad376d059 100644 --- a/stdlib/source/lux/control/parser/synthesis.lux +++ b/stdlib/source/lux/control/parser/synthesis.lux @@ -30,24 +30,24 @@ Type (type (List Synthesis))) -(exception: #export (cannot-parse {input ..Input}) +(exception: #export (cannot_parse {input ..Input}) (exception.report ["Input" (exception.enumerate /.%synthesis input)])) -(exception: #export (unconsumed-input {input ..Input}) +(exception: #export (unconsumed_input {input ..Input}) (exception.report ["Input" (exception.enumerate /.%synthesis input)])) -(exception: #export (expected-empty-input {input ..Input}) +(exception: #export (expected_empty_input {input ..Input}) (exception.report ["Input" (exception.enumerate /.%synthesis input)])) -(exception: #export (wrong-arity {expected Arity} {actual Arity}) +(exception: #export (wrong_arity {expected Arity} {actual Arity}) (exception.report ["Expected" (%.nat expected)] ["Actual" (%.nat actual)])) -(exception: #export empty-input) +(exception: #export empty_input) (type: #export Parser (//.Parser ..Input)) @@ -62,14 +62,14 @@ (#try.Success value) (#try.Success [unconsumed _]) - (exception.throw ..unconsumed-input unconsumed))) + (exception.throw ..unconsumed_input unconsumed))) (def: #export any (Parser Synthesis) (.function (_ input) (case input #.Nil - (exception.throw ..empty-input []) + (exception.throw ..empty_input []) (#.Cons [head tail]) (#try.Success [tail head])))) @@ -80,7 +80,7 @@ (.function (_ tokens) (case tokens #.Nil (#try.Success [tokens []]) - _ (exception.throw ..expected-empty-input [tokens])))) + _ (exception.throw ..expected_empty_input [tokens])))) (def: #export end? {#.doc "Checks whether there are no more inputs."} @@ -99,7 +99,7 @@ (#try.Success [input' x]) _ - (exception.throw ..cannot-parse input)))) + (exception.throw ..cannot_parse input)))) (def: #export (<assertion> expected) (-> <type> (Parser Any)) @@ -108,10 +108,10 @@ (^ (list& (<tag> actual) input')) (if (\ <eq> = expected actual) (#try.Success [input' []]) - (exception.throw ..cannot-parse input)) + (exception.throw ..cannot_parse input)) _ - (exception.throw ..cannot-parse input))))] + (exception.throw ..cannot_parse input))))] [bit bit! /.bit Bit bit.equivalence] [i64 i64! /.i64 (I64 Any) i64.equivalence] @@ -132,7 +132,7 @@ (#try.Success [tail output])) _ - (exception.throw ..cannot-parse input)))) + (exception.throw ..cannot_parse input)))) (def: #export (function expected parser) (All [a] (-> Arity (Parser a) (Parser [(Environment Synthesis) a]))) @@ -143,20 +143,20 @@ (do try.monad [output (..run parser (list body))] (#try.Success [tail [environment output]])) - (exception.throw ..wrong-arity [expected actual])) + (exception.throw ..wrong_arity [expected actual])) _ - (exception.throw ..cannot-parse input)))) + (exception.throw ..cannot_parse input)))) -(def: #export (loop init-parsers iteration-parser) +(def: #export (loop init_parsers iteration_parser) (All [a b] (-> (Parser a) (Parser b) (Parser [Register a b]))) (.function (_ input) (case input (^ (list& (/.loop/scope [start inits iteration]) tail)) (do try.monad - [inits (..run init-parsers inits) - iteration (..run iteration-parser (list iteration))] + [inits (..run init_parsers inits) + iteration (..run iteration_parser (list iteration))] (#try.Success [tail [start inits iteration]])) _ - (exception.throw ..cannot-parse input)))) + (exception.throw ..cannot_parse input)))) |