mirror of
https://github.com/alecthomas/chroma.git
synced 2025-11-27 22:38:42 +02:00
@@ -170,6 +170,15 @@ func (r Rules) Clone() Rules {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Merge creates a clone of "r" then merges "rules" into the clone.
|
||||||
|
func (r Rules) Merge(rules Rules) Rules {
|
||||||
|
out := r.Clone()
|
||||||
|
for k, v := range rules.Clone() {
|
||||||
|
out[k] = v
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
// MustNewLexer creates a new Lexer or panics.
|
// MustNewLexer creates a new Lexer or panics.
|
||||||
func MustNewLexer(config *Config, rules Rules) *RegexLexer {
|
func MustNewLexer(config *Config, rules Rules) *RegexLexer {
|
||||||
lexer, err := NewLexer(config, rules)
|
lexer, err := NewLexer(config, rules)
|
||||||
|
|||||||
Reference in New Issue
Block a user