From d656ef2143151a1d78768df4562e5275dff67b9d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 15 Nov 2022 14:06:17 -0400 Subject: Added LineNumberTable annotations to functions when compiling for the JVM. --- .../lux/meta/compiler/language/lux/analysis.lux | 23 ++++++++++++---------- .../lux/meta/compiler/language/lux/synthesis.lux | 10 +++++----- 2 files changed, 18 insertions(+), 15 deletions(-) (limited to 'stdlib/source/parser') 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 1a32701c5..dec8032ed 100644 --- a/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux +++ b/stdlib/source/parser/lux/meta/compiler/language/lux/analysis.lux @@ -53,14 +53,14 @@ (def .public (result parser input) (All (_ a) (-> (Parser a) (List Analysis) (Try a))) (when (parser input) - {try.#Failure error} - {try.#Failure error} - {try.#Success [{.#End} value]} {try.#Success value} {try.#Success [unconsumed _]} - (exception.except ..unconsumed_input unconsumed))) + (exception.except ..unconsumed_input unconsumed) + + {try.#Failure error} + {try.#Failure error})) (def .public any (Parser Analysis) @@ -76,9 +76,12 @@ (Parser Any) (function (_ tokens) (when tokens - {.#End} {try.#Success [tokens []]} - _ {try.#Failure (format "Expected list of tokens to be empty!" - (remaining_inputs tokens))}))) + {.#End} + {try.#Success [tokens []]} + + _ + {try.#Failure (format "Expected list of tokens to be empty!" + (remaining_inputs tokens))}))) (def .public end? (Parser Bit) @@ -92,7 +95,7 @@ (Parser ) (function (_ input) (when input - (list.partial ( x) input') + (list.partial ( @ x) input') {try.#Success [input' x]} _ @@ -102,7 +105,7 @@ (-> (Parser Any)) (function (_ input) (when input - (list.partial ( actual) input') + (list.partial ( @ actual) input') (if (at = expected actual) {try.#Success [input' []]} (exception.except ..cannot_parse input)) @@ -125,7 +128,7 @@ (All (_ a) (-> (Parser a) (Parser a))) (function (_ input) (when input - (list.partial (/.tuple head) tail) + (list.partial (/.tuple @ head) tail) (do try.monad [output (..result parser head)] {try.#Success [tail output]}) 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 66b41582e..e1d740d92 100644 --- a/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux +++ b/stdlib/source/parser/lux/meta/compiler/language/lux/synthesis.lux @@ -93,7 +93,7 @@ (Parser ) (.function (_ input) (when input - (list.partial ( x) input') + (list.partial ( @ x) input') {try.#Success [input' x]} _ @@ -103,7 +103,7 @@ (-> (Parser Any)) (.function (_ input) (when input - (list.partial ( actual) input') + (list.partial ( @ actual) input') (if (at = expected actual) {try.#Success [input' []]} (exception.except ..cannot_parse input)) @@ -124,7 +124,7 @@ (All (_ a) (-> (Parser a) (Parser a))) (.function (_ input) (when input - (list.partial (/.tuple head) tail) + (list.partial (/.tuple @ head) tail) (do try.monad [output (..result parser head)] {try.#Success [tail output]}) @@ -136,7 +136,7 @@ (All (_ a) (-> Arity (Parser a) (Parser [(Environment Synthesis) a]))) (.function (_ input) (when input - (list.partial (/.function/abstraction [environment actual body]) tail) + (list.partial (/.function/abstraction @ [environment actual body]) tail) (if (n.= expected actual) (do try.monad [output (..result parser (list body))] @@ -150,7 +150,7 @@ (All (_ a b) (-> (Parser a) (Parser b) (Parser [Register a b]))) (.function (_ input) (when input - (list.partial (/.loop/scope [start inits iteration]) tail) + (list.partial (/.loop/scope @ [start inits iteration]) tail) (do try.monad [inits (..result init_parsers inits) iteration (..result iteration_parser (list iteration))] -- cgit v1.2.3