Refactor encoder's vm

This commit is contained in:
Masaaki Goshima 2021-11-28 21:46:32 +09:00
parent fa6c96f02c
commit f6b4e43f6a
No known key found for this signature in database
GPG Key ID: 6A53785055537153
9 changed files with 922 additions and 1800 deletions

File diff suppressed because it is too large Load Diff

View File

@ -126,6 +126,10 @@ func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
return append(b, ',') return append(b, ',')
} }
func appendNullComma(_ *encoder.RuntimeContext, b []byte) []byte {
return append(b, "null,"...)
}
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
last := len(b) - 1 last := len(b) - 1
b[last] = ':' b[last] = ':'

File diff suppressed because it is too large Load Diff

View File

@ -178,6 +178,13 @@ func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
return append(b, ',') return append(b, ',')
} }
func appendNullComma(ctx *encoder.RuntimeContext, b []byte) []byte {
format := ctx.Option.ColorScheme.Null
b = append(b, format.Header...)
b = append(b, "null"...)
return append(append(b, format.Footer...), ',')
}
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
last := len(b) - 1 last := len(b) - 1
b[last] = ':' b[last] = ':'

File diff suppressed because it is too large Load Diff

View File

@ -181,6 +181,13 @@ func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
return append(b, ',', '\n') return append(b, ',', '\n')
} }
func appendNullComma(ctx *encoder.RuntimeContext, b []byte) []byte {
format := ctx.Option.ColorScheme.Null
b = append(b, format.Header...)
b = append(b, "null"...)
return append(append(b, format.Footer...), ',', '\n')
}
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
return append(b, ':', ' ') return append(b, ':', ' ')
} }

File diff suppressed because it is too large Load Diff

View File

@ -128,6 +128,10 @@ func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
return append(b, ',', '\n') return append(b, ',', '\n')
} }
func appendNullComma(_ *encoder.RuntimeContext, b []byte) []byte {
return append(b, "null,\n"...)
}
func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
return append(b, ':', ' ') return append(b, ':', ' ')
} }

File diff suppressed because it is too large Load Diff