1
0
mirror of https://github.com/taigrr/wtf synced 2026-04-01 01:28:44 -07:00

Update dependencies

This commit is contained in:
Chris Cummer
2018-08-19 14:33:19 -07:00
parent 7936b5f261
commit 099fa58b39
308 changed files with 35205 additions and 1075 deletions

35
vendor/github.com/alecthomas/chroma/coalesce.go generated vendored Normal file
View File

@@ -0,0 +1,35 @@
package chroma
// Coalesce is a Lexer interceptor that collapses runs of common types into a single token.
func Coalesce(lexer Lexer) Lexer { return &coalescer{lexer} }
type coalescer struct{ Lexer }
func (d *coalescer) Tokenise(options *TokeniseOptions, text string) (Iterator, error) {
var prev *Token
it, err := d.Lexer.Tokenise(options, text)
if err != nil {
return nil, err
}
return func() *Token {
for token := it(); token != nil; token = it() {
if len(token.Value) == 0 {
continue
}
if prev == nil {
prev = token
} else {
if prev.Type == token.Type && len(prev.Value) < 8192 {
prev.Value += token.Value
} else {
out := prev
prev = token
return out
}
}
}
out := prev
prev = nil
return out
}, nil
}