1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-12-05 23:08:23 +02:00

refactor: Iterator -> iter.Seq[Token]

This commit is contained in:
Alec Thomas
2025-09-21 20:08:46 +10:00
parent 26ea2fc245
commit ca57a0bae1
28 changed files with 96 additions and 83 deletions

View File

@@ -3,6 +3,7 @@ package chroma
import (
"encoding/json"
"fmt"
"iter"
"os"
"path/filepath"
"regexp"
@@ -491,7 +492,7 @@ func (r *RegexLexer) needRules() error {
}
// Tokenise text using lexer, returning an iterator.
func (r *RegexLexer) Tokenise(options *TokeniseOptions, text string) (Iterator, error) {
func (r *RegexLexer) Tokenise(options *TokeniseOptions, text string) (iter.Seq[Token], error) {
err := r.needRules()
if err != nil {
return nil, err