diff options
author | Eduardo Julian | 2021-09-10 01:21:23 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-09-10 01:21:23 -0400 |
commit | cd71a864ad5be13ed6ec6d046e0a2cb1087bdf94 (patch) | |
tree | af6366578f98f1a8e551f4da9f3ad230fd63a4dd /lux-bootstrapper/src/lux/analyser.clj | |
parent | ef77466323f85a3d1b65b46a3deb93652ef22085 (diff) |
Migrated variants to the new syntax.
Diffstat (limited to '')
-rw-r--r-- | lux-bootstrapper/src/lux/analyser.clj | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/lux-bootstrapper/src/lux/analyser.clj b/lux-bootstrapper/src/lux/analyser.clj index f837d8cee..ce571cae8 100644 --- a/lux-bootstrapper/src/lux/analyser.clj +++ b/lux-bootstrapper/src/lux/analyser.clj @@ -86,14 +86,28 @@ (|do [_ (&type/check exo-type &type/Text)] (return (&/|list (&&/|meta exo-type location (&&/$text ?value))))) - (&/$Tuple ?elems) - (&/with-analysis-meta location exo-type - (&&lux/analyse-record analyse exo-type ?elems)) - (&/$Tag ?ident) (&/with-analysis-meta location exo-type (analyse-variant+ analyse exo-type ?ident &/$End)) + (&/$Variant (&/$Item [command-meta command] parameters)) + (|case command + (&/$Nat idx) + (|let [(&/$Item [_ (&/$Bit ?right)] parameters*) parameters] + (&/with-analysis-meta location exo-type + (&&lux/analyse-variant analyse (&/$Right exo-type) (if ?right (inc idx) idx) ?right parameters*))) + + (&/$Tag ?ident) + (&/with-analysis-meta location exo-type + (analyse-variant+ analyse exo-type ?ident parameters)) + + _ + (&/fail-with-loc (str "[Analyser Error] Unknown syntax: " (&/show-ast (&/T [(&/T ["" -1 -1]) token]))))) + + (&/$Tuple ?elems) + (&/with-analysis-meta location exo-type + (&&lux/analyse-record analyse exo-type ?elems)) + (&/$Identifier ?ident) (&/with-analysis-meta location exo-type (&&lux/analyse-identifier analyse exo-type ?ident)) @@ -146,7 +160,7 @@ )) parameters] (&/with-location location (|case ?labels - [_ (&/$Form ?tags)] + [_ (&/$Variant ?tags)] (&&lux/analyse-def-type-tagged analyse optimize eval! compile-def ?name ?value false ?tags exported?) [_ (&/$Tuple ?slots)] @@ -176,15 +190,6 @@ :else (&&common/analyse-proc analyse exo-type ?procedure parameters)))) - - (&/$Nat idx) - (|let [(&/$Item [_ (&/$Bit ?right)] parameters*) parameters] - (&/with-analysis-meta location exo-type - (&&lux/analyse-variant analyse (&/$Right exo-type) (if ?right (inc idx) idx) ?right parameters*))) - - (&/$Tag ?ident) - (&/with-analysis-meta location exo-type - (analyse-variant+ analyse exo-type ?ident parameters)) ;; Pattern-matching syntax. (&/$Variant ?pattern-matching) |