diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-04-18 16:10:20 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-04-18 16:10:23 +0000 |
| commit | 2403b5b0083cfe4210ff0adbc80e36bf40a8dbf0 (patch) | |
| tree | 7f69f0ed0ba673a9fac3bf635bec72099f14ae89 /alv/copilot.moon | |
| parent | merge dist/pack and dist/release (diff) | |
| download | alive-2403b5b0083cfe4210ff0adbc80e36bf40a8dbf0.tar.gz alive-2403b5b0083cfe4210ff0adbc80e36bf40a8dbf0.zip | |
output to different streams at eval/runtime
Close #13
Diffstat (limited to 'alv/copilot.moon')
| -rw-r--r-- | alv/copilot.moon | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/alv/copilot.moon b/alv/copilot.moon index 478cbae..a1dc811 100644 --- a/alv/copilot.moon +++ b/alv/copilot.moon @@ -48,21 +48,21 @@ class Copilot @root\tick_io! @root\tick! if not ok - print error + L\print error @registry\end_tick! eval: => @registry\begin_eval! ok, ast = Error.try "parsing '#{@file}'", program\match, slurp @file if not (ok and ast) - print ast or Error 'syntax', "failed to parse" + L\print ast or Error 'syntax', "failed to parse" @registry\rollback_eval! return scope = Scope globals ok, root = Error.try "evaluating '#{@file}'", ast\eval, scope, @registry if not ok - print root + L\print root @registry\rollback_eval! return @@ -76,8 +76,10 @@ class Copilot return if @last_modification < modification + L.stream = io.stderr L\log "#{@file} changed at #{modification}" @eval! + L.stream = io.stdout @last_modification = os.time! { |
