aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lux/analyser.clj24
-rw-r--r--src/lux/compiler.clj2
-rw-r--r--src/lux/lexer.clj18
-rw-r--r--src/lux/parser.clj20
-rw-r--r--src/lux/util.clj3
5 files changed, 33 insertions, 34 deletions
diff --git a/src/lux/analyser.clj b/src/lux/analyser.clj
index 115a943c9..f70dab914 100644
--- a/src/lux/analyser.clj
+++ b/src/lux/analyser.clj
@@ -271,11 +271,11 @@
[<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-char ::&parser/char "java.lang.Character"
- analyse-string ::&parser/string "java.lang.String"
+ analyse-bool ::&parser/bool "java.lang.Boolean"
+ analyse-int ::&parser/int "java.lang.Integer"
+ analyse-real ::&parser/real "java.lang.Float"
+ analyse-char ::&parser/char "java.lang.Character"
+ analyse-text ::&parser/text "java.lang.String"
)
(defanalyser analyse-variant
@@ -410,7 +410,7 @@
;; (prn '->token x)
(let [variant (.newInstance (.loadClass loader "test2.Variant"))]
(match x
- [::&parser/string ?text]
+ [::&parser/text ?text]
(doto variant
(-> .-tag (set! "Text"))
(-> .-value (set! (doto (.newInstance (.loadClass loader "test2.Tuple1"))
@@ -450,7 +450,7 @@
(defn ->clojure-token [x]
;; (prn '->clojure-token x (.-tag x))
(case (.-tag x)
- "Text" [::&parser/string (-> x .-value .-_0 (doto (-> string? assert)))]
+ "Text" [::&parser/text (-> x .-value .-_0 (doto (-> string? assert)))]
"Ident" [::&parser/ident (-> x .-value .-_0 (doto (-> string? assert)))]
"Form" (let [[?fn & ?args] (-> x .-value .-_0 tokens->clojure)]
[::&parser/fn-call ?fn ?args])
@@ -584,7 +584,7 @@
[::&parser/variant ?tag ?members]
(mapcat get-vars ?members)
- [::&parser/string ?text]
+ [::&parser/text ?text]
'()))
->instructions (fn ->instructions [locals pattern]
(clojure.core.match/match pattern
@@ -594,7 +594,7 @@
[::&parser/ident ?name]
[::pm-local (get locals ?name)]
- [::&parser/string ?text]
+ [::&parser/text ?text]
[::pm-text ?text]
))]
(defn ->decision-tree [$scope $base branches]
@@ -779,11 +779,11 @@
(return (annotated [::quote ?quoted] ::&type/nothing)))
(def analyse-form
- (try-all-m [analyse-boolean
+ (try-all-m [analyse-bool
analyse-int
- analyse-float
+ analyse-real
analyse-char
- analyse-string
+ analyse-text
analyse-variant
analyse-tuple
analyse-lambda
diff --git a/src/lux/compiler.clj b/src/lux/compiler.clj
index d4d7431a2..84b3bc18c 100644
--- a/src/lux/compiler.clj
+++ b/src/lux/compiler.clj
@@ -837,7 +837,7 @@
(defn quoted->token [quoted]
;; (prn 'quoted->token quoted)
(match quoted
- [::&parser/string ?text]
+ [::&parser/text ?text]
{:form [::&analyser/variant "Text" (list {:form [::&analyser/literal ?text]
:type [::&type/object "java.lang.String" []]})]
:type [::&type/variant "Text" (list [::&type/object "java.lang.String" []])]}
diff --git a/src/lux/lexer.clj b/src/lux/lexer.clj
index a302e89ba..e058bf75f 100644
--- a/src/lux/lexer.clj
+++ b/src/lux/lexer.clj
@@ -59,10 +59,10 @@
(exec [token (lex-regex <regex>)]
(return [<tag> token])))
- ^:private lex-boolean ::boolean #"^(true|false)"
- ^:private lex-float ::float #"^(0|[1-9][0-9]*)\.[0-9]+"
- ^:private lex-int ::int #"^(0|[1-9][0-9]*)"
- ^:private lex-ident ::ident +ident-re+)
+ ^:private lex-bool ::bool #"^(true|false)"
+ ^:private lex-real ::real #"^(0|[1-9][0-9]*)\.[0-9]+"
+ ^:private lex-int ::int #"^(0|[1-9][0-9]*)"
+ ^:private lex-ident ::ident +ident-re+)
(def ^:private lex-char
(exec [_ (lex-str "#\"")
@@ -72,7 +72,7 @@
_ (lex-str "\"")]
(return [::char token])))
-(def ^:private lex-string
+(def ^:private lex-text
(exec [_ (lex-str "\"")
;; state &util/get-state
;; :let [_ (prn 'PRE state)]
@@ -81,7 +81,7 @@
;; state &util/get-state
;; :let [_ (prn 'POST state)]
]
- (return [::string token])))
+ (return [::text token])))
(def ^:private lex-single-line-comment
(exec [_ (lex-str "##")
@@ -118,11 +118,11 @@
(def ^:private lex-form
(exec [_ (try-m lex-white-space)
- form (try-all-m [lex-boolean
- lex-float
+ form (try-all-m [lex-bool
+ lex-real
lex-int
lex-char
- lex-string
+ lex-text
lex-ident
lex-tag
lex-list
diff --git a/src/lux/parser.clj b/src/lux/parser.clj
index 8d3cfb0dd..3079e22a7 100644
--- a/src/lux/parser.clj
+++ b/src/lux/parser.clj
@@ -26,9 +26,9 @@
(return [<output-tag> (<method> ?value)]))
- ^:private parse-boolean ::&lexer/boolean ::boolean Boolean/parseBoolean
- ^:private parse-int ::&lexer/int ::int Integer/parseInt
- ^:private parse-float ::&lexer/float ::float Float/parseFloat
+ ^:private parse-bool ::&lexer/bool ::bool Boolean/parseBoolean
+ ^:private parse-int ::&lexer/int ::int Integer/parseInt
+ ^:private parse-real ::&lexer/real ::real Float/parseFloat
)
(defparser ^:private parse-char
@@ -124,7 +124,7 @@
(return [::import ?class]))
(defparser ^:private parse-require
- [::&lexer/list ([[::&lexer/ident "require"] [::&lexer/string ?file] [::&lexer/ident "as"] [::&lexer/ident ?alias]] :seq)]
+ [::&lexer/list ([[::&lexer/ident "require"] [::&lexer/text ?file] [::&lexer/ident "as"] [::&lexer/ident ?alias]] :seq)]
(return [::require ?file ?alias]))
(defparser ^:private parse-defclass
@@ -179,9 +179,9 @@
=call (apply-m parse-form (list ?call))]
(return [::access =object =call])))
-(defparser ^:private parse-string
- [::&lexer/string ?string]
- (return [::string ?string]))
+(defparser ^:private parse-text
+ [::&lexer/text ?text]
+ (return [::text ?text]))
(defparser ^:private parse-fn-call
[::&lexer/list ([?f & ?args] :seq)]
@@ -191,11 +191,11 @@
(return [::fn-call =f =args])))
(def ^:private parse-form
- (try-all-m [parse-boolean
+ (try-all-m [parse-bool
parse-int
- parse-float
+ parse-real
parse-char
- parse-string
+ parse-text
parse-ident
parse-tuple
parse-record
diff --git a/src/lux/util.clj b/src/lux/util.clj
index 5c792c2f3..83fdc16aa 100644
--- a/src/lux/util.clj
+++ b/src/lux/util.clj
@@ -164,5 +164,4 @@
(defn normalize-ident [ident]
(reduce str "" (map normalize-char ident)))
-(defonce loader (doto (-> (java.io.File. "./") .toURL vector into-array java.net.URLClassLoader.)
- (->> (prn 'loader))))
+(defonce loader (-> (java.io.File. "./") .toURL vector into-array java.net.URLClassLoader.))