mirror of
https://github.com/janet-lang/janet
synced 2024-12-27 17:00:27 +00:00
Allow source location in run-context to be updated
This commit is contained in:
parent
a5f237993d
commit
855a9a01fc
@ -2098,7 +2098,7 @@
|
||||
:on-parse-error on-parse-error
|
||||
:fiber-flags guard
|
||||
:evaluator evaluator
|
||||
:source where
|
||||
:source default-where
|
||||
:parser parser
|
||||
:read read
|
||||
:expander expand} opts)
|
||||
@ -2108,9 +2108,11 @@
|
||||
(default on-compile-error bad-compile)
|
||||
(default on-parse-error bad-parse)
|
||||
(default evaluator (fn evaluate [x &] (x)))
|
||||
(default where "<anonymous>")
|
||||
(default default-where "<anonymous>")
|
||||
(default guard :ydt)
|
||||
|
||||
(var where default-where)
|
||||
|
||||
# Evaluate 1 source form in a protected manner
|
||||
(defn eval1 [source &opt l c]
|
||||
(def source (if expand (expand source) source))
|
||||
@ -2163,11 +2165,16 @@
|
||||
(while parser-not-done
|
||||
(if (env :exit) (break))
|
||||
(buffer/clear buf)
|
||||
(if (= (chunks buf p) :cancel)
|
||||
(match (= (chunks buf p))
|
||||
:cancel
|
||||
(do
|
||||
# A :cancel chunk represents a cancelled form in the REPL, so reset.
|
||||
(:flush p)
|
||||
(buffer/clear buf))
|
||||
|
||||
[:source new-where]
|
||||
(set where new-where)
|
||||
|
||||
(do
|
||||
(var pindex 0)
|
||||
(var pstatus nil)
|
||||
|
Loading…
Reference in New Issue
Block a user