changed table types to support implementing 'let', also integrated stdlib into repl
This commit is contained in:
parent
b01415d786
commit
9c25ac21f9
5 changed files with 16 additions and 58 deletions
|
|
@ -28,7 +28,7 @@ type Function struct {
|
|||
Args int // TODO: Make this a list of expected types (TAGs)
|
||||
}
|
||||
|
||||
type FuncTable map[string]*Function
|
||||
type FuncTable *map[string]*Function
|
||||
|
||||
// TODO: Currently only checks arg list length
|
||||
func (f Function) ParseFunction(args *Token) bool {
|
||||
|
|
@ -64,8 +64,8 @@ func (f Function) CallFunction(args *Token, vt VarTable, ft FuncTable) *Token {
|
|||
return f.Function(args, vt, ft)
|
||||
}
|
||||
|
||||
func (table FuncTable) GetFunction(arg string) *Function {
|
||||
target, ok := table[arg]
|
||||
func GetFunction(arg string, table FuncTable) *Function {
|
||||
target, ok := (*table)[arg]
|
||||
if !ok {
|
||||
log.Log(log.DEBUG,
|
||||
"function " + arg + " not found",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue