diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-05-08 16:34:13 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-05-08 16:34:13 +0900 |
commit | aa73b03f626189789224c3cc9a0d18e288a5a7b4 (patch) | |
tree | bda7c0e2238418d86b9d2a8bb000908513c1639d /compiler/compiler.go | |
parent | Change type of acceping_states to slice (diff) | |
download | tre-aa73b03f626189789224c3cc9a0d18e288a5a7b4.tar.gz tre-aa73b03f626189789224c3cc9a0d18e288a5a7b4.tar.xz |
Add CLI options
Diffstat (limited to 'compiler/compiler.go')
-rw-r--r-- | compiler/compiler.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/compiler.go b/compiler/compiler.go index ffe0511..d1720de 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -10,9 +10,9 @@ import ( "github.com/nihei9/maleeni/spec" ) -type compilerOption func(c *compilerConfig) error +type CompilerOption func(c *compilerConfig) error -func EnableLogging(w io.Writer) compilerOption { +func EnableLogging(w io.Writer) CompilerOption { return func(c *compilerConfig) error { logger, err := log.NewLogger(w) if err != nil { @@ -27,7 +27,7 @@ type compilerConfig struct { logger log.Logger } -func Compile(lexspec *spec.LexSpec, opts ...compilerOption) (*spec.CompiledLexSpec, error) { +func Compile(lexspec *spec.LexSpec, opts ...CompilerOption) (*spec.CompiledLexSpec, error) { err := lexspec.Validate() if err != nil { return nil, fmt.Errorf("invalid lexical specification:\n%w", err) |