2020-02-11 10:34:17 +01:00
|
|
|
// +build flex
|
|
|
|
|
|
|
|
package tokenizer
|
|
|
|
|
2020-04-15 19:40:39 +02:00
|
|
|
import "github.com/go-enry/go-enry/v2/internal/tokenizer/flex"
|
2020-02-11 10:34:17 +01: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.
|
|
|
|
func Tokenize(content []byte) []string {
|
|
|
|
if len(content) > ByteLimit {
|
|
|
|
content = content[:ByteLimit]
|
|
|
|
}
|
|
|
|
|
|
|
|
return flex.TokenizeFlex(content)
|
|
|
|
}
|