-
Notifications
You must be signed in to change notification settings - Fork 3
/
option.go
39 lines (34 loc) · 982 Bytes
/
option.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package ctoc
import (
"regexp"
"github.com/pkoukk/tiktoken-go"
)
// ClocOptions is gocloc processor options.
type ClocOptions struct {
Debug bool
SkipDuplicated bool
ExcludeExts map[string]struct{}
IncludeLangs map[string]struct{}
ReNotMatch *regexp.Regexp
ReMatch *regexp.Regexp
ReNotMatchDir *regexp.Regexp
ReMatchDir *regexp.Regexp
Tokenizer *tiktoken.Tiktoken
// OnCode is triggered for each line of code.
OnCode func(line string)
// OnBlack is triggered for each blank line.
OnBlank func(line string)
// OnComment is triggered for each line of comments.
OnComment func(line string)
}
// NewClocOptions create new ClocOptions with default values.
func NewClocOptions() *ClocOptions {
tke, _ := tiktoken.GetEncoding("cl100k_base")
return &ClocOptions{
Debug: false,
SkipDuplicated: false,
ExcludeExts: make(map[string]struct{}),
IncludeLangs: make(map[string]struct{}),
Tokenizer: tke,
}
}