summaryrefslogtreecommitdiff
path: root/reencode_compactws.go
blob: 396cf6dbe9978805e0009a9be5c1128615f803eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (C) 2022-2023  Luke Shumaker <lukeshu@lukeshu.com>
//
// SPDX-License-Identifier: GPL-2.0-or-later

package lowmemjson

import (
	"git.lukeshu.com/go/lowmemjson/internal/jsonparse"
)

type reEncodeCompactWS struct {
	out reEncoderModule
}

var _ reEncoderModule = (*reEncodeCompactWS)(nil)

func (enc *reEncodeCompactWS) PopWriteBarrier() {
	enc.out.PopWriteBarrier()
}

func (enc *reEncodeCompactWS) HandleRune(c rune, t jsonparse.RuneType, escape BackslashEscapeMode, stackSize int) error {
	if t == jsonparse.RuneTypeSpace {
		return nil
	}

	return enc.out.HandleRune(c, t, escape, stackSize)
}