diff --git a/nbt/snbt_decode.go b/nbt/snbt_decode.go index 4971071..1185864 100644 --- a/nbt/snbt_decode.go +++ b/nbt/snbt_decode.go @@ -22,7 +22,7 @@ func (e *Encoder) WriteSNBT(snbt string) error { panic(phasePanicMsg) case scanBeginLiteral: - + return writeLiteral(e, &d) case scanBeginCompound: panic("not implemented") diff --git a/nbt/snbt_scanner.go b/nbt/snbt_scanner.go index 5e26e8d..e47ddf9 100644 --- a/nbt/snbt_scanner.go +++ b/nbt/snbt_scanner.go @@ -86,7 +86,7 @@ func (s *scanner) popParseState() { s.parseState = s.parseState[:n] if n == 0 { s.step = s.stateEndTop - //s.endTop = true + s.endTop = true } else { s.step = s.stateEndValue } @@ -324,10 +324,6 @@ func (s *scanner) stateNumDot0(c byte) int { } func (s *scanner) stateEndNumValue(c byte) int { - if isSpace(c) { - s.step = s.stateEndValue - return scanSkipSpace - } switch c { case 'b', 'B': // TAG_Byte s.step = s.stateEndValue diff --git a/nbt/snbt_scanner_test.go b/nbt/snbt_scanner_test.go index 7cc09aa..029288a 100644 --- a/nbt/snbt_scanner_test.go +++ b/nbt/snbt_scanner_test.go @@ -6,12 +6,13 @@ import ( ) func TestSNBT_checkScanCode(t *testing.T) { - t.SkipNow() + //t.SkipNow() var s scanner s.reset() - for _, c := range []byte(`{ "a b\"c": {}, def: 12345}`) { + for _, c := range []byte(`1234`) { t.Logf("[%c] - %d", c, s.step(c)) } + t.Logf("[%c] - %d", ' ', s.eof()) } func TestSNBT_number(t *testing.T) {