diff options
author | Eduardo Julian | 2018-02-07 00:38:12 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-02-07 00:38:12 -0400 |
commit | b68383450864306db8eeee4559d9bafe6dab5806 (patch) | |
tree | a8d195edf6a57cf7e3a2cf506fd09b074b967ef7 /stdlib/source/lux.lux | |
parent | 844a44f87bd03fc9c65e18149c6dd2ccf8e9cb32 (diff) |
- Small additions.
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)))) ))))) |