Builtin function argument parsing

This commit is contained in:
2026-01-19 23:29:14 -08:00
parent c63b104bc6
commit 243a012d3e
11 changed files with 243 additions and 50 deletions

View File

@ -12,11 +12,12 @@ DECLARE_SYMBOL(and_allow_other_keys);
struct LambdaList {
size_t n_req;
size_t n_opt;
size_t n_kw;
bool allow_other_keys;
LispVal *req; // list of symbols
LispVal *opt; // list of lists of (name default has-p-name)
LispVal *kw; // ditto opt
LispVal *kw; // hash table mapping name (a keyword) to a list of (index name
// default has-p-name). This is nil if we are not a keyword
// function.
LispVal *rest; // symbol (non-nil if we have a rest arg)
};
@ -56,8 +57,11 @@ typedef enum {
LLPS_DOTTED,
LLPS_REPEAT_SECTION,
LLPS_REPEAT_NAME,
LLPS_SYNTAX,
LLPS_ORDER,
LLPS_BAD_NAME,
LLPS_REPEAT_REST,
LLPS_AFTER_ALLOW_OTHER_KEYS,
LLPS_INVALID_OPT_SPEC,
LLPS_N_ERROS,
} LambdaListParseStatus;
@ -84,5 +88,6 @@ LispVal *make_builtin_function(LispVal *name, LispVal *(*func)(),
internal_F##cname##_docstr_len, false, false))
DECLARE_FUNCTION(funcall, (LispVal * func, LispVal *args));
#define CALL(func, ...) (Ffuncall((func), LIST(__VA_ARGS__)))
#endif