syncing unfinished work with dev
This commit is contained in:
parent
4ce1f7137c
commit
6afd01da2a
2 changed files with 14 additions and 7 deletions
|
|
@ -18,6 +18,7 @@
|
|||
package ast
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gitlab.com/whom/shs/log"
|
||||
)
|
||||
|
||||
|
|
@ -64,7 +65,7 @@ func (f Function) ParseFunction(args *Token) bool {
|
|||
total := len(f.Args)
|
||||
for iter := args; iter != nil; iter = iter.Next {
|
||||
total -= 1
|
||||
if total <= 0 {
|
||||
if total < 0 {
|
||||
log.Log(log.ERR,
|
||||
"too many arguments",
|
||||
"ftable")
|
||||
|
|
@ -80,6 +81,13 @@ func (f Function) ParseFunction(args *Token) bool {
|
|||
}
|
||||
}
|
||||
|
||||
if total > 0 {
|
||||
log.Log(log.ERR,
|
||||
"not enough args given",
|
||||
"ftable")
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -127,13 +135,14 @@ func (f Function) CallFunction(args *Token, vt VarTable, ft FuncTable) *Token {
|
|||
passes = f.ParseFunction(args)
|
||||
}
|
||||
|
||||
if passes {
|
||||
if !passes {
|
||||
log.Log(log.ERR,
|
||||
"Couldnt call " + f.Name,
|
||||
"eval")
|
||||
return nil
|
||||
}
|
||||
|
||||
fmt.Printf("ARGS: %+v", *args)
|
||||
f.TimesCalled += 1
|
||||
return f.Function(args, vt, ft)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,10 +102,8 @@ func GenFuncTable() ast.FuncTable {
|
|||
Function: Export,
|
||||
Name: "export",
|
||||
EvalLazy: true,
|
||||
Args: []ast.Token_t{
|
||||
ast.STRING,
|
||||
ast.LIST,
|
||||
},
|
||||
ArgLazy: true,
|
||||
NumArgs: 2,
|
||||
},
|
||||
|
||||
"input": &ast.Function{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue