1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-03-23 21:29:15 +02:00
This commit is contained in:
Alec Thomas 2019-11-23 22:40:35 +11:00
parent cfc6117710
commit 28dcb8565c
2 changed files with 1 additions and 2 deletions

@ -53,7 +53,7 @@ var Bash = internal.Register(MustNewLexer(
{`&`, Punctuation, nil}, {`&`, Punctuation, nil},
{`\|`, Punctuation, nil}, {`\|`, Punctuation, nil},
{`\s+`, Text, nil}, {`\s+`, Text, nil},
{`\d+\b`, LiteralNumber, nil}, {`\d+(?= |$)`, LiteralNumber, nil},
{"[^=\\s\\[\\]{}()$\"\\'`\\\\<&|;]+", Text, nil}, {"[^=\\s\\[\\]{}()$\"\\'`\\\\<&|;]+", Text, nil},
{`<`, Text, nil}, {`<`, Text, nil},
}, },

@ -34,7 +34,6 @@ func (e EmitterFunc) Emit(groups []string, lexer Lexer) Iterator { return e(grou
func ByGroups(emitters ...Emitter) Emitter { func ByGroups(emitters ...Emitter) Emitter {
return EmitterFunc(func(groups []string, lexer Lexer) Iterator { return EmitterFunc(func(groups []string, lexer Lexer) Iterator {
iterators := make([]Iterator, 0, len(groups)-1) iterators := make([]Iterator, 0, len(groups)-1)
// NOTE: If this panics, there is a mismatch with groups
if len(emitters) != len(groups)-1 { if len(emitters) != len(groups)-1 {
iterators = append(iterators, Error.Emit(groups, lexer)) iterators = append(iterators, Error.Emit(groups, lexer))
// panic(errors.Errorf("number of groups %q does not match number of emitters %v", groups, emitters)) // panic(errors.Errorf("number of groups %q does not match number of emitters %v", groups, emitters))