mirror of
https://github.com/janet-lang/janet
synced 2024-11-25 01:37:19 +00:00
Merge pull request #642 from pyrmont/feature.run-context-location
Allow source location in run-context to be updated
This commit is contained in:
commit
b795d13f61
@ -2104,7 +2104,7 @@
|
|||||||
:on-parse-error on-parse-error
|
:on-parse-error on-parse-error
|
||||||
:fiber-flags guard
|
:fiber-flags guard
|
||||||
:evaluator evaluator
|
:evaluator evaluator
|
||||||
:source where
|
:source default-where
|
||||||
:parser parser
|
:parser parser
|
||||||
:read read
|
:read read
|
||||||
:expander expand} opts)
|
:expander expand} opts)
|
||||||
@ -2114,9 +2114,11 @@
|
|||||||
(default on-compile-error bad-compile)
|
(default on-compile-error bad-compile)
|
||||||
(default on-parse-error bad-parse)
|
(default on-parse-error bad-parse)
|
||||||
(default evaluator (fn evaluate [x &] (x)))
|
(default evaluator (fn evaluate [x &] (x)))
|
||||||
(default where "<anonymous>")
|
(default default-where "<anonymous>")
|
||||||
(default guard :ydt)
|
(default guard :ydt)
|
||||||
|
|
||||||
|
(var where default-where)
|
||||||
|
|
||||||
# Evaluate 1 source form in a protected manner
|
# Evaluate 1 source form in a protected manner
|
||||||
(defn eval1 [source &opt l c]
|
(defn eval1 [source &opt l c]
|
||||||
(def source (if expand (expand source) source))
|
(def source (if expand (expand source) source))
|
||||||
@ -2169,11 +2171,18 @@
|
|||||||
(while parser-not-done
|
(while parser-not-done
|
||||||
(if (env :exit) (break))
|
(if (env :exit) (break))
|
||||||
(buffer/clear buf)
|
(buffer/clear buf)
|
||||||
(if (= (chunks buf p) :cancel)
|
(match (= (chunks buf p))
|
||||||
|
:cancel
|
||||||
(do
|
(do
|
||||||
# A :cancel chunk represents a cancelled form in the REPL, so reset.
|
# A :cancel chunk represents a cancelled form in the REPL, so reset.
|
||||||
(:flush p)
|
(:flush p)
|
||||||
(buffer/clear buf))
|
(buffer/clear buf))
|
||||||
|
|
||||||
|
[:source new-where]
|
||||||
|
(if (string? new-where)
|
||||||
|
(set where new-where)
|
||||||
|
(set where default-where))
|
||||||
|
|
||||||
(do
|
(do
|
||||||
(var pindex 0)
|
(var pindex 0)
|
||||||
(var pstatus nil)
|
(var pstatus nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user