Source File
coalesce.go
Belonging Package
github.com/alecthomas/chroma/v2
package chroma// Coalesce is a Lexer interceptor that collapses runs of common types into a single token.func ( Lexer) Lexer { return &coalescer{} }type coalescer struct{ Lexer }func ( *coalescer) ( *TokeniseOptions, string) (Iterator, error) {var Token, := .Lexer.Tokenise(, )if != nil {return nil,}return func() Token {for := (); != (EOF); = () {if len(.Value) == 0 {continue}if == EOF {=} else {if .Type == .Type && len(.Value) < 8192 {.Value += .Value} else {:==return}}}:== EOFreturn}, nil}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |