aboutsummaryrefslogtreecommitdiff
path: root/src/lang/analyser.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/lang/analyser.clj')
-rw-r--r--src/lang/analyser.clj16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lang/analyser.clj b/src/lang/analyser.clj
index 8572cfa53..9251b9523 100644
--- a/src/lang/analyser.clj
+++ b/src/lang/analyser.clj
@@ -1,6 +1,7 @@
(ns lang.analyser
(:refer-clojure :exclude [resolve])
- (:require [clojure.string :as string]
+ (:require (clojure [string :as string]
+ [template :refer [do-template]])
[clojure.core.match :refer [match]]
(lang [util :as &util :refer [exec return* return fail fail*
repeat-m try-m try-all-m map-m
@@ -106,6 +107,17 @@
_
=return))))
+(do-template [<name> <tag> <class>]
+ (defanalyser <name>
+ [<tag> ?value]
+ (return (annotated [::literal ?value] [::&type/object <class> []])))
+
+ analyse-boolean ::&parser/boolean "java.lang.Boolean"
+ analyse-int ::&parser/int "java.lang.Integer"
+ analyse-float ::&parser/float "java.lang.Float"
+ analyse-string ::&parser/string "java.lang.String"
+ )
+
(defanalyser analyse-boolean
[::&parser/boolean ?boolean]
(return (annotated [::literal ?boolean] [::&type/object "java.lang.Boolean" []])))
@@ -270,6 +282,8 @@
(def ^:private analyse-form
(try-all-m [analyse-boolean
+ analyse-int
+ analyse-float
analyse-string
analyse-variant
analyse-tuple