if ctx.currentCharWithSkipWhitespace() == ':' {
continue
}
The reason why it passes this if statement is because the ctx.idx is not updated properly.
The index points at a different column than the actual end of the double quoted string.
This seems like a bug in the ctx.idx updating of the scanDoubleQuote function, but I might not be seeing/understanding the reason why ctx.idx is not updated uniformly in this function.
The faulty tokens dump looks as follows (the last token should not appear at all):
Describe the bug
lexer.Tokenize()
produces invalid tokens when given certain double quoted strings. The issue comes apparent with double quoted JSON containing:
character on certain positions. The faulty behaviour comes from this line: https://github.com/nobl9/go-yaml/blob/b2a8cc696a9efea74ec54695625870937ce24797/scanner/scanner.go#L837The reason why it passes this if statement is because the
ctx.idx
is not updated properly. The index points at a different column than the actual end of the double quoted string. This seems like a bug in thectx.idx
updating of thescanDoubleQuote
function, but I might not be seeing/understanding the reason whyctx.idx
is not updated uniformly in this function.The faulty tokens dump looks as follows (the last token should not appear at all):
To Reproduce
Expected behavior
The tokenizer produces correct tokens set.
Version Variables