1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-27 17:00:27 +00:00

Merge branch 'master' of github.com:janet-lang/janet

This commit is contained in:
Calvin Rose 2021-05-19 18:43:50 -05:00
commit 81186bf262

View File

@ -2919,6 +2919,13 @@
(if d (doc-format d) " no documentation found.") (if d (doc-format d) " no documentation found.")
"\n\n")) "\n\n"))
(defn- print-special-form-entry
[x]
(print "\n\n"
(string " special form\n\n")
(string " (" x " ...)\n\n")
(string " See https://janet-lang.org/docs/specials.html\n\n")))
(defn doc* (defn doc*
"Get the documentation for a symbol in a given environment. Function form of doc." "Get the documentation for a symbol in a given environment. Function form of doc."
[&opt sym] [&opt sym]
@ -2931,6 +2938,9 @@
(do (do
(def x (dyn sym)) (def x (dyn sym))
(if (not x) (if (not x)
(if (index-of sym '[break def do fn if quasiquote quote
set splice unquote upscope var while])
(print-special-form-entry sym)
(do (do
(def [fullpath mod-kind] (module/find (string sym))) (def [fullpath mod-kind] (module/find (string sym)))
(if-let [mod-env (in module/cache fullpath)] (if-let [mod-env (in module/cache fullpath)]
@ -2938,7 +2948,7 @@
:kind mod-kind :kind mod-kind
:source-map [fullpath nil nil] :source-map [fullpath nil nil]
:doc (in mod-env :doc)}) :doc (in mod-env :doc)})
(print "symbol " sym " not found."))) (print "symbol " sym " not found."))))
(print-module-entry x))) (print-module-entry x)))
# else # else