2019-03-24 17:55:05 +00:00
|
|
|
// +build flex
|
2019-03-24 01:06:19 +00:00
|
|
|
|
2019-03-24 17:55:05 +00:00
|
|
|
package tokenizer
|
2019-03-24 01:06:19 +00:00
|
|
|
|
2020-03-19 16:31:29 +00:00
|
|
|
import "github.com/go-enry/go-enry/v2/internal/tokenizer/flex"
|
2019-03-24 01:06:19 +00:00
|
|
|
|
2019-04-14 20:15:18 +00:00
|
|
|
// Tokenize returns lexical tokens from content. The tokens returned match what
|
|
|
|
// the Linguist library returns. At most the first ByteLimit bytes of content are tokenized.
|
2019-03-24 17:55:05 +00:00
|
|
|
func Tokenize(content []byte) []string {
|
2019-04-14 20:15:18 +00:00
|
|
|
if len(content) > ByteLimit {
|
|
|
|
content = content[:ByteLimit]
|
2019-03-24 01:06:19 +00:00
|
|
|
}
|
|
|
|
|
2019-03-24 17:55:05 +00:00
|
|
|
return flex.TokenizeFlex(content)
|
2019-03-24 01:06:19 +00:00
|
|
|
}
|