diff options
Diffstat (limited to 'stdlib/source/lux.lux')
-rw-r--r-- | stdlib/source/lux.lux | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 6e08c9cea..7fa2ea692 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -5802,6 +5802,16 @@ (fail "Could not parse anything.") )) +(def: (parse-many tokens) + (-> (List Code) (Meta [(List Code) (List Code)])) + (case tokens + (^ (list& head tail)) + (return [tokens (list)]) + + _ + (fail "Could not parse anything.") + )) + (def: (parse-end tokens) (-> (List Code) (Meta Unit)) (case tokens @@ -5833,8 +5843,8 @@ #let [[[name args] tokens] name+args|tokens] anns|tokens (parse-anns tokens) #let [[anns tokens] anns|tokens] - input-template|tokens (parse-any tokens) - #let [[input-template tokens] input-template|tokens] + input-templates|tokens (parse-many tokens) + #let [[input-templates tokens] input-templates|tokens] _ (parse-end tokens) g!tokens (gensym "tokens") g!compiler (gensym "compiler") @@ -5848,8 +5858,10 @@ (case (~ g!tokens) (^ (list (~+ (list/map (|>> [""] symbol$) args)))) (#.Right [(~ g!compiler) - (list (` (~ (replace-syntax rep-env input-template))))]) - + (list (~+ (list/map (function [template] + (` (` (~ (replace-syntax rep-env template))))) + input-templates)))]) + (~ g!_) (#.Left (~ (text$ (text/compose "Wrong syntax for " name)))) ))))) |