context.go renamed as expr-context.go
This commit is contained in:
		
							parent
							
								
									6d9a379c92
								
							
						
					
					
						commit
						22a36fa630
					
				
							
								
								
									
										55
									
								
								context.go
									
									
									
									
									
								
							
							
						
						
									
										55
									
								
								context.go
									
									
									
									
									
								
							@ -1,55 +0,0 @@
 | 
			
		||||
// Copyright (c) 2024 Celestino Amoroso (celestino.amoroso@gmail.com).
 | 
			
		||||
// All rights reserved.
 | 
			
		||||
 | 
			
		||||
// context.go
 | 
			
		||||
package expr
 | 
			
		||||
 | 
			
		||||
// ---- Functor interface
 | 
			
		||||
type Functor interface {
 | 
			
		||||
	Invoke(ctx ExprContext, name string, args []any) (result any, err error)
 | 
			
		||||
	SetFunc(info ExprFunc)
 | 
			
		||||
	GetFunc() ExprFunc
 | 
			
		||||
	GetParams() []ExprFuncParam
 | 
			
		||||
	GetDefinitionContext() ExprContext
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ---- Function Param Info
 | 
			
		||||
type ExprFuncParam interface {
 | 
			
		||||
	Name() string
 | 
			
		||||
	Type() string
 | 
			
		||||
	IsDefault() bool
 | 
			
		||||
	IsOptional() bool
 | 
			
		||||
	IsRepeat() bool
 | 
			
		||||
	DefaultValue() any
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ---- Function Info
 | 
			
		||||
type ExprFunc interface {
 | 
			
		||||
	Formatter
 | 
			
		||||
	Name() string
 | 
			
		||||
	MinArgs() int
 | 
			
		||||
	MaxArgs() int
 | 
			
		||||
	Functor() Functor
 | 
			
		||||
	Params() []ExprFuncParam
 | 
			
		||||
	ReturnType() string
 | 
			
		||||
	PrepareCall(parentCtx ExprContext, name string, varParams *[]any) (ctx ExprContext, err error)
 | 
			
		||||
	AllocContext(parentCtx ExprContext) (ctx ExprContext)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ----Expression Context
 | 
			
		||||
type ExprContext interface {
 | 
			
		||||
	Clone() ExprContext
 | 
			
		||||
	// Merge(ctx ExprContext)
 | 
			
		||||
	SetParent(ctx ExprContext)
 | 
			
		||||
	GetParent() (ctx ExprContext)
 | 
			
		||||
	GetVar(varName string) (value any, exists bool)
 | 
			
		||||
	GetLast() any
 | 
			
		||||
	SetVar(varName string, value any)
 | 
			
		||||
	UnsafeSetVar(varName string, value any)
 | 
			
		||||
	EnumVars(func(name string) (accept bool)) (varNames []string)
 | 
			
		||||
	EnumFuncs(func(name string) (accept bool)) (funcNames []string)
 | 
			
		||||
	GetFuncInfo(name string) (item ExprFunc, exists bool)
 | 
			
		||||
	Call(name string, args []any) (result any, err error)
 | 
			
		||||
	RegisterFuncInfo(info ExprFunc)
 | 
			
		||||
	RegisterFunc(name string, f Functor, returnType string, param []ExprFuncParam) error
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user