From 7b870a7bd124f35939d9089a2e21f0806a4c6e85 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 29 Oct 2017 22:21:14 -0400 Subject: - Fixed some bugs. - Improved error reporting. - Implemented macro-expansion (for JVM). - Implemented "let" compilation. --- new-luxc/source/luxc/synthesizer/case.lux | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'new-luxc/source/luxc/synthesizer/case.lux') diff --git a/new-luxc/source/luxc/synthesizer/case.lux b/new-luxc/source/luxc/synthesizer/case.lux index 8221b4f8d..02b1bfba5 100644 --- a/new-luxc/source/luxc/synthesizer/case.lux +++ b/new-luxc/source/luxc/synthesizer/case.lux @@ -49,17 +49,17 @@ (#ls;VariantP (if last? (#;Right tag) (#;Left tag)) (path memberP))))) -(def: #export (weave nextP prevP) +(def: #export (weave leftP rightP) (-> ls;Path ls;Path ls;Path) - (with-expansions [ (as-is (#ls;AltP prevP nextP))] - (case [nextP prevP] + (with-expansions [ (as-is (#ls;AltP leftP rightP))] + (case [leftP rightP] [#ls;UnitP #ls;UnitP] #ls;UnitP (^template [ ] - [( next) ( prev)] - (if ( next prev) - prevP + [( left) ( right)] + (if ( left right) + leftP )) ([#ls;BindP n.=] [#ls;BoolP B/=] @@ -70,22 +70,22 @@ [#ls;TextP T/=]) (^template [ ] - [( ( next-idx) next-then) ( ( prev-idx) prev-then)] - (if (n.= next-idx prev-idx) - (weave next-then prev-then) + [( ( left-idx) left-then) ( ( right-idx) right-then)] + (if (n.= left-idx right-idx) + (weave left-then right-then) )) ([#ls;TupleP #;Left] [#ls;TupleP #;Right] [#ls;VariantP #;Left] [#ls;VariantP #;Right]) - [(#ls;SeqP next-pre next-post) (#ls;SeqP prev-pre prev-post)] - (case (weave next-pre prev-pre) + [(#ls;SeqP left-pre left-post) (#ls;SeqP right-pre right-post)] + (case (weave left-pre right-pre) (#ls;AltP _ _) weavedP - (#ls;SeqP weavedP (weave next-post prev-post))) + (#ls;SeqP weavedP (weave left-post right-post))) _ ))) -- cgit v1.2.3