1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-11-23 22:24:39 +02:00

Pass *LexerState as context to emitters

Useful for accessing named capture groups and context set by
`mutators` and other field and methods LexerState provides.
This commit is contained in:
Siavash Askari Nasr
2021-05-06 14:37:30 +04:30
committed by Alec Thomas
parent 2cc8645d62
commit 225e1862d3
5 changed files with 30 additions and 28 deletions

View File

@@ -342,6 +342,6 @@ func (t TokenType) InSubCategory(other TokenType) bool {
return t/100 == other/100
}
func (t TokenType) Emit(groups []string, lexer Lexer) Iterator {
func (t TokenType) Emit(groups []string, _ *LexerState) Iterator {
return Literator(Token{Type: t, Value: groups[0]})
}