diff options
Diffstat (limited to 'stdlib/source/lux/macro/syntax.lux')
-rw-r--r-- | stdlib/source/lux/macro/syntax.lux | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index 96f1b658f..51333ddc3 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -29,7 +29,7 @@ ## [Utils] (def: (remaining-inputs asts) (-> (List Code) Text) - ($_ Text/append "\nRemaining input: " + ($_ Text/compose "\nRemaining input: " (|> asts (map code;to-text) (interpose " ") (text;join-with "")))) ## [Syntaxs] @@ -43,7 +43,7 @@ (do-template [<get-name> <type> <tag> <eq> <desc>] [(def: #export <get-name> - {#;doc (#;TextA ($_ Text/append "Parses the next " <desc> " input Code."))} + {#;doc (#;TextA ($_ Text/compose "Parses the next " <desc> " input Code."))} (Syntax <type>) (function [tokens] (case tokens @@ -51,7 +51,7 @@ (#R;Success [tokens' x]) _ - (#R;Error ($_ Text/append "Cannot parse " <desc> (remaining-inputs tokens))))))] + (#R;Error ($_ Text/compose "Cannot parse " <desc> (remaining-inputs tokens))))))] [ bool Bool #;Bool bool;Eq<Bool> "bool"] [ nat Nat #;Nat number;Eq<Nat> "nat"] @@ -86,7 +86,7 @@ (#;Cons [token tokens']) (if (Code/= ast token) (#R;Success [tokens' []]) - (#R;Error ($_ Text/append "Expected a " (code;to-text ast) " but instead got " (code;to-text token) + (#R;Error ($_ Text/compose "Expected a " (code;to-text ast) " but instead got " (code;to-text token) (remaining-inputs tokens)))) _ @@ -106,7 +106,7 @@ (do-template [<name> <tag> <desc>] [(def: #export <name> - {#;doc (#;TextA ($_ Text/append "Parse a local " <desc> " (a " <desc> " that has no module prefix)."))} + {#;doc (#;TextA ($_ Text/compose "Parse a local " <desc> " (a " <desc> " that has no module prefix)."))} (Syntax Text) (function [tokens] (case tokens @@ -114,7 +114,7 @@ (#R;Success [tokens' x]) _ - (#R;Error ($_ Text/append "Cannot parse local " <desc> (remaining-inputs tokens))))))] + (#R;Error ($_ Text/compose "Cannot parse local " <desc> (remaining-inputs tokens))))))] [local-symbol #;Symbol "symbol"] [ local-tag #;Tag "tag"] @@ -122,7 +122,7 @@ (do-template [<name> <tag> <desc>] [(def: #export (<name> p) - {#;doc (#;TextA ($_ Text/append "Parse inside the contents of a " <desc> " as if they were the input Codes."))} + {#;doc (#;TextA ($_ Text/compose "Parse inside the contents of a " <desc> " as if they were the input Codes."))} (All [a] (-> (Syntax a) (Syntax a))) (function [tokens] @@ -130,17 +130,17 @@ (#;Cons [[_ (<tag> members)] tokens']) (case (p members) (#R;Success [#;Nil x]) (#R;Success [tokens' x]) - _ (#R;Error ($_ Text/append "Syntax was expected to fully consume " <desc> (remaining-inputs tokens)))) + _ (#R;Error ($_ Text/compose "Syntax was expected to fully consume " <desc> (remaining-inputs tokens)))) _ - (#R;Error ($_ Text/append "Cannot parse " <desc> (remaining-inputs tokens))))))] + (#R;Error ($_ Text/compose "Cannot parse " <desc> (remaining-inputs tokens))))))] [ form #;Form "form"] [tuple #;Tuple "tuple"] ) (def: #export (record p) - {#;doc (#;TextA ($_ Text/append "Parse inside the contents of a record as if they were the input Codes."))} + {#;doc (#;TextA ($_ Text/compose "Parse inside the contents of a record as if they were the input Codes."))} (All [a] (-> (Syntax a) (Syntax a))) (function [tokens] @@ -148,10 +148,10 @@ (#;Cons [[_ (#;Record pairs)] tokens']) (case (p (join-pairs pairs)) (#R;Success [#;Nil x]) (#R;Success [tokens' x]) - _ (#R;Error ($_ Text/append "Syntax was expected to fully consume record" (remaining-inputs tokens)))) + _ (#R;Error ($_ Text/compose "Syntax was expected to fully consume record" (remaining-inputs tokens)))) _ - (#R;Error ($_ Text/append "Cannot parse record" (remaining-inputs tokens)))))) + (#R;Error ($_ Text/compose "Cannot parse record" (remaining-inputs tokens)))))) (def: #export end! {#;doc "Ensures there are no more inputs."} @@ -159,7 +159,7 @@ (function [tokens] (case tokens #;Nil (#R;Success [tokens []]) - _ (#R;Error ($_ Text/append "Expected list of tokens to be empty!" (remaining-inputs tokens)))))) + _ (#R;Error ($_ Text/compose "Expected list of tokens to be empty!" (remaining-inputs tokens)))))) (def: #export end? {#;doc "Checks whether there are no more inputs."} @@ -195,9 +195,9 @@ (#R;Success [real-inputs value]) _ - (#R;Error (Text/append "Unconsumed inputs: " - (|> (map code;to-text unconsumed-inputs) - (text;join-with ", ")))))))) + (#R;Error (Text/compose "Unconsumed inputs: " + (|> (map code;to-text unconsumed-inputs) + (text;join-with ", ")))))))) ## [Syntax] (def: #hidden text.join-with text;join-with) @@ -216,7 +216,7 @@ [interfaces (tuple (some (super-class-decl^ imports class-vars)))] [constructor-args (constructor-args^ imports class-vars)] [methods (some (overriden-method-def^ imports))]) - (let [def-code ($_ Text/append "anon-class:" + (let [def-code ($_ Text/compose "anon-class:" (spaced (list (super-class-decl$ (maybe;default object-super-class super)) (with-brackets (spaced (map super-class-decl$ interfaces))) (with-brackets (spaced (map constructor-arg$ constructor-args))) @@ -263,7 +263,7 @@ args) #let [g!state (code;symbol ["" "*compiler*"]) g!end (code;symbol ["" ""]) - error-msg (code;text (Text/append "Wrong syntax for " name)) + error-msg (code;text (Text/compose "Wrong syntax for " name)) export-ast (: (List Code) (case exported? (#;Some #R;Error) (list (' #hidden)) |