github.com/MontFerret/ferret@v0.18.0/options.go (about)

     1  package ferret
     2  
     3  import "github.com/MontFerret/ferret/pkg/compiler"
     4  
     5  type (
     6  	Options struct {
     7  		compiler []compiler.Option
     8  	}
     9  
    10  	Option func(opts *Options)
    11  )
    12  
    13  func NewOptions(setters []Option) *Options {
    14  	res := &Options{
    15  		compiler: make([]compiler.Option, 0, 2),
    16  	}
    17  
    18  	for _, setter := range setters {
    19  		setter(res)
    20  	}
    21  
    22  	return res
    23  }
    24  
    25  func WithoutStdlib() Option {
    26  	return func(opts *Options) {
    27  		opts.compiler = append(opts.compiler, compiler.WithoutStdlib())
    28  	}
    29  }