mirror of
https://github.com/janet-lang/janet
synced 2025-10-29 14:47:42 +00:00
Add docs target to generate documentation.
This commit is contained in:
@@ -1074,8 +1074,18 @@ value, one key will be ignored."
|
||||
(if (not x)
|
||||
(print "symbol " sym " not found.")
|
||||
(do
|
||||
(def bind-type
|
||||
(string " "
|
||||
(cond
|
||||
x:ref (string :var " (" (type (get x:ref 0)) ")")
|
||||
x:macro :macro
|
||||
(type x:value))
|
||||
"\n"))
|
||||
(def d x:doc)
|
||||
(print "\n\n" (if d (doc-format d) "no documentation found.") "\n\n"))))
|
||||
(print "\n\n"
|
||||
(if d bind-type "")
|
||||
(if d (doc-format d) "no documentation found.")
|
||||
"\n\n"))))
|
||||
|
||||
(defmacro doc
|
||||
"Shows documentation for the given symbol."
|
||||
@@ -1176,15 +1186,15 @@ value, one key will be ignored."
|
||||
ret)
|
||||
|
||||
(defn all
|
||||
[pred xs]
|
||||
"Returns true if all xs are truthy, otherwise the first false or nil value."
|
||||
[pred xs]
|
||||
(var ret true)
|
||||
(loop [x :in xs :while ret] (set ret (pred x)))
|
||||
ret)
|
||||
|
||||
(defn some
|
||||
[pred xs]
|
||||
"Returns false if all xs are false or nil, otherwise returns the first true value."
|
||||
[pred xs]
|
||||
(var ret nil)
|
||||
(loop [x :in xs :while (not ret)] (if-let [y (pred x)] (set ret y)))
|
||||
ret)
|
||||
|
||||
@@ -47,7 +47,7 @@ struct IOFile {
|
||||
static int janet_io_gc(void *p, size_t len);
|
||||
|
||||
JanetAbstractType janet_io_filetype = {
|
||||
":core.file",
|
||||
":core/file",
|
||||
janet_io_gc,
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -609,7 +609,7 @@ static int parsergc(void *p, size_t size) {
|
||||
}
|
||||
|
||||
static JanetAbstractType janet_parse_parsertype = {
|
||||
":core.parser",
|
||||
":core/parser",
|
||||
parsergc,
|
||||
parsermark
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user