add stdlib package with readme

This commit is contained in:
Aidan 2020-06-21 11:11:57 -07:00
parent c40aea7326
commit 0b3bac7bca
No known key found for this signature in database
GPG key ID: 327711E983899316
9 changed files with 123 additions and 47 deletions

View file

@ -17,7 +17,9 @@
package ast
type Operation func(*Token) *Token
import "git.callpipe.com/aidan/shs/log"
type Operation func(*Token, VarTable, FuncTable) *Token
type Function struct {
function Operation
@ -50,16 +52,16 @@ func (f Function) ParseFunction(args *Token) bool {
return true
}
func (f Function) CallFunction(args *Token) *Token {
func (f Function) CallFunction(args *Token, vt VarTable, ft FuncTable) *Token {
if !f.ParseFunction(args) {
log.Log(log.Err,
log.Log(log.ERR,
"Couldnt call " + f.name,
"eval")
return nil
}
f.timesCalled += 1
return f.function(args)
return f.function(args, vt, ft)
}
func (table FuncTable) GetFunction(arg string) *Function {