Skip to content

Commit

Permalink
upgrade deps; more string syntax; bump 0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Mar 3, 2018
1 parent d9deb1c commit ddeb9d7
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

coir.edn -diff linguist-generated
calcit.edn -diff linguist-generated
yarn.lock -diff
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

/target
/node_modules
.shadow-cljs/
.cpcache/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Cirru Sepal for Clojure
### API Usage [![Clojars Project](https://img.shields.io/clojars/v/cirru/sepal.svg)](https://clojars.org/cirru/sepal)

```edn
[cirru/sepal "0.2.2"]
[cirru/sepal "0.2.3"]
```

```clojure
Expand Down
2 changes: 1 addition & 1 deletion build.boot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:username "jiyinyiyong"
:password (read-password "Clojars password: ")}]))

(def +version+ "0.2.2")
(def +version+ "0.2.3")

(deftask deploy []
(comp
Expand Down
6 changes: 5 additions & 1 deletion coir.edn → calcit.edn

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions data/compiled/string.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

(println "x")

(println "x")
3 changes: 3 additions & 0 deletions data/examples/string.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

[["println" "\"x"]
["println" "|x"]]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"test": "yarn compile && node target/test.js"
},
"devDependencies": {
"shadow-cljs": "^2.0.126"
"shadow-cljs": "^2.2.3"
}
}
4 changes: 3 additions & 1 deletion polyfill/cirru_sepal/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,13 @@
(cond
(= x "true") true
(= x "false") false
(= x "nil") nil
(= (first x) \:) (keyword (subs x 1))
(= (first x) \|) (subs x 1)
(= (first x) \") (subs x 1)
(= (first x) \') `(quote ~(symbol (subs x 1)))
(re-matches #"-?\d+(\.\d+)?" x) (read-string x)
(= (first x) \\) (read-string x)
(re-matches #"-?\d+(\.\d+)?" x) (read-string x)
:else (symbol x))
(vector? x)
(do
Expand Down
7 changes: 7 additions & 0 deletions polyfill/cirru_sepal/tree_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@
(read-result "doseq.cljs")
(run-make-code "doseq.edn")))))

(deftest string-test
(testing "test string syntax"
(is
(=
(read-result "string.cljs")
(run-make-code "string.edn")))))

(def example-file "
(ns a.b )
Expand Down
26 changes: 13 additions & 13 deletions src/cirru_sepal/analyze.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
(ns cirru-sepal.analyze
(:require [clojure.string :as string] [cirru-sepal.core :refer [write-code]]))

(def def-names #{"def" "defonce"})

(defn depends-on? [x y dict level]
(if (contains? dict x)
(let [deps (:tokens (get dict x))]
Expand All @@ -12,8 +14,6 @@
(some (fn [child] (depends-on? child y dict (inc level))) deps))))
false))

(def def-names #{"def" "defonce"})

(defn deps-insert [acc new-item items deps-info]
(if (empty? items)
(conj acc new-item)
Expand All @@ -26,18 +26,23 @@
(into [] (concat acc [new-item] items)))
(recur (conj acc cursor) new-item (rest items) deps-info)))))

(def files-cache-ref (atom {}))

(defn strip-property [x] (if (string/includes? x ".") (first (string/split x ".")) x))

(defn strip-atom [token] (if (string/starts-with? token "@") (subs token 1) token))

(defn deps-sort [acc items deps-info]
(if (empty? items)
acc
(let [cursor (first items), next-acc (deps-insert [] cursor acc deps-info)]
(recur next-acc (into [] (rest items)) deps-info))))

(def files-cache-ref (atom {}))

(defn ns->path [pkg ns-part]
(-> (str pkg "." ns-part)
(string/replace (re-pattern "\\.") "/")
(string/replace (re-pattern "-") "_")))

(defn strip-atom [token] (if (string/starts-with? token "@") (subs token 1) token))

(defn strip-property [x] (if (string/includes? x ".") (first (string/split x ".")) x))

(defn write-file [file-info]
(let [ns-line (:ns file-info)
definitions (:defs file-info)
Expand Down Expand Up @@ -73,8 +78,3 @@
(comment println "after sort:" sorted-names)
(comment println "generated file:" code)
code))

(defn ns->path [pkg ns-part]
(-> (str pkg "." ns-part)
(string/replace (re-pattern "\\.") "/")
(string/replace (re-pattern "-") "_")))
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1102,20 +1102,20 @@ sha.js@^2.4.0, sha.js@^2.4.8:
inherits "^2.0.1"
safe-buffer "^5.0.1"

shadow-cljs-jar@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/shadow-cljs-jar/-/shadow-cljs-jar-1.1.1.tgz#5d74383f5aff8fba25a5d00ee3c3ad035a1bd7a3"
shadow-cljs-jar@1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/shadow-cljs-jar/-/shadow-cljs-jar-1.1.2.tgz#88664fae5957a7c21554e1a33476f1c475162c92"

shadow-cljs@^2.0.125:
version "2.0.126"
resolved "https://registry.yarnpkg.com/shadow-cljs/-/shadow-cljs-2.0.126.tgz#9e6adfcbe923c5889b1dcb0f6a650b563f140373"
shadow-cljs@^2.2.3:
version "2.2.3"
resolved "https://registry.yarnpkg.com/shadow-cljs/-/shadow-cljs-2.2.3.tgz#e91c34b2eea037a136590aabcbd316301d6c0cab"
dependencies:
babel-core "^6.26.0"
babel-preset-env "^1.6.0"
mkdirp "^0.5.1"
node-libs-browser "^2.0.0"
readline-sync "^1.4.7"
shadow-cljs-jar "1.1.1"
shadow-cljs-jar "1.1.2"
signal-exit "^3.0.2"
source-map-support "^0.4.15"
ws "^3.0.0"
Expand Down

0 comments on commit ddeb9d7

Please sign in to comment.