Add base.token_decoder.workbuf_len

This commit is contained in:
Nigel Tao committed 2020-03-26 08:47:42 +11:00
1 parent 40d200cdab
commit f3146c2ea9
11 files changed
+193 -52

No files matched your search

+2
View File
@@ -21,6 +21,8 @@ pub status "#unsupported recursion depth"
pri status "#internal error: inconsistent I/O"
pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 0
// decoder_depth_max_incl is the maximum supported recursion depth: how deeply
// nested [] arrays and {} objects can be.
//
+7 -1
View File
@@ -32,6 +32,8 @@ pub struct decoder? implements base.token_decoder(
allow_leading_ubom : base.bool,
end_of_data : base.bool,
util : base.utility,
)(
// stack is conceptually an array of bits, implemented as an array of u32.
// The N'th bit being 0 or 1 means that we're in an array or object, where
@@ -100,7 +102,11 @@ pub func decoder.set_quirk_enabled!(quirk: base.u32, enabled: base.bool) {
}
}
pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader) {
pub func decoder.workbuf_len() base.range_ii_u64 {
return this.util.empty_range_ii_u64()
}
pub func decoder.decode_tokens?(dst: base.token_writer, src: base.io_reader, workbuf: slice base.u8) {
var vminor : base.u32[..= 0xFF_FFFF]
var number_length : base.u32[..= 0x3FF]
var number_status : base.u32[..= 0x3]