function iterate

This commit is contained in:
John Kerl 2020-09-11 11:24:45 -04:00
parent ce6c894673
commit defa2cf323
2 changed files with 35 additions and 12 deletions

View file

@ -5,7 +5,39 @@ import (
"miller/lib"
)
// xxx temp
// ================================================================
type NodeBuilder func (astNode *dsl.ASTNode) (IEvaluable, error)
type FunctionInfo struct {
name string
nodeBuilder NodeBuilder
// help string
// builder ...
// func Builder(astNode *dsl.ASTNode) (IEvaluable, error) { ... }
// type UnaryFunc func(*Mlrval) Mlrval
}
type FunctionManager struct {
}
func (this *FunctionManager) LookUp(functionName string) *FunctionInfo {
return nil
}
// ================================================================
func BuildFunctionCallsiteNode(astNode *dsl.ASTNode) (IEvaluable, error) {
lib.InternalCodingErrorIf(astNode.Type != dsl.NodeTypeFunctionCallsite)
return BuildPanicNode(), nil
//return nil, errors.New(
//"CST BuildFunctionCallsiteNode: unhandled AST node type " + string(astNode.Type),
//)
}
// ================================================================
// ================================================================
// ================================================================
// . + + - - * / // .+ .+ .- .- .* ./ .//
// % ** | ^ & ~ << >> bitcount == != =~ !=~ > >= < <= && || ^^ ! ? :
@ -30,17 +62,6 @@ import (
// substr system systime tan tanh tolower toupper typeof urand urand32
// urandint urandrange
// ----------------------------------------------------------------
func BuildFunctionCallsiteNode(astNode *dsl.ASTNode) (IEvaluable, error) {
lib.InternalCodingErrorIf(astNode.Type != dsl.NodeTypeFunctionCallsite)
return BuildPanicNode(), nil
//return nil, errors.New(
//"CST BuildFunctionCallsiteNode: unhandled AST node type " + string(astNode.Type),
//)
}
//// ----------------------------------------------------------------
//type UnaryFunctionCallsiteNode struct {
// evaluable1 IEvaluable

View file

@ -3,6 +3,8 @@ TOP OF LIST:
* friday:
o functions?!?
- lib/mlrval_operators.go -> lib/mlrval_functions.go
- cst/operators.go -> cst/functions.go
* begin/end hygiene:
- AST tree-walk / CST build: must be at top level
- tree-walk begin/end to check for invalids ($-anything etc)