From fd40c31cd91d061fac317d299472ab59be842792 Mon Sep 17 00:00:00 2001 From: XeroOl Date: Wed, 15 May 2024 23:01:05 -0500 Subject: [PATCH] io.stdin, io.stdout, io.stderr added to docs (there's no section for these in the manual) --- make-docs.fnl | 11 ++++++++++- src/fennel-ls/docs/lua51.fnl | 9 +++++++++ src/fennel-ls/docs/lua52.fnl | 9 +++++++++ src/fennel-ls/docs/lua53.fnl | 9 +++++++++ src/fennel-ls/docs/lua54.fnl | 9 +++++++++ 5 files changed, 46 insertions(+), 1 deletion(-) diff --git a/make-docs.fnl b/make-docs.fnl index dfefc8e..0a67a95 100644 --- a/make-docs.fnl +++ b/make-docs.fnl @@ -29,9 +29,12 @@ (table.insert fields section))) (when header (loop header)))) + + (fn make-title [name] + (.. "

" name "

\n")) ;; Artificially insert the `arg` docs. ;; This isn't present in the "Basic Functions" part of the manual, but is still useful to be included in the docs. - (let [arg-signature "

arg

\n" + (let [arg-signature (make-title :arg) arg-description (-> html ;; The goal here is to extract the smallest string which: ;; 1) contains the string "global table called arg" @@ -46,6 +49,9 @@ (: :match "(.-)>p<\n") (: :reverse))] (table.insert fields (.. arg-signature arg-description))) + (table.insert fields (.. (make-title "io.stdin") "stdin file")) + (table.insert fields (.. (make-title "io.stdout") "stdout file")) + (table.insert fields (.. (make-title "io.stderr") "stderr file")) (loop (stdlib:find "

.-\n")) (values modules fields last-update))) @@ -205,6 +211,9 @@ (view (list (sym :local) (sym :docs) docs)) "\n" "(set docs._G.fields docs)\n" + "(set docs.io.fields.stdin.fields docs.io.fields)\n" + "(set docs.io.fields.stdout.fields docs.io.fields)\n" + "(set docs.io.fields.stderr.fields docs.io.fields)\n" "docs\n")) (print (.. "Emitted docs for lua" version))))) diff --git a/src/fennel-ls/docs/lua51.fnl b/src/fennel-ls/docs/lua51.fnl index a406109..96f1b3d 100644 --- a/src/fennel-ls/docs/lua51.fnl +++ b/src/fennel-ls/docs/lua51.fnl @@ -418,6 +418,12 @@ on all platforms."}} :read {:binding "io.read" :metadata {:fnl/arglist ["..."] :fnl/docstring "Equivalent to `io.input():read`."}} + :stderr {:binding "io.stderr" + :metadata {:fnl/docstring "stderr file"}} + :stdin {:binding "io.stdin" + :metadata {:fnl/docstring "stdin file"}} + :stdout {:binding "io.stdout" + :metadata {:fnl/docstring "stdout file"}} :tmpfile {:binding "io.tmpfile" :metadata {:fnl/arglist {} :fnl/docstring "Returns a handle for a temporary file. @@ -1401,4 +1407,7 @@ after this first result. In case of any error, `xpcall` returns **false** plus the result from `err`."}}}) (set docs._G.fields docs) +(set docs.io.fields.stdin.fields docs.io.fields) +(set docs.io.fields.stdout.fields docs.io.fields) +(set docs.io.fields.stderr.fields docs.io.fields) docs diff --git a/src/fennel-ls/docs/lua52.fnl b/src/fennel-ls/docs/lua52.fnl index d67656d..253acf0 100644 --- a/src/fennel-ls/docs/lua52.fnl +++ b/src/fennel-ls/docs/lua52.fnl @@ -577,6 +577,12 @@ or to write data to this program :read {:binding "io.read" :metadata {:fnl/arglist ["..."] :fnl/docstring "Equivalent to `io.input():read(...)`."}} + :stderr {:binding "io.stderr" + :metadata {:fnl/docstring "stderr file"}} + :stdin {:binding "io.stdin" + :metadata {:fnl/docstring "stdin file"}} + :stdout {:binding "io.stdout" + :metadata {:fnl/docstring "stdout file"}} :tmpfile {:binding "io.tmpfile" :metadata {:fnl/arglist {} :fnl/docstring "Returns a handle for a temporary file. @@ -1656,4 +1662,7 @@ and `\"userdata\"`."}} :fnl/docstring "This function is similar to `pcall`, except that it sets a new message handler `msgh`."}}}) (set docs._G.fields docs) +(set docs.io.fields.stdin.fields docs.io.fields) +(set docs.io.fields.stdout.fields docs.io.fields) +(set docs.io.fields.stderr.fields docs.io.fields) docs diff --git a/src/fennel-ls/docs/lua53.fnl b/src/fennel-ls/docs/lua53.fnl index 3586f57..44f3527 100644 --- a/src/fennel-ls/docs/lua53.fnl +++ b/src/fennel-ls/docs/lua53.fnl @@ -464,6 +464,12 @@ or to write data to this program :read {:binding "io.read" :metadata {:fnl/arglist ["..."] :fnl/docstring "Equivalent to `io.input():read(...)`."}} + :stderr {:binding "io.stderr" + :metadata {:fnl/docstring "stderr file"}} + :stdin {:binding "io.stdin" + :metadata {:fnl/docstring "stdin file"}} + :stdout {:binding "io.stdout" + :metadata {:fnl/docstring "stdout file"}} :tmpfile {:binding "io.tmpfile" :metadata {:fnl/arglist {} :fnl/docstring "In case of success, @@ -1687,4 +1693,7 @@ negative indices count from the end of the string."}} :fnl/docstring "This function is similar to `pcall`, except that it sets a new message handler `msgh`."}}}) (set docs._G.fields docs) +(set docs.io.fields.stdin.fields docs.io.fields) +(set docs.io.fields.stdout.fields docs.io.fields) +(set docs.io.fields.stderr.fields docs.io.fields) docs diff --git a/src/fennel-ls/docs/lua54.fnl b/src/fennel-ls/docs/lua54.fnl index 3d1de71..c23ffcd 100644 --- a/src/fennel-ls/docs/lua54.fnl +++ b/src/fennel-ls/docs/lua54.fnl @@ -508,6 +508,12 @@ or to write data to this program :read {:binding "io.read" :metadata {:fnl/arglist ["..."] :fnl/docstring "Equivalent to `io.input():read(...)`."}} + :stderr {:binding "io.stderr" + :metadata {:fnl/docstring "stderr file"}} + :stdin {:binding "io.stdin" + :metadata {:fnl/docstring "stdin file"}} + :stdout {:binding "io.stdout" + :metadata {:fnl/docstring "stdout file"}} :tmpfile {:binding "io.tmpfile" :metadata {:fnl/arglist {} :fnl/docstring "In case of success, @@ -1868,4 +1874,7 @@ it ignores unknown control messages."}} :fnl/docstring "This function is similar to `pcall`, except that it sets a new message handler `msgh`."}}}) (set docs._G.fields docs) +(set docs.io.fields.stdin.fields docs.io.fields) +(set docs.io.fields.stdout.fields docs.io.fields) +(set docs.io.fields.stderr.fields docs.io.fields) docs