Documentation
¶
Overview ¶
Package resolver assigns integer indexes to functions and variables, as well as determining and checking their types (scalar or array).
Index ¶
- type Config
- type FuncInfo
- type ResolvedProgram
- func (r *ResolvedProgram) IterFuncs(f func(name string, info FuncInfo))
- func (r *ResolvedProgram) IterVars(funcName string, f func(name string, info VarInfo))
- func (r *ResolvedProgram) LookupFunc(name string) (FuncInfo, bool)
- func (r *ResolvedProgram) LookupVar(funcName, name string) (Scope, VarInfo, bool)
- type Scope
- type Type
- type VarInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Enable printing of type information DebugTypes bool // io.Writer to print type information on (for example, os.Stderr) DebugWriter io.Writer // Map of named Go functions to allow calling from AWK. See docs // on interp.Config.Funcs for details. Funcs map[string]interface{} }
Config holds resolver configuration.
type FuncInfo ¶ added in v1.23.0
type FuncInfo struct { Native bool // true if function is a native (Go-defined) function Index int Params []string // list of parameter names }
FuncInfo holds resolved information about a function.
type ResolvedProgram ¶ added in v1.23.0
ResolvedProgram is a parsed AWK program plus variable scope and type data prepared by the resolver that is needed for subsequent interpretation.
func Resolve ¶
func Resolve(prog *ast.Program, config *Config) *ResolvedProgram
Resolve assigns integer indexes to functions and variables, as well as determining and checking their types (scalar or array).
func (*ResolvedProgram) IterFuncs ¶ added in v1.23.0
func (r *ResolvedProgram) IterFuncs(f func(name string, info FuncInfo))
IterFuncs iterates over all the functions, including native (Go-defined) ones, calling f for each function.
func (*ResolvedProgram) IterVars ¶ added in v1.23.0
func (r *ResolvedProgram) IterVars(funcName string, f func(name string, info VarInfo))
IterVars iterates over the variables from the given function ("" to iterate globals), calling f for each variable.
func (*ResolvedProgram) LookupFunc ¶ added in v1.23.0
func (r *ResolvedProgram) LookupFunc(name string) (FuncInfo, bool)
LookupFunc looks up a function by name, returning its info and whether it exists.