mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 11:13:33 +01:00
chore: modernize CI and update Go toolchain
- Bump Go from 1.19 to 1.26 and update all dependencies - Rewrite CI workflow with matrix strategy (Linux, macOS, Windows) - Update GitHub Actions to current versions (checkout@v4, setup-go@v5) - Update CodeQL actions from v1 to v3 - Fix cross-platform bug in mock/path.go (path.Join -> filepath.Join) - Clean up dependabot config (weekly schedule, remove stale ignore) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
19
vendor/github.com/alecthomas/chroma/v2/iterator.go
generated
vendored
19
vendor/github.com/alecthomas/chroma/v2/iterator.go
generated
vendored
@@ -18,6 +18,17 @@ func (i Iterator) Tokens() []Token {
|
||||
return out
|
||||
}
|
||||
|
||||
// Stdlib converts a Chroma iterator to a Go 1.23-compatible iterator.
|
||||
func (i Iterator) Stdlib() func(yield func(Token) bool) {
|
||||
return func(yield func(Token) bool) {
|
||||
for t := i(); t != EOF; t = i() {
|
||||
if !yield(t) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Concaterator concatenates tokens from a series of iterators.
|
||||
func Concaterator(iterators ...Iterator) Iterator {
|
||||
return func() Token {
|
||||
@@ -47,6 +58,7 @@ func Literator(tokens ...Token) Iterator {
|
||||
// SplitTokensIntoLines splits tokens containing newlines in two.
|
||||
func SplitTokensIntoLines(tokens []Token) (out [][]Token) {
|
||||
var line []Token // nolint: prealloc
|
||||
tokenLoop:
|
||||
for _, token := range tokens {
|
||||
for strings.Contains(token.Value, "\n") {
|
||||
parts := strings.SplitAfterN(token.Value, "\n", 2)
|
||||
@@ -59,6 +71,11 @@ func SplitTokensIntoLines(tokens []Token) (out [][]Token) {
|
||||
line = append(line, clone)
|
||||
out = append(out, line)
|
||||
line = nil
|
||||
|
||||
// If the tail token is empty, don't emit it.
|
||||
if len(token.Value) == 0 {
|
||||
continue tokenLoop
|
||||
}
|
||||
}
|
||||
line = append(line, token)
|
||||
}
|
||||
@@ -72,5 +89,5 @@ func SplitTokensIntoLines(tokens []Token) (out [][]Token) {
|
||||
out = out[:len(out)-1]
|
||||
}
|
||||
}
|
||||
return
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user