1
0
mirror of https://github.com/janet-lang/janet synced 2025-02-23 11:40:01 +00:00

Update gendoc and fix issue with run-context.

This commit is contained in:
Calvin Rose 2018-12-16 13:17:30 -05:00
parent e286e82144
commit 8333c22e8a
2 changed files with 18 additions and 15 deletions

View File

@ -55,8 +55,9 @@
(string "<h2>" (html-escape key) "</h2>\n" (string "<h2>" (html-escape key) "</h2>\n"
"<p>" (html-escape docstring) "</p>\n"))) "<p>" (html-escape docstring) "</p>\n")))
(def parts (seq [[k {:doc d :private p}] :in (sort (pairs (table/getproto _env))) # Generate parts and print them to stdout
(def parts (seq [[k {:doc d :private p}]
:in (sort (pairs (table/getproto _env)))
:when (and d (not p))] :when (and d (not p))]
(gen-one k d))) (gen-one k d)))
(print prelude ;parts postlude) (print prelude ;parts postlude)

View File

@ -520,7 +520,7 @@
(if (order v ret) (:= ret v))) (if (order v ret) (:= ret v)))
ret)) ret))
(defn max (defn max
"Returns the numeric maximum of the arguments." "Returns the numeric maximum of the arguments."
[& args] (extreme > args)) [& args] (extreme > args))
@ -528,7 +528,7 @@
"Returns the numeric minimum of the arguments." "Returns the numeric minimum of the arguments."
[& args] (extreme < args)) [& args] (extreme < args))
(defn max-order (defn max-order
"Returns the maximum of the arguments according to a total "Returns the maximum of the arguments according to a total
order over all values." order over all values."
[& args] (extreme order> args)) [& args] (extreme order> args))
@ -1181,7 +1181,7 @@ value, one key will be ignored."
x)) x))
ret) ret)
(defn all (defn all
[pred xs] [pred xs]
"Returns true if all xs are truthy, otherwise the first false or nil value." "Returns true if all xs are truthy, otherwise the first false or nil value."
(var ret true) (var ret true)
@ -1297,20 +1297,19 @@ value, one key will be ignored."
(buffer/clear buf) (buffer/clear buf)
(chunks buf p) (chunks buf p)
(var pindex 0) (var pindex 0)
(var pstatus nil)
(def len (length buf)) (def len (length buf))
(if (= len 0) (:= going false)) (if (= len 0) (:= going false))
(while (> len pindex) (while (> len pindex)
(+= pindex (parser/consume p buf pindex)) (+= pindex (parser/consume p buf pindex))
(case (parser/status p) (while (= (:= pstatus (parser/status p)) :full)
:full (eval1 (parser/produce p)) (eval1 (parser/produce p)))
:error (do (when (= pstatus :error)
(def (line col) (parser/where p)) (onstatus :parse
(onstatus :parse (string (parser/error p)
(string (parser/error p) " around byte " (parser/where p))
" on line " line nil
", column " col) where))))
nil
where)))))
(:= *env* oldenv) (:= *env* oldenv)
@ -1495,6 +1494,9 @@ value, one key will be ignored."
newenv))))) newenv)))))
(defn import* (defn import*
"Import a module into a given environment table. This is the
functional form of (import ...) that expects and explicit environment
table."
[env path & args] [env path & args]
(def targs (table ;args)) (def targs (table ;args))
(def {:as as (def {:as as