Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts ...FunctionalOption) (*Compiler, error)
New creates a new Starlark-specific Compiler instance with the provided options. Global variables are used during script parsing to validate global name usage.
func (*Compiler) Compile ¶
func (c *Compiler) Compile(scriptReader io.ReadCloser) (script.ExecutableContent, error)
Compile turns the provided script content into runnable bytecode.
type FunctionalOption ¶
FunctionalOption is a function that configures a Compiler instance
func WithCtxGlobal ¶
func WithCtxGlobal() FunctionalOption
WithCtxGlobal is a convenience option to set the user-specified global to 'ctx'
func WithGlobals ¶
func WithGlobals(globals []string) FunctionalOption
WithGlobals creates an option to set the globals for Starlark scripts
func WithLogHandler ¶
func WithLogHandler(handler slog.Handler) FunctionalOption
WithLogHandler creates an option to set the log handler for Starlark compiler. This is the preferred option for logging configuration as it provides more flexibility through the slog.Handler interface.
func WithLogger ¶
func WithLogger(logger *slog.Logger) FunctionalOption
WithLogger creates an option to set a specific logger for Starlark compiler. This is less flexible than WithLogHandler but allows users to customize their logging group configuration.