Fix escape sequence parsing

This commit is contained in:
Sasha Koshka 2024-08-31 22:54:38 -04:00
parent a854dd0618
commit dbffe4b7c4

11
asv.go
View File

@ -156,12 +156,17 @@ func (this *Decoder) ReadUnit () (unit Unit, next rune, err error) {
char, _, err := this.reader.ReadRune()
if err != nil { return Unit(str.String()), 0, err }
if esc {
switch {
case esc:
esc = false
} else if IsSeparator(char) {
str.WriteRune(char)
case char == Escape:
esc = true
case IsSeparator(char):
return Unit(str.String()), char, nil
default:
str.WriteRune(char)
}
str.WriteRune(char)
}
}