Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
174 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
(ns closh.zero.platform.clojure-platform | ||
(:refer-clojure :exclude [eval read load-reader read+string]) | ||
(:require [closh.zero.reader :as reader] | ||
[closh.zero.parser] | ||
[closh.zero.compiler] | ||
[closh.zero.platform.eval :as eval] | ||
[closh.zero.platform.clojure-compiler :as compiler]) | ||
(:import (clojure.lang LineNumberingPushbackReader))) | ||
|
||
(def read reader/read) | ||
|
||
(defn eval [form] | ||
(eval/eval | ||
(closh.zero.compiler/compile-interactive | ||
(closh.zero.parser/parse form)))) | ||
|
||
;; Copied from clojure/core | ||
(defn read+string | ||
"Like read, and taking the same args. stream must be a LineNumberingPushbackReader. | ||
Returns a vector containing the object read and the (whitespace-trimmed) string read." | ||
{:added "1.10"} | ||
([] (read+string *in*)) | ||
([stream] (read+string stream true nil)) | ||
([stream eof-error? eof-value] (read+string stream eof-error? eof-value false)) | ||
([^clojure.lang.LineNumberingPushbackReader stream eof-error? eof-value recursive?] | ||
(try | ||
(.captureString stream) | ||
(let [o (read stream eof-error? eof-value recursive?) | ||
s (.trim (.getString stream))] | ||
[o s]) | ||
(catch Throwable ex | ||
(.getString stream) | ||
(throw ex)))) | ||
([opts ^clojure.lang.LineNumberingPushbackReader stream] | ||
(try | ||
(.captureString stream) | ||
(let [o (read opts stream) | ||
s (.trim (.getString stream))] | ||
[o s]) | ||
(catch Throwable ex | ||
(.getString stream) | ||
(throw ex))))) | ||
|
||
(defn load-reader [rdr] | ||
(compiler/load rdr eval)) | ||
|
||
(defn compiler-load-file [path] | ||
(compiler/load-file path eval)) | ||
|
||
;; TODO: Does it make sense to reimplement this? | ||
(defn rt-load-resource-script [path] | ||
(binding [*out* *err*] | ||
(println "rt-load-resource-script not implemented:" path)) | ||
(System/exit 1)) |
Oops, something went wrong.
90e40cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dundalek Wow, I missed this merge. Means the Sci integration works? Shouldn't this be celebrated?
90e40cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jeroenvandijk, I thought I was done but then I noticed there are still things that do not work :/
The main ones are: