public class ArgumentListProcessor
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ArgumentListProcessor.KeywordParam
Class used to represent optional parameters and their initforms
|
static class |
ArgumentListProcessor.LambdaListType |
static class |
ArgumentListProcessor.OptionalParam
Class used to match optional parameters, or, if not provided,
evaluate the initform.
|
static class |
ArgumentListProcessor.Param
Abstract parent of the classes used to represent the different argument types:
- EnvironmentParam
- RequiredParam
- OptionalParam
- RestParam
- KeywordParam
- AuxParam
|
static class |
ArgumentListProcessor.RequiredParam
Class used to match required parameters
|
Constructor and Description |
---|
ArgumentListProcessor(Operator fun,
int requiredCount,
ArgumentListProcessor.OptionalParam[] optional,
ArgumentListProcessor.KeywordParam[] keyword,
boolean key,
boolean moreKeys,
Symbol rest)
Constructor to be used from compiled code
The compiler hands in pre-parsed lambda lists.
|
ArgumentListProcessor(Operator fun,
LispObject lambdaList,
LispObject specials,
ArgumentListProcessor.LambdaListType type)
Instantiates an ArgumentListProcessor by parsing the lambda list specified
in 'lambdaList'.
|
Modifier and Type | Method and Description |
---|---|
void |
bindVars(LispObject[] values,
Environment env,
LispThread thread)
Binds the variable values returned from 'match' to their corresponding
variables in the environment 'env', with specials bound in thread 'thread'.
|
Symbol[] |
freeSpecials(LispObject specials) |
int |
getArity() |
int |
getMaxArgs() |
int |
getMinArgs() |
Symbol[] |
getVariables() |
LispObject[] |
match(LispObject[] args,
Environment _environment,
Environment env,
LispThread thread)
Matches the function call arguments 'args' with the lambda list,
returning an array with variable values to be used.
|
void |
setFunction(Operator fun) |
public ArgumentListProcessor(Operator fun, int requiredCount, ArgumentListProcessor.OptionalParam[] optional, ArgumentListProcessor.KeywordParam[] keyword, boolean key, boolean moreKeys, Symbol rest)
fun
- The function to report function call argument matching errors onrequired
- The list of required argumentsoptional
- The list of optional argumentskeyword
- The list of keyword parameterskey
- Indicates whether &key was specified (optionally without naming keys)moreKeys
- Indicates whether &allow-other-keys was specifiedrest
- Specifies the &rest variable name, if one was specified, or 'null' if nonepublic ArgumentListProcessor(Operator fun, LispObject lambdaList, LispObject specials, ArgumentListProcessor.LambdaListType type)
fun
- Function to use when reporting errorslambdaList
- Lambda list to parse and use for function callspecials
- A list of symbols specifying which variables to
bind as specials during initform evaluationpublic void setFunction(Operator fun)
public LispObject[] match(LispObject[] args, Environment _environment, Environment env, LispThread thread)
args
- Funcion call arguments to be matched_environment
- Environment to be used for the &environment variableenv
- Environment to evaluate initforms inthread
- Thread to be used for binding special variables
-- must be LispThread.currentThread()public void bindVars(LispObject[] values, Environment env, LispThread thread)
values
- Values to be boundenv
- thread
- public Symbol[] freeSpecials(LispObject specials)
public int getArity()
public int getMinArgs()
public int getMaxArgs()
public Symbol[] getVariables()