mirror of
https://github.com/alecthomas/chroma.git
synced 2025-04-02 22:15:29 +02:00
parent
4065717136
commit
ee4284bb40
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user