1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-01-12 01:22:30 +02:00

Fix bug in Turtle lexer.

This commit is contained in:
Alec Thomas 2017-09-22 23:27:40 +10:00
parent a5a3b67010
commit 9d7539a4cd
2 changed files with 1 additions and 2 deletions

View File

@ -57,7 +57,7 @@ var Turtle = Register(MustNewLexer(
{`.`, LiteralString, Pop(1)},
},
"end-of-string": {
{`(@)([a-z]+(:?-[a-z0-9]+)*)`, ByGroups(Operator, GenericEmph), Pop(2)},
{`(@)([a-z]+(:?-[a-z0-9]+)*)`, ByGroups(Operator, GenericEmph, GenericEmph), Pop(2)},
{"(\\^\\^)(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)", ByGroups(Operator, GenericEmph), Pop(2)},
{`(\^\^)((?:[a-z][\w-]*)?\:)([a-z][\w-]*)`, ByGroups(Operator, GenericEmph, GenericEmph), Pop(2)},
Default(Pop(2)),

View File

@ -34,7 +34,6 @@ func ByGroups(emitters ...Emitter) Emitter {
return EmitterFunc(func(groups []string, lexer Lexer) Iterator {
iterators := make([]Iterator, 0, len(groups)-1)
// NOTE: If this panics, there is a mismatch with groups. Uncomment the following line to debug.
// fmt.Printf("%s %#v\n", emitters, groups[1:])
for i, group := range groups[1:] {
iterators = append(iterators, emitters[i].Emit([]string{group}, lexer))
}