func MaxRegexpLength(maxRegexpLength int) Option {
	return func(c *Compiler) error {
		c.maxRegexpLength = maxRegexpLength
		return nil
	}
}
MaxRegexpLength sets the maximum allowable length of a regular expression.
package compiler
import (
	"io"
	"path/filepath"
	"github.com/golang/glog"
	"github.com/google/mtail/internal/runtime/code"
	"github.com/google/mtail/internal/runtime/compiler/ast"
	"github.com/google/mtail/internal/runtime/compiler/checker"
	"github.com/google/mtail/internal/runtime/compiler/codegen"
	"github.com/google/mtail/internal/runtime/compiler/opt"
	"github.com/google/mtail/internal/runtime/compiler/parser"
)
type Compiler struct {
	emitAst             bool
	emitAstTypes        bool
	maxRegexpLength     int
	maxRecursionDepth   int
	disableOptimisation bool
}
func New(options ...Option) (*Compiler, error) {
	c := &Compiler{}
	if err := c.SetOption(options...); err != nil {
		return nil, err
	}
	return c, nil
}
func (c *Compiler) SetOption(options ...Option) error {
	for _, option := range options {
		if err := option(c); err != nil {
			return err
		}
	}
	return nil
}
type Option func(*Compiler) error
func EmitAst() Option {
	return func(c *Compiler) error {
		c.emitAst = true
		return nil
	}
}
func EmitAstTypes() Option {
	return func(c *Compiler) error {
		c.emitAstTypes = true
		return nil
	}
}