From 76d5a40b06ff98ee29a842e277ca66dbe6322157 Mon Sep 17 00:00:00 2001 From: HAYAMA_Kaoru Date: Sat, 3 May 2025 17:21:10 +0900 Subject: [PATCH] doc: add argument descriptions to RunFile and RunString --- main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/main.go b/main.go index a410796..a59953e 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,11 @@ import ( "github.com/hymkor/gmnlisp" ) +// RunFile loads and executes a Lisp script from the specified file. +// - fname: the path to the Lisp source file to be executed. +// - args: typically corresponds to os.Args[1:], where: +// - args[0] is the script file name (not used directly), +// - args[1:] are the arguments passed to the script. func RunFile(fname string, args []string) error { script, err := os.ReadFile(fname) if err != nil { @@ -15,6 +20,11 @@ func RunFile(fname string, args []string) error { return RunString(string(script), args) } +// RunString executes a Lisp script provided as a string. +// - script: the Lisp code to be executed. +// - args: typically corresponds to os.Args[1:], where: +// - args[0] is a pseudo script name, +// - args[1:] are the arguments passed to the script. func RunString(script string, args []string) error { term, err := NewTerm() if err != nil {