diff options
author | Eduardo Julian | 2017-10-31 22:26:13 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-31 22:26:13 -0400 |
commit | 19c589edc2c1dd77550e26d4f5cf78ec772da337 (patch) | |
tree | d070c773c7bd5cec8d33caa1841fbe0e342ec563 /new-luxc/source/luxc/synthesizer/case.lux | |
parent | 6c753288a89eadb3f7d70a8844e466c48c809051 (diff) |
- Migrated the format of analysis nodes from a custom data-type, to just Code nodes.
Diffstat (limited to 'new-luxc/source/luxc/synthesizer/case.lux')
-rw-r--r-- | new-luxc/source/luxc/synthesizer/case.lux | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/new-luxc/source/luxc/synthesizer/case.lux b/new-luxc/source/luxc/synthesizer/case.lux index 91f339bdf..15cb6eca3 100644 --- a/new-luxc/source/luxc/synthesizer/case.lux +++ b/new-luxc/source/luxc/synthesizer/case.lux @@ -6,26 +6,12 @@ (coll [list "list/" Fold<List>])) (meta [code "code/" Eq<Code>])) (luxc (lang ["la" analysis] - ["ls" synthesis]) - (synthesizer ["&;" function]))) + ["ls" synthesis]))) (def: #export (path pattern) (-> la;Pattern ls;Path) (case pattern - (#la;BindP register) - (` ("lux case bind" (~ (code;nat register)))) - - (^template [<from> <to>] - (<from> value) - (<to> value)) - ([#la;BoolP code;bool] - [#la;NatP code;nat] - [#la;IntP code;int] - [#la;DegP code;deg] - [#la;FracP code;frac] - [#la;TextP code;text]) - - (#la;TupleP membersP) + (^code [(~@ membersP)]) (case (list;reverse membersP) #;Nil (' ("lux case pop")) @@ -45,11 +31,14 @@ (` ("lux case tuple right" (~ (code;nat last-idx)) (~ (path lastP))))] prevsP)] tuple-path)) - - (#la;VariantP tag num-tags memberP) + + (^code ((~ [_ (#;Nat tag)]) (~ [_ (#;Nat num-tags)]) (~ memberP))) (if (n.= (n.dec num-tags) tag) (` ("lux case variant right" (~ (code;nat tag)) (~ (path memberP)))) - (` ("lux case variant left" (~ (code;nat tag)) (~ (path memberP))))))) + (` ("lux case variant left" (~ (code;nat tag)) (~ (path memberP))))) + + _ + pattern)) (def: #export (weave leftP rightP) (-> ls;Path ls;Path ls;Path) |