It builds
This commit is contained in:
parent
7aa80376bb
commit
7e175dec95
7 changed files with 52 additions and 45 deletions
|
|
@ -1,13 +1,9 @@
|
|||
package shsh
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Operation func(*Token) *Token
|
||||
|
||||
type Function struct {
|
||||
func operation
|
||||
function Operation
|
||||
timesCalled int
|
||||
args int
|
||||
}
|
||||
|
|
@ -26,7 +22,7 @@ func ParseFunction(target *Function, args *Token) bool {
|
|||
}
|
||||
|
||||
i := target.args
|
||||
for iter = &args; *iter; iter = &(*iter.next) {
|
||||
for iter := &args; *iter != nil; iter = &((*iter).next) {
|
||||
i -= 1
|
||||
}
|
||||
|
||||
|
|
@ -44,11 +40,11 @@ func CallFunction(target *Function, args *Token) *Token {
|
|||
}
|
||||
|
||||
target.timesCalled += 1
|
||||
return target.operation(args)
|
||||
return target.function(args)
|
||||
}
|
||||
|
||||
func GetFunction(string arg) *Function {
|
||||
target, ok := GlobalFuncTable[arg]
|
||||
func GetFunction(arg string) *Function {
|
||||
target, ok := (*GlobalFuncTable)[arg]
|
||||
if !ok {
|
||||
// TODO: hook into stdlib exec call
|
||||
;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue