1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-16 23:37:15 +00:00

Merge branch 'master' into ev

This commit is contained in:
Calvin Rose
2020-07-19 17:20:43 -05:00
8 changed files with 41 additions and 30 deletions

View File

@@ -383,13 +383,17 @@
[i start stop step comparison delta body]
(with-syms [s]
(def st (if (idempotent? step) step (gensym)))
(def loop-body
~(while (,comparison ,i ,s)
,;body
(set ,i (,delta ,i ,st))))
~(do
(var ,i ,start)
(def ,s ,stop)
,;(if (= st step) [] [~(def ,st ,step)])
(while (,comparison ,i ,s)
,;body
(set ,i (,delta ,i ,st))))))
,(if (and (number? st) (> st 0))
loop-body
~(if (,> ,st 0) ,loop-body)))))
(defn- for-template
[binding start stop step comparison delta body]
@@ -517,7 +521,7 @@
~(do (var ,iter ,n) (while (> ,iter 0) ,;body (-- ,iter)))))
(defmacro forever
"Evaluate body repeatedly forever, or until a break statement at the top level."
"Evaluate body forever in a loop, or until a break statement."
[& body]
~(while true ,;body))
@@ -2178,12 +2182,12 @@
(buffer/push-string buf "\n")))
(var returnval nil)
(run-context {:chunks chunks
:on-compile-error (fn [msg errf &]
:on-compile-error (fn compile-error [msg errf &]
(error (string "compile error: " msg)))
:on-parse-error (fn [p x]
:on-parse-error (fn parse-error [p x]
(error (string "parse error: " (parser/error p))))
:fiber-flags :i
:on-status (fn [f val]
:on-status (fn on-status [f val]
(if-not (= (fiber/status f) :dead)
(error val))
(set returnval val))
@@ -2763,7 +2767,7 @@
-m syspath : Set system path for loading global modules
-c source output : Compile janet source code into an image
-n : Disable ANSI color output in the repl
-l path : Execute code in a file before running the main script
-l lib : Import a module before processing more arguments
-- : Stop handling options`)
(os/exit 0)
1)
@@ -2775,17 +2779,17 @@
"k" (fn [&] (set *compile-only* true) (set *exit-on-error* false) 1)
"n" (fn [&] (set *colorize* false) 1)
"m" (fn [i &] (setdyn :syspath (in args (+ i 1))) 2)
"c" (fn [i &]
"c" (fn c-switch [i &]
(def e (dofile (in args (+ i 1))))
(spit (in args (+ i 2)) (make-image e))
(set *no-file* false)
3)
"-" (fn [&] (set *handleopts* false) 1)
"l" (fn [i &]
"l" (fn l-switch [i &]
(import* (in args (+ i 1))
:prefix "" :exit *exit-on-error*)
2)
"e" (fn [i &]
"e" (fn e-switch [i &]
(set *no-file* false)
(eval-string (in args (+ i 1)))
2)

View File

@@ -27,10 +27,10 @@
#define JANETCONF_H
#define JANET_VERSION_MAJOR 1
#define JANET_VERSION_MINOR 10
#define JANET_VERSION_PATCH 2
#define JANET_VERSION_EXTRA "-dev"
#define JANET_VERSION "1.10.2-dev"
#define JANET_VERSION_MINOR 11
#define JANET_VERSION_PATCH 0
#define JANET_VERSION_EXTRA ""
#define JANET_VERSION "1.11.0"
/* #define JANET_BUILD "local" */