Full Code of bytedance/sonic for AI

main 3835c030aefd cached
710 files
16.9 MB
4.5M tokens
5438 symbols
1 requests
Copy disabled (too large) Download .txt
Showing preview only (17,842K chars total). Download the full file to get everything.
Repository: bytedance/sonic
Branch: main
Commit: 3835c030aefd
Files: 710
Total size: 16.9 MB

Directory structure:
gitextract_08lhox7g/

├── .codespellrc
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── feature_request.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       ├── .ignore_words
│       ├── benchmark.yml
│       ├── compatibility_test-windows.yml
│       ├── compatibility_test.yml
│       ├── fuzzing.yml
│       ├── lint.yml
│       ├── test-arm64.yml
│       └── test-x86.yml
├── .gitignore
├── .gitmodules
├── .licenserc.yaml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── CREDITS
├── LICENSE
├── README.md
├── README_ZH_CN.md
├── api.go
├── api_test.go
├── ast/
│   ├── api.go
│   ├── api_compat.go
│   ├── api_native_test.go
│   ├── asm.s
│   ├── buffer.go
│   ├── buffer_test.go
│   ├── decode.go
│   ├── decode_test.go
│   ├── encode.go
│   ├── encode_test.go
│   ├── error.go
│   ├── iterator.go
│   ├── iterator_test.go
│   ├── node.go
│   ├── node_test.go
│   ├── parser.go
│   ├── parser_test.go
│   ├── search.go
│   ├── search_test.go
│   ├── stubs.go
│   ├── testdata_test.go
│   ├── visitor.go
│   └── visitor_test.go
├── compat.go
├── compat_test.go
├── decode_test.go
├── decoder/
│   ├── decoder_compat.go
│   ├── decoder_native.go
│   ├── decoder_native_test.go
│   ├── decoder_test.go
│   └── testdata_test.go
├── docs/
│   ├── INTRODUCTION.md
│   └── INTRODUCTION_ZH_CN.md
├── encode_test.go
├── encoder/
│   ├── encoder_compat.go
│   ├── encoder_native.go
│   ├── encoder_native_test.go
│   ├── encoder_test.go
│   └── testdata_test.go
├── examples/
│   └── example_stream_test.go
├── external_jsonlib_test/
│   ├── benchmark_test/
│   │   ├── ast_set_benchmark_test.go
│   │   ├── decoder_stream_test.go
│   │   ├── decoder_test.go
│   │   ├── encoder_stream_test.go
│   │   ├── encoder_test.go
│   │   ├── msgpack_test.go
│   │   ├── parser_test.go
│   │   ├── search_test.go
│   │   └── testdata_test.go
│   ├── go.mod
│   ├── go.sum
│   └── unit_test/
│       ├── api_test.go
│       ├── ast_compat_test.go
│       └── decoder_stream_test.go
├── fuzz/
│   ├── ast_fuzz_test.go
│   ├── corpus/
│   │   ├── htmescape3.json
│   │   ├── htmlescap2.json
│   │   ├── htmlescape.json
│   │   ├── stringnumber.json
│   │   ├── stringnumber2.json
│   │   ├── struct.json
│   │   ├── twitter.json
│   │   └── twitterescaped.json
│   ├── corpus.go
│   ├── fuzz_test.go
│   ├── go.mod
│   ├── go.sum
│   ├── other_fuzz_test.go
│   └── struct_fuzz_test.go
├── generic_test/
│   ├── benchmark_test.go
│   ├── go.mod
│   ├── go.sum
│   ├── sonic_test.go
│   └── testdata_test.go
├── go.mod
├── go.sum
├── go.work
├── go.work.sum
├── internal/
│   ├── caching/
│   │   ├── asm.s
│   │   ├── fcache.go
│   │   ├── hashing.go
│   │   ├── hashing_test.go
│   │   ├── pcache.go
│   │   └── pcache_test.go
│   ├── compat/
│   │   └── warn.go
│   ├── cpu/
│   │   └── features.go
│   ├── decoder/
│   │   ├── api/
│   │   │   ├── decoder.go
│   │   │   ├── decoder_amd64.go
│   │   │   ├── decoder_arm64.go
│   │   │   ├── norace_test.go
│   │   │   ├── stream.go
│   │   │   ├── stream_test.go
│   │   │   └── testdata_test.go
│   │   ├── consts/
│   │   │   └── option.go
│   │   ├── errors/
│   │   │   ├── errors.go
│   │   │   ├── errors_test.go
│   │   │   └── fuzz_test.go
│   │   ├── jitdec/
│   │   │   ├── asm.s
│   │   │   ├── asm_stubs_amd64_go117.go
│   │   │   ├── asm_stubs_amd64_go121.go
│   │   │   ├── assembler_regabi_amd64.go
│   │   │   ├── assembler_test.go
│   │   │   ├── compiler.go
│   │   │   ├── compiler_test.go
│   │   │   ├── debug.go
│   │   │   ├── decoder.go
│   │   │   ├── generic_regabi_amd64.go
│   │   │   ├── generic_regabi_amd64_test.s
│   │   │   ├── generic_test.go
│   │   │   ├── pcsp_test.go
│   │   │   ├── pools.go
│   │   │   ├── primitives.go
│   │   │   ├── testdata_test.go
│   │   │   ├── types.go
│   │   │   └── utils.go
│   │   └── optdec/
│   │       ├── compile_struct.go
│   │       ├── compiler.go
│   │       ├── const.go
│   │       ├── context.go
│   │       ├── decoder.go
│   │       ├── errors.go
│   │       ├── functor.go
│   │       ├── helper.go
│   │       ├── interface.go
│   │       ├── map.go
│   │       ├── native.go
│   │       ├── native_test.go
│   │       ├── node.go
│   │       ├── slice.go
│   │       ├── stringopts.go
│   │       ├── structs.go
│   │       ├── testdata_test.go
│   │       └── types.go
│   ├── encoder/
│   │   ├── alg/
│   │   │   ├── mapiter.go
│   │   │   ├── opts.go
│   │   │   ├── sort.go
│   │   │   ├── sort_test.go
│   │   │   ├── spec.go
│   │   │   ├── spec_compat.go
│   │   │   └── spec_test.go
│   │   ├── compiler.go
│   │   ├── compiler_test.go
│   │   ├── encode_norace.go
│   │   ├── encode_race.go
│   │   ├── encoder.go
│   │   ├── encoder_norace_test.go
│   │   ├── encoder_test.go
│   │   ├── ir/
│   │   │   └── op.go
│   │   ├── omitzero_test.go
│   │   ├── pools_amd64.go
│   │   ├── pools_amd64_test.go
│   │   ├── pools_compt.go
│   │   ├── prim/
│   │   │   └── primitives.go
│   │   ├── stream.go
│   │   ├── stream_test.go
│   │   ├── testdata_test.go
│   │   ├── vars/
│   │   │   ├── cache.go
│   │   │   ├── const.go
│   │   │   ├── errors.go
│   │   │   ├── stack.go
│   │   │   └── types.go
│   │   ├── vm/
│   │   │   ├── stbus.go
│   │   │   ├── vm.go
│   │   │   └── vm_test.go
│   │   └── x86/
│   │       ├── asm_stubs_amd64_go117.go
│   │       ├── asm_stubs_amd64_go121.go
│   │       ├── assembler_regabi_amd64.go
│   │       ├── assembler_test.go
│   │       ├── debug_go116.go
│   │       ├── debug_go117.go
│   │       └── stbus.go
│   ├── envs/
│   │   └── decode.go
│   ├── jit/
│   │   ├── arch_amd64.go
│   │   ├── asm.s
│   │   ├── assembler_amd64.go
│   │   ├── backend.go
│   │   ├── backend_test.go
│   │   └── runtime.go
│   ├── native/
│   │   ├── avx2/
│   │   │   ├── f32toa.go
│   │   │   ├── f32toa_subr.go
│   │   │   ├── f32toa_text_amd64.go
│   │   │   ├── f64toa.go
│   │   │   ├── f64toa_subr.go
│   │   │   ├── f64toa_text_amd64.go
│   │   │   ├── fastfloat_test.go
│   │   │   ├── fastint_test.go
│   │   │   ├── get_by_path.go
│   │   │   ├── get_by_path_subr.go
│   │   │   ├── get_by_path_text_amd64.go
│   │   │   ├── html_escape.go
│   │   │   ├── html_escape_subr.go
│   │   │   ├── html_escape_text_amd64.go
│   │   │   ├── i64toa.go
│   │   │   ├── i64toa_subr.go
│   │   │   ├── i64toa_text_amd64.go
│   │   │   ├── lspace.go
│   │   │   ├── lspace_subr.go
│   │   │   ├── lspace_text_amd64.go
│   │   │   ├── native_export.go
│   │   │   ├── native_test.go
│   │   │   ├── parse_with_padding.go
│   │   │   ├── parse_with_padding_subr.go
│   │   │   ├── parse_with_padding_text_amd64.go
│   │   │   ├── quote.go
│   │   │   ├── quote_subr.go
│   │   │   ├── quote_text_amd64.go
│   │   │   ├── recover_test.go
│   │   │   ├── skip_array.go
│   │   │   ├── skip_array_subr.go
│   │   │   ├── skip_array_text_amd64.go
│   │   │   ├── skip_number.go
│   │   │   ├── skip_number_subr.go
│   │   │   ├── skip_number_text_amd64.go
│   │   │   ├── skip_object.go
│   │   │   ├── skip_object_subr.go
│   │   │   ├── skip_object_text_amd64.go
│   │   │   ├── skip_one.go
│   │   │   ├── skip_one_fast.go
│   │   │   ├── skip_one_fast_subr.go
│   │   │   ├── skip_one_fast_text_amd64.go
│   │   │   ├── skip_one_subr.go
│   │   │   ├── skip_one_text_amd64.go
│   │   │   ├── u64toa.go
│   │   │   ├── u64toa_subr.go
│   │   │   ├── u64toa_text_amd64.go
│   │   │   ├── unquote.go
│   │   │   ├── unquote_subr.go
│   │   │   ├── unquote_text_amd64.go
│   │   │   ├── validate_one.go
│   │   │   ├── validate_one_subr.go
│   │   │   ├── validate_one_text_amd64.go
│   │   │   ├── validate_utf8.go
│   │   │   ├── validate_utf8_fast.go
│   │   │   ├── validate_utf8_fast_subr.go
│   │   │   ├── validate_utf8_fast_text_amd64.go
│   │   │   ├── validate_utf8_subr.go
│   │   │   ├── validate_utf8_text_amd64.go
│   │   │   ├── value.go
│   │   │   ├── value_subr.go
│   │   │   ├── value_text_amd64.go
│   │   │   ├── vnumber.go
│   │   │   ├── vnumber_subr.go
│   │   │   ├── vnumber_text_amd64.go
│   │   │   ├── vsigned.go
│   │   │   ├── vsigned_subr.go
│   │   │   ├── vsigned_text_amd64.go
│   │   │   ├── vstring.go
│   │   │   ├── vstring_subr.go
│   │   │   ├── vstring_text_amd64.go
│   │   │   ├── vunsigned.go
│   │   │   ├── vunsigned_subr.go
│   │   │   └── vunsigned_text_amd64.go
│   │   ├── dispatch_amd64.go
│   │   ├── dispatch_arm64.go
│   │   ├── f32toa.tmpl
│   │   ├── f64toa.tmpl
│   │   ├── fastfloat_test.tmpl
│   │   ├── fastint_test.tmpl
│   │   ├── get_by_path.tmpl
│   │   ├── html_escape.tmpl
│   │   ├── i64toa.tmpl
│   │   ├── lspace.tmpl
│   │   ├── native_export.tmpl
│   │   ├── native_test.tmpl
│   │   ├── neon/
│   │   │   ├── f32toa_arm64.go
│   │   │   ├── f32toa_arm64.s
│   │   │   ├── f32toa_subr_arm64.go
│   │   │   ├── f64toa_arm64.go
│   │   │   ├── f64toa_arm64.s
│   │   │   ├── f64toa_subr_arm64.go
│   │   │   ├── fastfloat_arm64_test.go
│   │   │   ├── fastint_arm64_test.go
│   │   │   ├── get_by_path_arm64.go
│   │   │   ├── get_by_path_arm64.s
│   │   │   ├── get_by_path_subr_arm64.go
│   │   │   ├── html_escape_arm64.go
│   │   │   ├── html_escape_arm64.s
│   │   │   ├── html_escape_subr_arm64.go
│   │   │   ├── i64toa_arm64.go
│   │   │   ├── i64toa_arm64.s
│   │   │   ├── i64toa_subr_arm64.go
│   │   │   ├── lspace_arm64.go
│   │   │   ├── lspace_arm64.s
│   │   │   ├── lspace_subr_arm64.go
│   │   │   ├── native_arm64_test.go
│   │   │   ├── native_export_arm64.go
│   │   │   ├── parse_with_padding_arm64.go
│   │   │   ├── parse_with_padding_arm64.s
│   │   │   ├── parse_with_padding_subr_arm64.go
│   │   │   ├── quote_arm64.go
│   │   │   ├── quote_arm64.s
│   │   │   ├── quote_subr_arm64.go
│   │   │   ├── recover_arm64_test.go
│   │   │   ├── skip_array_arm64.go
│   │   │   ├── skip_array_arm64.s
│   │   │   ├── skip_array_subr_arm64.go
│   │   │   ├── skip_number_arm64.go
│   │   │   ├── skip_number_arm64.s
│   │   │   ├── skip_number_subr_arm64.go
│   │   │   ├── skip_object_arm64.go
│   │   │   ├── skip_object_arm64.s
│   │   │   ├── skip_object_subr_arm64.go
│   │   │   ├── skip_one_arm64.go
│   │   │   ├── skip_one_arm64.s
│   │   │   ├── skip_one_fast_arm64.go
│   │   │   ├── skip_one_fast_arm64.s
│   │   │   ├── skip_one_fast_subr_arm64.go
│   │   │   ├── skip_one_subr_arm64.go
│   │   │   ├── u64toa_arm64.go
│   │   │   ├── u64toa_arm64.s
│   │   │   ├── u64toa_subr_arm64.go
│   │   │   ├── unquote_arm64.go
│   │   │   ├── unquote_arm64.s
│   │   │   ├── unquote_subr_arm64.go
│   │   │   ├── validate_one_arm64.go
│   │   │   ├── validate_one_arm64.s
│   │   │   ├── validate_one_subr_arm64.go
│   │   │   ├── validate_utf8_arm64.go
│   │   │   ├── validate_utf8_arm64.s
│   │   │   ├── validate_utf8_fast_arm64.go
│   │   │   ├── validate_utf8_fast_arm64.s
│   │   │   ├── validate_utf8_fast_subr_arm64.go
│   │   │   ├── validate_utf8_subr_arm64.go
│   │   │   ├── value_arm64.go
│   │   │   ├── value_arm64.s
│   │   │   ├── value_subr_arm64.go
│   │   │   ├── vnumber_arm64.go
│   │   │   ├── vnumber_arm64.s
│   │   │   ├── vnumber_subr_arm64.go
│   │   │   ├── vsigned_arm64.go
│   │   │   ├── vsigned_arm64.s
│   │   │   ├── vsigned_subr_arm64.go
│   │   │   ├── vstring_arm64.go
│   │   │   ├── vstring_arm64.s
│   │   │   ├── vstring_subr_arm64.go
│   │   │   ├── vunsigned_arm64.go
│   │   │   ├── vunsigned_arm64.s
│   │   │   └── vunsigned_subr_arm64.go
│   │   ├── parse_with_padding.tmpl
│   │   ├── quote.tmpl
│   │   ├── recover_test.tmpl
│   │   ├── skip_array.tmpl
│   │   ├── skip_number.tmpl
│   │   ├── skip_object.tmpl
│   │   ├── skip_one.tmpl
│   │   ├── skip_one_fast.tmpl
│   │   ├── sse/
│   │   │   ├── f32toa.go
│   │   │   ├── f32toa_subr.go
│   │   │   ├── f32toa_text_amd64.go
│   │   │   ├── f64toa.go
│   │   │   ├── f64toa_subr.go
│   │   │   ├── f64toa_text_amd64.go
│   │   │   ├── fastfloat_test.go
│   │   │   ├── fastint_test.go
│   │   │   ├── get_by_path.go
│   │   │   ├── get_by_path_subr.go
│   │   │   ├── get_by_path_text_amd64.go
│   │   │   ├── html_escape.go
│   │   │   ├── html_escape_subr.go
│   │   │   ├── html_escape_text_amd64.go
│   │   │   ├── i64toa.go
│   │   │   ├── i64toa_subr.go
│   │   │   ├── i64toa_text_amd64.go
│   │   │   ├── lspace.go
│   │   │   ├── lspace_subr.go
│   │   │   ├── lspace_text_amd64.go
│   │   │   ├── native_export.go
│   │   │   ├── native_test.go
│   │   │   ├── parse_with_padding.go
│   │   │   ├── parse_with_padding_subr.go
│   │   │   ├── parse_with_padding_text_amd64.go
│   │   │   ├── quote.go
│   │   │   ├── quote_subr.go
│   │   │   ├── quote_text_amd64.go
│   │   │   ├── recover_test.go
│   │   │   ├── skip_array.go
│   │   │   ├── skip_array_subr.go
│   │   │   ├── skip_array_text_amd64.go
│   │   │   ├── skip_number.go
│   │   │   ├── skip_number_subr.go
│   │   │   ├── skip_number_text_amd64.go
│   │   │   ├── skip_object.go
│   │   │   ├── skip_object_subr.go
│   │   │   ├── skip_object_text_amd64.go
│   │   │   ├── skip_one.go
│   │   │   ├── skip_one_fast.go
│   │   │   ├── skip_one_fast_subr.go
│   │   │   ├── skip_one_fast_text_amd64.go
│   │   │   ├── skip_one_subr.go
│   │   │   ├── skip_one_text_amd64.go
│   │   │   ├── u64toa.go
│   │   │   ├── u64toa_subr.go
│   │   │   ├── u64toa_text_amd64.go
│   │   │   ├── unquote.go
│   │   │   ├── unquote_subr.go
│   │   │   ├── unquote_text_amd64.go
│   │   │   ├── validate_one.go
│   │   │   ├── validate_one_subr.go
│   │   │   ├── validate_one_text_amd64.go
│   │   │   ├── validate_utf8.go
│   │   │   ├── validate_utf8_fast.go
│   │   │   ├── validate_utf8_fast_subr.go
│   │   │   ├── validate_utf8_fast_text_amd64.go
│   │   │   ├── validate_utf8_subr.go
│   │   │   ├── validate_utf8_text_amd64.go
│   │   │   ├── value.go
│   │   │   ├── value_subr.go
│   │   │   ├── value_text_amd64.go
│   │   │   ├── vnumber.go
│   │   │   ├── vnumber_subr.go
│   │   │   ├── vnumber_text_amd64.go
│   │   │   ├── vsigned.go
│   │   │   ├── vsigned_subr.go
│   │   │   ├── vsigned_text_amd64.go
│   │   │   ├── vstring.go
│   │   │   ├── vstring_subr.go
│   │   │   ├── vstring_text_amd64.go
│   │   │   ├── vunsigned.go
│   │   │   ├── vunsigned_subr.go
│   │   │   └── vunsigned_text_amd64.go
│   │   ├── traceback_test.mock_tmpl
│   │   ├── types/
│   │   │   └── types.go
│   │   ├── u64toa.tmpl
│   │   ├── unquote.tmpl
│   │   ├── validate_one.tmpl
│   │   ├── validate_utf8.tmpl
│   │   ├── validate_utf8_fast.tmpl
│   │   ├── value.tmpl
│   │   ├── vnumber.tmpl
│   │   ├── vsigned.tmpl
│   │   ├── vstring.tmpl
│   │   └── vunsigned.tmpl
│   ├── optcaching/
│   │   ├── asm.s
│   │   └── fcache.go
│   ├── resolver/
│   │   ├── asm.s
│   │   ├── fields.go
│   │   ├── resolver.go
│   │   └── resolver_test.go
│   ├── rt/
│   │   ├── asm_amd64.s
│   │   ├── asm_compat.s
│   │   ├── assertI2I.go
│   │   ├── base64_amd64.go
│   │   ├── base64_compat.go
│   │   ├── fastconv.go
│   │   ├── fastconv_test.go
│   │   ├── fastmem.go
│   │   ├── fastvalue.go
│   │   ├── gcwb.go
│   │   ├── gcwb_legacy.go
│   │   ├── gotype_go126.go
│   │   ├── gotype_legacy.go
│   │   ├── growslice.go
│   │   ├── growslice_legacy.go
│   │   ├── int48.go
│   │   ├── map_go124.go
│   │   ├── map_go126.go
│   │   ├── map_legacy.go
│   │   ├── maptype_indirectelem_go126.go
│   │   ├── maptype_indirectelem_legacy.go
│   │   ├── pool.go
│   │   ├── pool_test.go
│   │   ├── stubs.go
│   │   ├── stubs_test.go
│   │   ├── table.go
│   │   └── types.go
│   └── utils/
│       └── skip.go
├── issue_test/
│   ├── common_test.go
│   ├── go.mod
│   ├── go.sum
│   ├── hugestruct_test.go
│   ├── issue100_test.go
│   ├── issue101_test.go
│   ├── issue107_test.go
│   ├── issue108_test.go
│   ├── issue112_test.go
│   ├── issue113_test.go
│   ├── issue115_test.go
│   ├── issue119_test.go
│   ├── issue123_test.go
│   ├── issue128_test.go
│   ├── issue138_test.go
│   ├── issue141_test.go
│   ├── issue144_test.go
│   ├── issue16_test.go
│   ├── issue182_test.go
│   ├── issue186_test.go
│   ├── issue195_test.go
│   ├── issue206_test.go
│   ├── issue213_test.go
│   ├── issue242_test.go
│   ├── issue248_test.go
│   ├── issue258_test.go
│   ├── issue263_test.go
│   ├── issue273_test.go
│   ├── issue27_test.go
│   ├── issue293_test.go
│   ├── issue379_test.go
│   ├── issue381_test.go
│   ├── issue390_test.go
│   ├── issue39_test.go
│   ├── issue3_test.go
│   ├── issue403_test.go
│   ├── issue406_test.go
│   ├── issue437_test.go
│   ├── issue45_test.go
│   ├── issue460_test.go
│   ├── issue465_test.go
│   ├── issue491_test.go
│   ├── issue507_test.go
│   ├── issue539_test.go
│   ├── issue58_test.go
│   ├── issue5_test.go
│   ├── issue600_test.go
│   ├── issue634_test.go
│   ├── issue670_test.go
│   ├── issue67_test.go
│   ├── issue692_test.go
│   ├── issue716_test.go
│   ├── issue739_test.go
│   ├── issue744_test.go
│   ├── issue747_test.go
│   ├── issue750_test.go
│   ├── issue755_test.go
│   ├── issue758_test.go
│   ├── issue762_test.go
│   ├── issue76_test.go
│   ├── issue772_test.go
│   ├── issue774_test.go
│   ├── issue777_test.go
│   ├── issue7_test.go
│   ├── issue805_test.go
│   ├── issue811_test.go
│   ├── issue824_test.go
│   ├── issue825_test.go
│   ├── issue827_test.go
│   ├── issue829_test.go
│   ├── issue82_test.go
│   ├── issue834_test.go
│   ├── issue83_test.go
│   ├── issue860_test.go
│   ├── issue8_test.go
│   ├── issue90_test.go
│   ├── issue912_test.go
│   ├── issue916_test.go
│   ├── issue923_test.go
│   ├── issue93_test.go
│   ├── issue98_test.go
│   ├── issue_recurse_test.go
│   ├── plugin/
│   │   └── main.go
│   ├── plugin_test.go
│   ├── pretouch_test.go
│   ├── race_test_go
│   └── testmain_test.go
├── licenses/
│   ├── LICENSE-Drachennest
│   ├── LICENSE-eisel_lemire
│   ├── LICENSE-golang
│   ├── LICENSE-golang-asm
│   ├── LICENSE-simdjson
│   └── LICENSE-yyjson
├── loader/
│   ├── funcdata.go
│   ├── funcdata_compat.go
│   ├── funcdata_go117.go
│   ├── funcdata_go118.go
│   ├── funcdata_go120.go
│   ├── funcdata_go121.go
│   ├── funcdata_go123.go
│   ├── funcdata_go126.go
│   ├── funcdata_legacy.go
│   ├── go.mod
│   ├── go.sum
│   ├── internal/
│   │   ├── abi/
│   │   │   ├── abi.go
│   │   │   ├── abi_amd64.go
│   │   │   ├── abi_legacy_amd64.go
│   │   │   ├── abi_regabi_amd64.go
│   │   │   └── stubs.go
│   │   ├── iasm/
│   │   │   ├── expr/
│   │   │   │   ├── ast.go
│   │   │   │   ├── errors.go
│   │   │   │   ├── ops.go
│   │   │   │   ├── parser.go
│   │   │   │   ├── parser_test.go
│   │   │   │   ├── pools.go
│   │   │   │   ├── term.go
│   │   │   │   └── utils.go
│   │   │   ├── obj/
│   │   │   │   ├── macho.go
│   │   │   │   ├── macho_test.go
│   │   │   │   └── obj.go
│   │   │   ├── sync.sh
│   │   │   ├── trim.py
│   │   │   └── x86_64/
│   │   │       ├── arch.go
│   │   │       ├── asm.s
│   │   │       ├── eface.go
│   │   │       ├── encodings.go
│   │   │       ├── instructions.go
│   │   │       ├── instructions_table.go
│   │   │       ├── instructions_test.go
│   │   │       ├── operands.go
│   │   │       ├── pools.go
│   │   │       ├── program.go
│   │   │       ├── program_test.go
│   │   │       ├── registers.go
│   │   │       └── utils.go
│   │   └── rt/
│   │       ├── fastmem.go
│   │       ├── fastvalue.go
│   │       └── stackmap.go
│   ├── loader.go
│   ├── loader_go117_test.go
│   ├── loader_latest.go
│   ├── mmap_unix.go
│   ├── mmap_windows.go
│   ├── moduledata.go
│   ├── pcdata.go
│   ├── register.go
│   ├── register_tango.go
│   ├── register_test.go
│   ├── stubs.go
│   ├── wrapper.go
│   └── wrapper_test.go
├── native/
│   ├── atof_eisel_lemire.h
│   ├── atof_native.h
│   ├── f32toa.c
│   ├── f64toa.c
│   ├── fastint.h
│   ├── get_by_path.c
│   ├── html_escape.c
│   ├── i64toa.c
│   ├── lspace.c
│   ├── lspace.h
│   ├── native.h
│   ├── parse_with_padding.c
│   ├── parsing.h
│   ├── quote.c
│   ├── scanning.h
│   ├── simd.h
│   ├── skip_array.c
│   ├── skip_number.c
│   ├── skip_object.c
│   ├── skip_one.c
│   ├── skip_one_fast.c
│   ├── tab.h
│   ├── test/
│   │   ├── xassert.h
│   │   └── xprintf.h
│   ├── types.h
│   ├── u64toa.c
│   ├── unittest/
│   │   ├── test_fastfint.c
│   │   └── test_to_lower.c
│   ├── unquote.c
│   ├── utf8.h
│   ├── utils.h
│   ├── validate_one.c
│   ├── validate_utf8.c
│   ├── validate_utf8_fast.c
│   ├── value.c
│   ├── vnumber.c
│   ├── vsigned.c
│   ├── vstring.c
│   ├── vstring.h
│   └── vunsigned.c
├── option/
│   └── option.go
├── rawmessage.go
├── rfc_test.go
├── scripts/
│   ├── bench-arm.sh
│   ├── bench.py
│   ├── bench.sh
│   ├── build-arm.sh
│   ├── build-x86.sh
│   ├── check_branch_name.sh
│   ├── fuzz.sh
│   ├── go_flags.sh
│   ├── qemu.sh
│   ├── test_pcsp.py
│   └── test_race.sh
├── search_test.go
├── sonic.go
├── testdata/
│   ├── JSONTestSuite/
│   │   ├── LICENSE
│   │   └── README.md
│   ├── small.go
│   ├── twitter.go
│   ├── twitter.json
│   └── twitterescaped.json
├── tools/
│   └── asm2arm/
│       ├── arm.py
│       └── requirements.txt
├── unquote/
│   ├── unquote.go
│   └── unquote_fallback.go
└── utf8/
    ├── utf8.go
    ├── utf8_fallback.go
    ├── utf8_native_test.go
    └── utf8_test.go

================================================
FILE CONTENTS
================================================

================================================
FILE: .codespellrc
================================================
[codespell]
# ignore test files, go project names, binary files via `skip` and special var/regex via `ignore-words`
skip = fuzz,*_test.tmpl,testdata,*_test.go,go.mod,go.sum,*.gz
ignore-words = .github/workflows/.ignore_words
check-filenames = true


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**

A clear and concise description of what the bug is.

**To Reproduce**

Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**

A clear and concise description of what you expected to happen.

**Screenshots**

If applicable, add screenshots to help explain your problem.

**Sonic version:**

Please provide the version of Sonic you are using.

**Environment:**

The output of `go env`.

**Additional context**

Add any other context about the problem here.


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**

A clear and concise description of what you want to happen.

**Describe alternatives you've considered**

A clear and concise description of any alternative solutions or features you've considered.

**Additional context**

Add any other context or screenshots about the feature request here.


================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
#### What type of PR is this?
<!--
Add one of the following kinds:

build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
docs: Documentation only changes
feat: A new feature
optimize: A new optimization
fix: A bug fix
perf: A code change that improves performance
refactor: A code change that neither fixes a bug nor adds a feature
style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc)
test: Adding missing tests or correcting existing tests
chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
-->

#### Check the PR title.
<!--
The description of the title will be attached in Release Notes, 
so please describe it from user-oriented, what this PR does / why we need it.
Please check your PR title with the below requirements:
-->
- [ ] This PR title match the format: \<type\>(optional scope): \<description\>
- [ ] The description of this PR title is user-oriented and clear enough for others to understand.
- [ ] Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. [User docs repo](https://github.com/cloudwego/cloudwego.github.io)


#### (Optional) Translate the PR title into Chinese.


#### (Optional) More detailed description for this PR(en: English/zh: Chinese).
<!--
Provide more detailed info for review(e.g., it's recommended to provide perf data if this is a perf type PR).
-->
en: 
zh(optional): 

#### (Optional) Which issue(s) this PR fixes:
<!--
Automatically closes linked issue when PR is merged.
Eg: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

#### (optional) The PR that updates user documentation:
<!--
If the current PR requires user awareness at the usage level, please submit a PR to update user docs. [User docs repo](https://github.com/cloudwego/cloudwego.github.io)
-->

================================================
FILE: .github/workflows/.ignore_words
================================================
socio-economic
nd
regArgs
oders
ure
alse


================================================
FILE: .github/workflows/benchmark.yml
================================================
name: Benchmark

on: pull_request

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, ubuntu-24.04-arm]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Clear repository
        run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE

      - uses: actions/checkout@v2

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: 1.22

      - uses: actions/cache@v4
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-

      - name: Benchmark Target
        continue-on-error: true
        run: |
          export SONIC_NO_ASYNC_GC=1
          go test -run ^$ -count=20 -benchmem -bench 'BenchmarkDecoder_(Generic|Binding)_Sonic' ./decoder >> /var/tmp/sonic_bench_target_${{ github.run_id }}.out
          go test -run ^$ -count=20 -benchmem -bench 'BenchmarkEncoder_(Generic|Binding)_Sonic' ./encoder >> /var/tmp/sonic_bench_target_${{ github.run_id }}.out
          go test -run ^$ -count=20 -benchmem -bench 'Benchmark(Get|Set)One_Sonic|BenchmarkParseSeven_Sonic' ./ast >> /var/tmp/sonic_bench_target_${{ github.run_id }}.out

      - name: Clear repository
        run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE

      - name: Checkout main
        uses: actions/checkout@v2
        with:
          ref: main
      
      - name: Benchmark main
        continue-on-error: true
        run: |
          export SONIC_NO_ASYNC_GC=1
          go test -run ^$ -count=20 -benchmem -bench 'BenchmarkDecoder_(Generic|Binding)_Sonic' ./decoder >> /var/tmp/sonic_bench_main_${{ github.run_id }}.out
          go test -run ^$ -count=20 -benchmem -bench 'BenchmarkEncoder_(Generic|Binding)_Sonic' ./encoder >> /var/tmp/sonic_bench_main_${{ github.run_id }}.out
          go test -run ^$ -count=20 -benchmem -bench 'Benchmark(Get|Set)One_Sonic|BenchmarkParseSeven_Sonic' ./ast >> /var/tmp/sonic_bench_main_${{ github.run_id }}.out

      - name: Diff bench
        continue-on-error: true
        run: |
          ./scripts/bench.py -t 0.20 -d /var/tmp/sonic_bench_target_${{ github.run_id }}.out,/var/tmp/sonic_bench_main_${{ github.run_id }}.out x


================================================
FILE: .github/workflows/compatibility_test-windows.yml
================================================
name: Compatibility Test Windows-X64

on: pull_request

jobs:
  build:
    strategy:
      matrix:
        go-version: [1.18.x, 1.21.x, 1.25.x]
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go-version }}

      - uses: actions/cache@v4
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-

      - name: main
        run: |
          set GOMAXPROCS=4
          go test -race ./

      - name: ast
        run: |
          set GOMAXPROCS=4
          go test -race ./ast

      - name: external
        run: |
          cd ./external_jsonlib_test
          set GOMAXPROCS=4
          go test -race ./...


================================================
FILE: .github/workflows/compatibility_test.yml
================================================
name: Compatibility Test Linux-X64|ARM & macOS-ARM

on: pull_request

jobs:
  build:
    strategy:
      matrix:
        go-version: [1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x, 1.23.x, 1.24.x, 1.25.x]
        os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Clear repository
        run: |
          if [ "${{ runner.os }}" = "Linux" ]; then
            sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE
          else
            rm -rf $GITHUB_WORKSPACE && mkdir -p $GITHUB_WORKSPACE
          fi

      - uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go-version }}

      - uses: actions/cache@v4
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-

      - name: main
        run: go test -race -gcflags="all=-l" ./

      - name: decoder
        run: go test -race -gcflags="all=-l" ./decoder

      - name: encoder
        run: go test -race -gcflags="all=-l" ./encoder

      - name: ast
        run: go test -race -gcflags="all=-l" ./ast


================================================
FILE: .github/workflows/fuzzing.yml
================================================
name: Fuzz Test Linux-X64

on: pull_request

jobs:
  build:
    strategy:
        max-parallel: 2
        matrix:
          mode: [run, runopt]
          os: [ubuntu-latest, ubuntu-24.04-arm]
          exclude:
            - os: ubuntu-24.04-arm
              mode: runopt

    runs-on: ${{ matrix.os }}
    steps:
      - name: Clear repository
        run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE

      - uses: actions/checkout@v2

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: 1.20.x

      - uses: actions/cache@v4
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-

      - name: Fuzz sonic
        run: ./scripts/fuzz.sh ${{ matrix.mode }}



================================================
FILE: .github/workflows/lint.yml
================================================
name: Lint

on: pull_request

jobs:
  misc:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: spell check
        uses: codespell-project/actions-codespell@v2
        with:
          skip: ./loader/internal/iasm/obj/macho.go,./loader/internal/iasm/x86_64/encodings.go,./loader/internal/iasm/x86_64/program.go,./loader/internal/iasm/expr/ast.go,./loader/internal/iasm/expr/errors.go


================================================
FILE: .github/workflows/test-arm64.yml
================================================

name: Unit Test

on: pull_request

jobs:
  build:
    permissions:
      contents: read
      id-token: write

    strategy:
      matrix:
        go-version: [1.20.x, 1.22.x, 1.25.x]
        runner_arch: [ubuntu-24.04-arm, macos-latest]

    runs-on: ${{ matrix.runner_arch }}
    
    steps:
      - name: Clear repository
        run: rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE
      
      - uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go-version }}
          cache: true

      - name: Cache Go modules
        uses: actions/cache@v4
        with:
          path: |
            ~/go/pkg/mod
            ${{ github.workspace }}/go.sum
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

      - name: Unit Test
        run: |
          GOMAXPROCS=4 go test -race -covermode=atomic -coverprofile=coverage.txt $(go list ./... | grep -v -E 'loader|jit|avx|x86|sse')

      - name: Data Race
        run: |
          ./scripts/test_race.sh

      - name: Issue Test
        run: GOMAXPROCS=4 go test -race ./issue_test

      - name: Generic Test
        run: GOMAXPROCS=4 go test -race ./generic_test

      - name: Codecov
        uses: codecov/codecov-action@v5
        with:
          use_oidc: true
          files: ./coverage.txt
          flags: arm,${{ matrix.runner_arch }}
          fail_ci_if_error: false


================================================
FILE: .github/workflows/test-x86.yml
================================================

name: Unit Test

on: pull_request

jobs:
  build:
    permissions:
      contents: read
      id-token: write

    strategy:
      matrix:
        go-version: [1.18.x, 1.21.x, 1.25.x]
        runner_arch: [ubuntu-latest]

    runs-on: ${{ matrix.runner_arch }}
    
    steps:
      - name: Clear repository
        run: rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE
      - uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go-version }}
          cache: true

      - name: Cache Go modules
        uses: actions/cache@v4
        with:
          path: |
            ~/go/pkg/mod
            ${{ github.workspace }}/go.sum
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

      - name: Unit Test JIT
        run: |
          GOMAXPROCS=4 go test -race -covermode=atomic -coverprofile=coverage-jit.txt ./...

      - name: Unit Test JIT PCSP
        run: |
          GOMAXPROCS=4 go test  -v ./internal/decoder/jitdec 

      - name: Unit Test VM
        run: |
          SONIC_USE_OPTDEC=1 SONIC_USE_FASTMAP=1 SONIC_ENCODER_USE_VM=1  GOMAXPROCS=4 go test -race -covermode=atomic -coverprofile=coverage-vm.txt ./...
    
      - name: Loader Test
        run: |
          cd ./loader
          go test -race ./...  
  
      - name: Data Race
        run: |
          ./scripts/test_race.sh

      - name: Issue Test
        run: GOMAXPROCS=4 go test -race ./issue_test

      - name: PCSP Test
        env:
          GOVERSION: ${{ matrix.go-version }}
        run: python3 ./scripts/test_pcsp.py

      - name: Generic Test JIT
        run: GOMAXPROCS=4 go test -race ./generic_test

      - name: Generic Test VM
        run: GOMAXPROCS=4 SONIC_USE_OPTDEC=1 SONIC_USE_FASTMAP=1 SONIC_ENCODER_USE_VM=1 go test -v -race ./generic_test

      - name: Codecov
        uses: codecov/codecov-action@v5
        with:
          use_oidc: true
          files: ./coverage-jit.txt,./coverage-vm.txt
          flags: x86,${{ matrix.runner_arch }}
          fail_ci_if_error: false


================================================
FILE: .gitignore
================================================
*.o
*.swp
*.swm
*.swn
*.a
*.so
_obj
_test
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.exe~
*.test
*.prof
*.rar
*.zip
*.gz
*.psd
*.bmd
*.cfg
*.pptx
*.log
*nohup.out
*settings.pyc
*.sublime-project
*.sublime-workspace
.DS_Store
/.idea/
/.vscode/
/output/
/vendor/
/Gopkg.lock
/Gopkg.toml
coverage.html
coverage.out
coverage.xml
junit.xml
*.profile
*.svg
*.out
ast/test.out
ast/bench.sh

!testdata/**/*.json.gz
fuzz/testdata
*__debug_bin*
*pprof
*coverage.txt
.venv/
tools/venv/*


================================================
FILE: .gitmodules
================================================
[submodule "cloudwego"]
	path = tools/asm2asm
	url = https://github.com/cloudwego/asm2asm.git
[submodule "tools/simde"]
	path = tools/simde
	url = https://github.com/simd-everywhere/simde.git
[submodule "fuzz/go-fuzz-corpus"]
	path = fuzz/go-fuzz-corpus
	url = https://github.com/dvyukov/go-fuzz-corpus.git


================================================
FILE: .licenserc.yaml
================================================
header:
  license:
    spdx-id: Apache-2.0
    copyright-owner: ByteDance Inc.

  paths:
    - '**/*.go'
    - '**/*.s'

  paths-ignore:
    - 'ast/asm.s'                                   # empty file
    - 'decoder/asm.s'                               # empty file
    - 'encoder/asm.s'                               # empty file
    - 'internal/caching/asm.s'                      # empty file
    - 'internal/jit/asm.s'                          # empty file
    - 'internal/native/avx/native_amd64.s'          # auto-generated by asm2asm
    - 'internal/native/avx/native_subr_amd64.go'    # auto-generated by asm2asm
    - 'internal/native/avx2/native_amd64.s'         # auto-generated by asm2asm
    - 'internal/native/avx2/native_subr_amd64.go'   # auto-generated by asm2asm
    - 'internal/resolver/asm.s'                     # empty file
    - 'internal/rt/asm.s'                           # empty file
    - 'internal/loader/asm.s'                       # empty file

  comment: on-failure

================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
  and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
  overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
  advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
  address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
  professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
wudi.daniel@bytedance.com.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior,  harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.


================================================
FILE: CONTRIBUTING.md
================================================
# How to Contribute

## Your First Pull Request
We use GitHub for our codebase. You can start by reading [How To Pull Request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests).

## Without Semantic Versioning
We keep the stable code in branch `main` like `golang.org/x`. Development base on branch `develop`. We promise the **Forward Compatibility** by adding new package directory with suffix `v2/v3` when code has break changes.

## Branch Organization
We use [git-flow](https://nvie.com/posts/a-successful-git-branching-model/) as our branch organization, as known as [FDD](https://en.wikipedia.org/wiki/Feature-driven_development)


## Bugs
### 1. How to Find Known Issues
We are using [Github Issues](https://github.com/bytedance/sonic/issues) for our public bugs. We keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new task, try to make sure your problem doesn’t already exist.

### 2. Reporting New Issues
Providing a reduced test code is a recommended way for reporting issues. Then can be placed in:
- Just in issues
- [Golang Playground](https://play.golang.org/)

### 3. Security Bugs
Please do not report the safe disclosure of bugs to public issues. Contact us by [Support Email](mailto:sonic@bytedance.com)

## How to Get in Touch
- [Email](mailto:wudi.daniel@bytedance.com)

## Submit a Pull Request
Before you submit your Pull Request (PR) consider the following guidelines:
1. Search [GitHub](https://github.com/bytedance/sonic/pulls) for an open or closed PR that relates to your submission. You don't want to duplicate existing efforts.
2. Be sure that an issue describes the problem you're fixing, or documents the design for the feature you'd like to add. Discussing the design upfront helps to ensure that we're ready to accept your work.
3. [Fork](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) the bytedance/sonic repo.
4. In your forked repository, make your changes in a new git branch:
    ```
    git checkout -b bugfix/security_bug develop
    ```
5. Create your patch, including appropriate test cases.
6. Follow our [Style Guides](#code-style-guides).
7. Commit your changes using a descriptive commit message that follows [AngularJS Git Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit).
   Adherence to these conventions is necessary because release notes will be automatically generated from these messages.
8. Push your branch to GitHub:
    ```
    git push origin bugfix/security_bug
    ```
9. In GitHub, send a pull request to `sonic:main`

Note: you must use one of `optimize/feature/bugfix/doc/ci/test/refactor` following a slash(`/`) as the branch prefix.

Your pr title and commit message should follow https://www.conventionalcommits.org/.

## Contribution Prerequisites
- Our development environment keeps up with [Go Official](https://golang.org/project/).
- You need fully checking with lint tools before submit your pull request. [gofmt](https://golang.org/pkg/cmd/gofmt/) & [golangci-lint](https://github.com/golangci/golangci-lint)
- You are familiar with [Github](https://github.com) 
- Maybe you need familiar with [Actions](https://github.com/features/actions)(our default workflow tool).

## Code Style Guides
See [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments).

Good resources:
- [Effective Go](https://golang.org/doc/effective_go)
- [Pingcap General advice](https://pingcap.github.io/style-guide/general.html)
- [Uber Go Style Guide](https://github.com/uber-go/guide/blob/master/style.md)


================================================
FILE: CREDITS
================================================


================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: README.md
================================================
# Sonic

English | [中文](README_ZH_CN.md)

A blazingly fast JSON serializing &amp; deserializing library, accelerated by JIT (just-in-time compiling) and SIMD (single-instruction-multiple-data).

## Requirement

- Go: 1.18~1.25
  - Notice: Go1.24.0 is not supported due to the [issue](https://github.com/golang/go/issues/71672), please use higher go version or add build tag `--ldflags="-checklinkname=0"` 
- OS: Linux / MacOS / Windows
- CPU: AMD64 / (ARM64, need go1.20 above)

## Features

- Runtime object binding without code generation
- Complete APIs for JSON value manipulation
- Fast, fast, fast!

## APIs

see [go.dev](https://pkg.go.dev/github.com/bytedance/sonic)

## Benchmarks

For **all sizes** of json and **all scenarios** of usage, **Sonic performs best**.

- [Medium](https://github.com/bytedance/sonic/blob/main/decoder/testdata_test.go#L19) (13KB, 300+ key, 6 layers)

```powershell
goversion: 1.17.1
goos: darwin
goarch: amd64
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkEncoder_Generic_Sonic-16                      32393 ns/op         402.40 MB/s       11965 B/op          4 allocs/op
BenchmarkEncoder_Generic_Sonic_Fast-16                 21668 ns/op         601.57 MB/s       10940 B/op          4 allocs/op
BenchmarkEncoder_Generic_JsonIter-16                   42168 ns/op         309.12 MB/s       14345 B/op        115 allocs/op
BenchmarkEncoder_Generic_GoJson-16                     65189 ns/op         199.96 MB/s       23261 B/op         16 allocs/op
BenchmarkEncoder_Generic_StdLib-16                    106322 ns/op         122.60 MB/s       49136 B/op        789 allocs/op
BenchmarkEncoder_Binding_Sonic-16                       6269 ns/op        2079.26 MB/s       14173 B/op          4 allocs/op
BenchmarkEncoder_Binding_Sonic_Fast-16                  5281 ns/op        2468.16 MB/s       12322 B/op          4 allocs/op
BenchmarkEncoder_Binding_JsonIter-16                   20056 ns/op         649.93 MB/s        9488 B/op          2 allocs/op
BenchmarkEncoder_Binding_GoJson-16                      8311 ns/op        1568.32 MB/s        9481 B/op          1 allocs/op
BenchmarkEncoder_Binding_StdLib-16                     16448 ns/op         792.52 MB/s        9479 B/op          1 allocs/op
BenchmarkEncoder_Parallel_Generic_Sonic-16              6681 ns/op        1950.93 MB/s       12738 B/op          4 allocs/op
BenchmarkEncoder_Parallel_Generic_Sonic_Fast-16         4179 ns/op        3118.99 MB/s       10757 B/op          4 allocs/op
BenchmarkEncoder_Parallel_Generic_JsonIter-16           9861 ns/op        1321.84 MB/s       14362 B/op        115 allocs/op
BenchmarkEncoder_Parallel_Generic_GoJson-16            18850 ns/op         691.52 MB/s       23278 B/op         16 allocs/op
BenchmarkEncoder_Parallel_Generic_StdLib-16            45902 ns/op         283.97 MB/s       49174 B/op        789 allocs/op
BenchmarkEncoder_Parallel_Binding_Sonic-16              1480 ns/op        8810.09 MB/s       13049 B/op          4 allocs/op
BenchmarkEncoder_Parallel_Binding_Sonic_Fast-16         1209 ns/op        10785.23 MB/s      11546 B/op          4 allocs/op
BenchmarkEncoder_Parallel_Binding_JsonIter-16           6170 ns/op        2112.58 MB/s        9504 B/op          2 allocs/op
BenchmarkEncoder_Parallel_Binding_GoJson-16             3321 ns/op        3925.52 MB/s        9496 B/op          1 allocs/op
BenchmarkEncoder_Parallel_Binding_StdLib-16             3739 ns/op        3486.49 MB/s        9480 B/op          1 allocs/op

BenchmarkDecoder_Generic_Sonic-16                      66812 ns/op         195.10 MB/s       57602 B/op        723 allocs/op
BenchmarkDecoder_Generic_Sonic_Fast-16                 54523 ns/op         239.07 MB/s       49786 B/op        313 allocs/op
BenchmarkDecoder_Generic_StdLib-16                    124260 ns/op         104.90 MB/s       50869 B/op        772 allocs/op
BenchmarkDecoder_Generic_JsonIter-16                   91274 ns/op         142.81 MB/s       55782 B/op       1068 allocs/op
BenchmarkDecoder_Generic_GoJson-16                     88569 ns/op         147.17 MB/s       66367 B/op        973 allocs/op
BenchmarkDecoder_Binding_Sonic-16                      32557 ns/op         400.38 MB/s       28302 B/op        137 allocs/op
BenchmarkDecoder_Binding_Sonic_Fast-16                 28649 ns/op         455.00 MB/s       24999 B/op         34 allocs/op
BenchmarkDecoder_Binding_StdLib-16                    111437 ns/op         116.97 MB/s       10576 B/op        208 allocs/op
BenchmarkDecoder_Binding_JsonIter-16                   35090 ns/op         371.48 MB/s       14673 B/op        385 allocs/op
BenchmarkDecoder_Binding_GoJson-16                     28738 ns/op         453.59 MB/s       22039 B/op         49 allocs/op
BenchmarkDecoder_Parallel_Generic_Sonic-16             12321 ns/op        1057.91 MB/s       57233 B/op        723 allocs/op
BenchmarkDecoder_Parallel_Generic_Sonic_Fast-16        10644 ns/op        1224.64 MB/s       49362 B/op        313 allocs/op
BenchmarkDecoder_Parallel_Generic_StdLib-16            57587 ns/op         226.35 MB/s       50874 B/op        772 allocs/op
BenchmarkDecoder_Parallel_Generic_JsonIter-16          38666 ns/op         337.12 MB/s       55789 B/op       1068 allocs/op
BenchmarkDecoder_Parallel_Generic_GoJson-16            30259 ns/op         430.79 MB/s       66370 B/op        974 allocs/op
BenchmarkDecoder_Parallel_Binding_Sonic-16              5965 ns/op        2185.28 MB/s       27747 B/op        137 allocs/op
BenchmarkDecoder_Parallel_Binding_Sonic_Fast-16         5170 ns/op        2521.31 MB/s       24715 B/op         34 allocs/op
BenchmarkDecoder_Parallel_Binding_StdLib-16            27582 ns/op         472.58 MB/s       10576 B/op        208 allocs/op
BenchmarkDecoder_Parallel_Binding_JsonIter-16          13571 ns/op         960.51 MB/s       14685 B/op        385 allocs/op
BenchmarkDecoder_Parallel_Binding_GoJson-16            10031 ns/op        1299.51 MB/s       22111 B/op         49 allocs/op

BenchmarkGetOne_Sonic-16                                3276 ns/op        3975.78 MB/s          24 B/op          1 allocs/op
BenchmarkGetOne_Gjson-16                                9431 ns/op        1380.81 MB/s           0 B/op          0 allocs/op
BenchmarkGetOne_Jsoniter-16                            51178 ns/op         254.46 MB/s       27936 B/op        647 allocs/op
BenchmarkGetOne_Parallel_Sonic-16                      216.7 ns/op       60098.95 MB/s          24 B/op          1 allocs/op
BenchmarkGetOne_Parallel_Gjson-16                       1076 ns/op        12098.62 MB/s          0 B/op          0 allocs/op
BenchmarkGetOne_Parallel_Jsoniter-16                   17741 ns/op         734.06 MB/s       27945 B/op        647 allocs/op
BenchmarkSetOne_Sonic-16                               9571 ns/op         1360.61 MB/s        1584 B/op         17 allocs/op
BenchmarkSetOne_Sjson-16                               36456 ns/op         357.22 MB/s       52180 B/op          9 allocs/op
BenchmarkSetOne_Jsoniter-16                            79475 ns/op         163.86 MB/s       45862 B/op        964 allocs/op
BenchmarkSetOne_Parallel_Sonic-16                      850.9 ns/op       15305.31 MB/s        1584 B/op         17 allocs/op
BenchmarkSetOne_Parallel_Sjson-16                      18194 ns/op         715.77 MB/s       52247 B/op          9 allocs/op
BenchmarkSetOne_Parallel_Jsoniter-16                   33560 ns/op         388.05 MB/s       45892 B/op        964 allocs/op
BenchmarkLoadNode/LoadAll()-16                         11384 ns/op        1143.93 MB/s        6307 B/op         25 allocs/op
BenchmarkLoadNode_Parallel/LoadAll()-16                 5493 ns/op        2370.68 MB/s        7145 B/op         25 allocs/op
BenchmarkLoadNode/Interface()-16                       17722 ns/op         734.85 MB/s       13323 B/op         88 allocs/op
BenchmarkLoadNode_Parallel/Interface()-16              10330 ns/op        1260.70 MB/s       15178 B/op         88 allocs/op
```

- [Small](https://github.com/bytedance/sonic/blob/main/testdata/small.go) (400B, 11 keys, 3 layers)
![small benchmarks](./docs/imgs/bench-small.png)
- [Large](https://github.com/bytedance/sonic/blob/main/testdata/twitter.json) (635KB, 10000+ key, 6 layers)
![large benchmarks](./docs/imgs/bench-large.png)

See [bench.sh](https://github.com/bytedance/sonic/blob/main/scripts/bench.sh) for benchmark codes.

## How it works

See [INTRODUCTION.md](./docs/INTRODUCTION.md).

## Usage

### Marshal/Unmarshal

Default behaviors are mostly consistent with `encoding/json`, except HTML escaping form (see [Escape HTML](https://github.com/bytedance/sonic/blob/main/README.md#escape-html)) and `SortKeys` feature (optional support see [Sort Keys](https://github.com/bytedance/sonic/blob/main/README.md#sort-keys)) that is **NOT** in conformity to [RFC8259](https://datatracker.ietf.org/doc/html/rfc8259).

 ```go
import "github.com/bytedance/sonic"

var data YourSchema
// Marshal
output, err := sonic.Marshal(&data)
// Unmarshal
err := sonic.Unmarshal(output, &data)
 ```

### Streaming IO

Sonic supports decoding json from `io.Reader` or encoding objects into `io.Writer`, aims at handling multiple values as well as reducing memory consumption.

- encoder

```go
var o1 = map[string]interface{}{
    "a": "b",
}
var o2 = 1
var w = bytes.NewBuffer(nil)
var enc = sonic.ConfigDefault.NewEncoder(w)
enc.Encode(o1)
enc.Encode(o2)
fmt.Println(w.String())
// Output:
// {"a":"b"}
// 1
```

- decoder

```go
var o =  map[string]interface{}{}
var r = strings.NewReader(`{"a":"b"}{"1":"2"}`)
var dec = sonic.ConfigDefault.NewDecoder(r)
dec.Decode(&o)
dec.Decode(&o)
fmt.Printf("%+v", o)
// Output:
// map[1:2 a:b]
```

### Use Number/Use Int64

 ```go
import "github.com/bytedance/sonic/decoder"

var input = `1`
var data interface{}

// default float64
dc := decoder.NewDecoder(input)
dc.Decode(&data) // data == float64(1)
// use json.Number
dc = decoder.NewDecoder(input)
dc.UseNumber()
dc.Decode(&data) // data == json.Number("1")
// use int64
dc = decoder.NewDecoder(input)
dc.UseInt64()
dc.Decode(&data) // data == int64(1)

root, err := sonic.GetFromString(input)
// Get json.Number
jn := root.Number()
jm := root.InterfaceUseNumber().(json.Number) // jn == jm
// Get float64
fn := root.Float64()
fm := root.Interface().(float64) // jn == jm
 ```

### Sort Keys

On account of the performance loss from sorting (roughly 10%), sonic doesn't enable this feature by default. If your component depends on it to work (like [zstd](https://github.com/facebook/zstd)), Use it like this:

```go
import "github.com/bytedance/sonic"
import "github.com/bytedance/sonic/encoder"

// Binding map only
m := map[string]interface{}{}
v, err := encoder.Encode(m, encoder.SortMapKeys)

// Or ast.Node.SortKeys() before marshal
var root := sonic.Get(JSON)
err := root.SortKeys()
```

### Escape HTML

On account of the performance loss (roughly 15%), sonic doesn't enable this feature by default. You can use `encoder.EscapeHTML` option to open this feature (align with `encoding/json.HTMLEscape`).

```go
import "github.com/bytedance/sonic"

v := map[string]string{"&&":"<>"}
ret, err := Encode(v, EscapeHTML) // ret == `{"\u0026\u0026":{"X":"\u003c\u003e"}}`
```

### Compact Format

Sonic encodes primitive objects (struct/map...) as compact-format JSON by default, except marshaling `json.RawMessage` or `json.Marshaler`: sonic ensures validating their output JSON but **DO NOT** compacting them for performance concerns. We provide the option `encoder.CompactMarshaler` to add compacting process.

### Print Error

If there invalid syntax in input JSON, sonic will return `decoder.SyntaxError`, which supports pretty-printing of error position

```go
import "github.com/bytedance/sonic"
import "github.com/bytedance/sonic/decoder"

var data interface{}
err := sonic.UnmarshalString("[[[}]]", &data)
if err != nil {
    /* One line by default */
    println(e.Error()) // "Syntax error at index 3: invalid char\n\n\t[[[}]]\n\t...^..\n"
    /* Pretty print */
    if e, ok := err.(decoder.SyntaxError); ok {
        /*Syntax error at index 3: invalid char

            [[[}]]
            ...^..
        */
        print(e.Description())
    } else if me, ok := err.(*decoder.MismatchTypeError); ok {
        // decoder.MismatchTypeError is new to Sonic v1.6.0
        print(me.Description())
    }
}
```

#### Mismatched Types [Sonic v1.6.0]

If there a **mismatch-typed** value for a given key, sonic will report `decoder.MismatchTypeError` (if there are many, report the last one), but still skip wrong the value and keep decoding next JSON.

```go
import "github.com/bytedance/sonic"
import "github.com/bytedance/sonic/decoder"

var data = struct{
    A int
    B int
}{}
err := UnmarshalString(`{"A":"1","B":1}`, &data)
println(err.Error())    // Mismatch type int with value string "at index 5: mismatched type with value\n\n\t{\"A\":\"1\",\"B\":1}\n\t.....^.........\n"
fmt.Printf("%+v", data) // {A:0 B:1}
```

### Ast.Node

Sonic/ast.Node is a completely self-contained AST for JSON. It implements serialization and deserialization both and provides robust APIs for obtaining and modification of generic data.

#### Get/Index

Search partial JSON by given paths, which must be non-negative integer or string, or nil

```go
import "github.com/bytedance/sonic"

input := []byte(`{"key1":[{},{"key2":{"key3":[1,2,3]}}]}`)

// no path, returns entire json
root, err := sonic.Get(input)
raw := root.Raw() // == string(input)

// multiple paths
root, err := sonic.Get(input, "key1", 1, "key2")
sub := root.Get("key3").Index(2).Int64() // == 3
```

**Tip**: since `Index()` uses offset to locate data, which is much faster than scanning like `Get()`, we suggest you use it as much as possible. And sonic also provides another API `IndexOrGet()` to underlying use offset as well as ensure the key is matched.

#### SearchOption

`Searcher` provides some options for user to meet different needs:

```go
opts := ast.SearchOption{ CopyReturn: true ... }
val, err := sonic.GetWithOptions(JSON, opts, "key")
```

- CopyReturn
Indicate the searcher to copy the result JSON string instead of refer from the input. This can help to reduce memory usage if you cache the results
- ConcurentRead
Since `ast.Node` use `Lazy-Load` design, it doesn't support Concurrently-Read by default. If you want to read it concurrently, please specify it.
- ValidateJSON
Indicate the searcher to validate the entire JSON. This option is enabled by default, which slow down the search speed a little.

#### Set/Unset

Modify the json content by Set()/Unset()

```go
import "github.com/bytedance/sonic"

// Set
exist, err := root.Set("key4", NewBool(true)) // exist == false
alias1 := root.Get("key4")
println(alias1.Valid()) // true
alias2 := root.Index(1)
println(alias1 == alias2) // true

// Unset
exist, err := root.UnsetByIndex(1) // exist == true
println(root.Get("key4").Check()) // "value not exist"
```

#### Serialize

To encode `ast.Node` as json, use `MarshalJson()` or `json.Marshal()` (MUST pass the node's pointer)

```go
import (
    "encoding/json"
    "github.com/bytedance/sonic"
)

buf, err := root.MarshalJson()
println(string(buf))                // {"key1":[{},{"key2":{"key3":[1,2,3]}}]}
exp, err := json.Marshal(&root)     // WARN: use pointer
println(string(buf) == string(exp)) // true
```

#### APIs

- validation: `Check()`, `Error()`, `Valid()`, `Exist()`
- searching: `Index()`, `Get()`, `IndexPair()`, `IndexOrGet()`, `GetByPath()`
- go-type casting: `Int64()`, `Float64()`, `String()`, `Number()`, `Bool()`, `Map[UseNumber|UseNode]()`, `Array[UseNumber|UseNode]()`, `Interface[UseNumber|UseNode]()`
- go-type packing: `NewRaw()`, `NewNumber()`, `NewNull()`, `NewBool()`, `NewString()`, `NewObject()`, `NewArray()`
- iteration: `Values()`, `Properties()`, `ForEach()`, `SortKeys()`
- modification: `Set()`, `SetByIndex()`, `Add()`

### Ast.Visitor

Sonic provides an advanced API for fully parsing JSON into non-standard types (neither `struct` not `map[string]interface{}`) without using any intermediate representation (`ast.Node` or `interface{}`). For example, you might have the following types which are like `interface{}` but actually not `interface{}`:

```go
type UserNode interface {}

// the following types implement the UserNode interface.
type (
    UserNull    struct{}
    UserBool    struct{ Value bool }
    UserInt64   struct{ Value int64 }
    UserFloat64 struct{ Value float64 }
    UserString  struct{ Value string }
    UserObject  struct{ Value map[string]UserNode }
    UserArray   struct{ Value []UserNode }
)
```

Sonic provides the following API to return **the preorder traversal of a JSON AST**. The `ast.Visitor` is a SAX style interface which is used in some C++ JSON library. You should implement `ast.Visitor` by yourself and pass it to `ast.Preorder()` method. In your visitor you can make your custom types to represent JSON values. There may be an O(n) space container (such as stack) in your visitor to record the object / array hierarchy.

```go
func Preorder(str string, visitor Visitor, opts *VisitorOptions) error

type Visitor interface {
    OnNull() error
    OnBool(v bool) error
    OnString(v string) error
    OnInt64(v int64, n json.Number) error
    OnFloat64(v float64, n json.Number) error
    OnObjectBegin(capacity int) error
    OnObjectKey(key string) error
    OnObjectEnd() error
    OnArrayBegin(capacity int) error
    OnArrayEnd() error
}
```

See [ast/visitor.go](https://github.com/bytedance/sonic/blob/main/ast/visitor.go) for detailed usage. We also implement a demo visitor for `UserNode` in [ast/visitor_test.go](https://github.com/bytedance/sonic/blob/main/ast/visitor_test.go).

## Compatibility

For developers who want to use sonic to meet different scenarios, we provide some integrated configs as `sonic.API`

- `ConfigDefault`: the sonic's default config (`EscapeHTML=false`,`SortKeys=false`...) to run sonic fast meanwhile ensure security.
- `ConfigStd`: the std-compatible config (`EscapeHTML=true`,`SortKeys=true`...)
- `ConfigFastest`: the fastest config (`NoQuoteTextMarshaler=true`) to run on sonic as fast as possible.
Sonic **DOES NOT** ensure to support all environments, due to the difficulty of developing high-performance codes. On non-sonic-supporting environment, the implementation will fall back to `encoding/json`. Thus below configs will all equal to `ConfigStd`.

## Tips

### Pretouch

Since Sonic uses [golang-asm](https://github.com/twitchyliquid64/golang-asm) as a JIT assembler, which is NOT very suitable for runtime compiling, first-hit running of a huge schema may cause request-timeout or even process-OOM. For better stability, we advise **using `Pretouch()` for huge-schema or compact-memory applications** before `Marshal()/Unmarshal()`.

```go
import (
    "reflect"
    "github.com/bytedance/sonic"
    "github.com/bytedance/sonic/option"
)

func init() {
    var v HugeStruct

    // For most large types (nesting depth <= option.DefaultMaxInlineDepth)
    err := sonic.Pretouch(reflect.TypeOf(v))

    // with more CompileOption...
    err := sonic.Pretouch(reflect.TypeOf(v),
        // If the type is too deep nesting (nesting depth > option.DefaultMaxInlineDepth),
        // you can set compile recursive loops in Pretouch for better stability in JIT.
        option.WithCompileRecursiveDepth(loop),
        // For a large nested struct, try to set a smaller depth to reduce compiling time.
        option.WithCompileMaxInlineDepth(depth),
    )
}
```

### Copy string

When decoding **string values without any escaped characters**, sonic references them from the origin JSON buffer instead of mallocing a new buffer to copy. This helps a lot for CPU performance but may leave the whole JSON buffer in memory as long as the decoded objects are being used. In practice, we found the extra memory introduced by referring JSON buffer is usually 20% ~ 80% of decoded objects. Once an application holds these objects for a long time (for example, cache the decoded objects for reusing), its in-use memory on the server may go up. - `Config.CopyString`/`decoder.CopyString()`: We provide the option for `Decode()` / `Unmarshal()` users to choose not to reference the JSON buffer, which may cause a decline in CPU performance to some degree.

- `GetFromStringNoCopy()`: For memory safety, `sonic.Get()` / `sonic.GetFromString()` now copies return JSON. If users want to get json more quickly and not care about memory usage, you can use `GetFromStringNoCopy()` to return a JSON directly referenced from source.

### Pass string or []byte?

For alignment to `encoding/json`, we provide API to pass `[]byte` as an argument, but the string-to-bytes copy is conducted at the same time considering safety, which may lose performance when the origin JSON is huge. Therefore, you can use `UnmarshalString()` and `GetFromString()` to pass a string, as long as your origin data is a string or **nocopy-cast** is safe for your []byte. We also provide API `MarshalString()` for convenient **nocopy-cast** of encoded JSON []byte, which is safe since sonic's output bytes is always duplicated and unique.

### Accelerate `encoding.TextMarshaler`

To ensure data security, sonic.Encoder quotes and escapes string values from `encoding.TextMarshaler` interfaces by default, which may degrade performance much if most of your data is in form of them. We provide `encoder.NoQuoteTextMarshaler` to skip these operations, which means you **MUST** ensure their output string escaped and quoted following [RFC8259](https://datatracker.ietf.org/doc/html/rfc8259).

### Better performance for generic data

In **fully-parsed** scenario, `Unmarshal()` performs better than `Get()`+`Node.Interface()`. But if you only have a part of the schema for specific json, you can combine `Get()` and `Unmarshal()` together:

```go
import "github.com/bytedance/sonic"

node, err := sonic.GetFromString(_TwitterJson, "statuses", 3, "user")
var user User // your partial schema...
err = sonic.UnmarshalString(node.Raw(), &user)
```

Even if you don't have any schema, use `ast.Node` as the container of generic values instead of `map` or `interface`:

```go
import "github.com/bytedance/sonic"

root, err := sonic.GetFromString(_TwitterJson)
user := root.GetByPath("statuses", 3, "user")  // === root.Get("status").Index(3).Get("user")
err = user.Check()

// err = user.LoadAll() // only call this when you want to use 'user' concurrently...
go someFunc(user)
```

Why? Because `ast.Node` stores its children using `array`:

- `Array`'s performance is **much better** than `Map` when Inserting (Deserialize) and Scanning (Serialize) data;
- **Hashing** (`map[x]`) is not as efficient as **Indexing** (`array[x]`), which `ast.Node` can conduct on **both array and object**;
- Using `Interface()`/`Map()` means Sonic must parse all the underlying values, while `ast.Node` can parse them **on demand**.

**CAUTION:** `ast.Node` **DOESN'T** ensure concurrent security directly, due to its **lazy-load** design. However, you can call `Node.Load()`/`Node.LoadAll()` to achieve that, which may bring performance reduction while it still works faster than converting to `map` or `interface{}`

### Ast.Node or Ast.Visitor?

For generic data, `ast.Node` should be enough for your needs in most cases.

However, `ast.Node` is designed for partially processing JSON string. It has some special designs such as lazy-load which might not be suitable for directly parsing the whole JSON string like `Unmarshal()`. Although `ast.Node` is better then `map` or `interface{}`, it's also a kind of intermediate representation after all if your final types are customized and you have to convert the above types to your custom types after parsing.

For better performance, in previous case the `ast.Visitor` will be the better choice. It performs JSON decoding like `Unmarshal()` and you can directly use your final types to represents a JSON AST without any intermediate representations.

But `ast.Visitor` is not a very handy API. You might need to write a lot of code to implement your visitor and carefully maintain the tree hierarchy during decoding. Please read the comments in [ast/visitor.go](https://github.com/bytedance/sonic/blob/main/ast/visitor.go) carefully if you decide to use this API.

### Buffer Size

Sonic use memory pool in many places like `encoder.Encode`, `ast.Node.MarshalJSON` to improve performance, which may produce more memory usage (in-use) when server's load is high. See [issue 614](https://github.com/bytedance/sonic/issues/614). Therefore, we introduce some options to let user control the behavior of memory pool. See [option](https://pkg.go.dev/github.com/bytedance/sonic@v1.11.9/option#pkg-variables) package.

### Faster JSON Skip

For security, sonic use [FSM](native/skip_one.c) algorithm to  validate JSON when decoding raw JSON or encoding `json.Marshaler`, which is much slower (1~10x) than [SIMD-searching-pair](native/skip_one_fast.c) algorithm. If user has many redundant JSON value and DO NOT NEED to strictly validate JSON correctness, you can enable below options:

- `Config.NoValidateSkipJSON`: for faster skipping JSON when decoding, such as unknown fields, json.Unmarshaler(json.RawMessage), mismatched values, and redundant array elements
- `Config.NoValidateJSONMarshaler`: avoid validating JSON when encoding `json.Marshaler`
- `SearchOption.ValidateJSON`: indicates if validate located JSON value when `Get`

## JSON-Path Support (GJSON)

[tidwall/gjson](https://github.com/tidwall/gjson) has provided a comprehensive and popular JSON-Path API, and
 a lot of older codes heavily relies on it. Therefore, we provides a wrapper library, which combines gjson's API with sonic's SIMD algorithm to boost up the performance. See [cloudwego/gjson](https://github.com/cloudwego/gjson).

## Community

Sonic is a subproject of [CloudWeGo](https://www.cloudwego.io/). We are committed to building a cloud native ecosystem.


================================================
FILE: README_ZH_CN.md
================================================
# Sonic

[English](README.md) | 中文

一个速度奇快的 JSON 序列化/反序列化库,由 JIT (即时编译)和 SIMD (单指令流多数据流)加速。

## 依赖

- Go: 1.18~1.25
  - 注意:Go1.24.0 由于 [issue](https://github.com/golang/go/issues/71672) 不可用,请升级到更高 Go 版本,或添加编译选项 `--ldflags="-checklinkname=0"` 
- OS: Linux / MacOS / Windows
- CPU: AMD64 / (ARM64, 需要 Go1.20 以上)

## 接口

详见 [go.dev](https://pkg.go.dev/github.com/bytedance/sonic)

## 特色

- 运行时对象绑定,无需代码生成
- 完备的 JSON 操作 API
- 快,更快,还要更快!

## 基准测试

对于**所有大小**的 json 和**所有使用场景**, **Sonic 表现均为最佳**。

- [中型](https://github.com/bytedance/sonic/blob/main/decoder/testdata_test.go#L19) (13kB, 300+ 键, 6 层)

```powershell
goversion: 1.17.1
goos: darwin
goarch: amd64
cpu: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
BenchmarkEncoder_Generic_Sonic-16                      32393 ns/op         402.40 MB/s       11965 B/op          4 allocs/op
BenchmarkEncoder_Generic_Sonic_Fast-16                 21668 ns/op         601.57 MB/s       10940 B/op          4 allocs/op
BenchmarkEncoder_Generic_JsonIter-16                   42168 ns/op         309.12 MB/s       14345 B/op        115 allocs/op
BenchmarkEncoder_Generic_GoJson-16                     65189 ns/op         199.96 MB/s       23261 B/op         16 allocs/op
BenchmarkEncoder_Generic_StdLib-16                    106322 ns/op         122.60 MB/s       49136 B/op        789 allocs/op
BenchmarkEncoder_Binding_Sonic-16                       6269 ns/op        2079.26 MB/s       14173 B/op          4 allocs/op
BenchmarkEncoder_Binding_Sonic_Fast-16                  5281 ns/op        2468.16 MB/s       12322 B/op          4 allocs/op
BenchmarkEncoder_Binding_JsonIter-16                   20056 ns/op         649.93 MB/s        9488 B/op          2 allocs/op
BenchmarkEncoder_Binding_GoJson-16                      8311 ns/op        1568.32 MB/s        9481 B/op          1 allocs/op
BenchmarkEncoder_Binding_StdLib-16                     16448 ns/op         792.52 MB/s        9479 B/op          1 allocs/op
BenchmarkEncoder_Parallel_Generic_Sonic-16              6681 ns/op        1950.93 MB/s       12738 B/op          4 allocs/op
BenchmarkEncoder_Parallel_Generic_Sonic_Fast-16         4179 ns/op        3118.99 MB/s       10757 B/op          4 allocs/op
BenchmarkEncoder_Parallel_Generic_JsonIter-16           9861 ns/op        1321.84 MB/s       14362 B/op        115 allocs/op
BenchmarkEncoder_Parallel_Generic_GoJson-16            18850 ns/op         691.52 MB/s       23278 B/op         16 allocs/op
BenchmarkEncoder_Parallel_Generic_StdLib-16            45902 ns/op         283.97 MB/s       49174 B/op        789 allocs/op
BenchmarkEncoder_Parallel_Binding_Sonic-16              1480 ns/op        8810.09 MB/s       13049 B/op          4 allocs/op
BenchmarkEncoder_Parallel_Binding_Sonic_Fast-16         1209 ns/op        10785.23 MB/s      11546 B/op          4 allocs/op
BenchmarkEncoder_Parallel_Binding_JsonIter-16           6170 ns/op        2112.58 MB/s        9504 B/op          2 allocs/op
BenchmarkEncoder_Parallel_Binding_GoJson-16             3321 ns/op        3925.52 MB/s        9496 B/op          1 allocs/op
BenchmarkEncoder_Parallel_Binding_StdLib-16             3739 ns/op        3486.49 MB/s        9480 B/op          1 allocs/op

BenchmarkDecoder_Generic_Sonic-16                      66812 ns/op         195.10 MB/s       57602 B/op        723 allocs/op
BenchmarkDecoder_Generic_Sonic_Fast-16                 54523 ns/op         239.07 MB/s       49786 B/op        313 allocs/op
BenchmarkDecoder_Generic_StdLib-16                    124260 ns/op         104.90 MB/s       50869 B/op        772 allocs/op
BenchmarkDecoder_Generic_JsonIter-16                   91274 ns/op         142.81 MB/s       55782 B/op       1068 allocs/op
BenchmarkDecoder_Generic_GoJson-16                     88569 ns/op         147.17 MB/s       66367 B/op        973 allocs/op
BenchmarkDecoder_Binding_Sonic-16                      32557 ns/op         400.38 MB/s       28302 B/op        137 allocs/op
BenchmarkDecoder_Binding_Sonic_Fast-16                 28649 ns/op         455.00 MB/s       24999 B/op         34 allocs/op
BenchmarkDecoder_Binding_StdLib-16                    111437 ns/op         116.97 MB/s       10576 B/op        208 allocs/op
BenchmarkDecoder_Binding_JsonIter-16                   35090 ns/op         371.48 MB/s       14673 B/op        385 allocs/op
BenchmarkDecoder_Binding_GoJson-16                     28738 ns/op         453.59 MB/s       22039 B/op         49 allocs/op
BenchmarkDecoder_Parallel_Generic_Sonic-16             12321 ns/op        1057.91 MB/s       57233 B/op        723 allocs/op
BenchmarkDecoder_Parallel_Generic_Sonic_Fast-16        10644 ns/op        1224.64 MB/s       49362 B/op        313 allocs/op
BenchmarkDecoder_Parallel_Generic_StdLib-16            57587 ns/op         226.35 MB/s       50874 B/op        772 allocs/op
BenchmarkDecoder_Parallel_Generic_JsonIter-16          38666 ns/op         337.12 MB/s       55789 B/op       1068 allocs/op
BenchmarkDecoder_Parallel_Generic_GoJson-16            30259 ns/op         430.79 MB/s       66370 B/op        974 allocs/op
BenchmarkDecoder_Parallel_Binding_Sonic-16              5965 ns/op        2185.28 MB/s       27747 B/op        137 allocs/op
BenchmarkDecoder_Parallel_Binding_Sonic_Fast-16         5170 ns/op        2521.31 MB/s       24715 B/op         34 allocs/op
BenchmarkDecoder_Parallel_Binding_StdLib-16            27582 ns/op         472.58 MB/s       10576 B/op        208 allocs/op
BenchmarkDecoder_Parallel_Binding_JsonIter-16          13571 ns/op         960.51 MB/s       14685 B/op        385 allocs/op
BenchmarkDecoder_Parallel_Binding_GoJson-16            10031 ns/op        1299.51 MB/s       22111 B/op         49 allocs/op

BenchmarkGetOne_Sonic-16                                3276 ns/op        3975.78 MB/s          24 B/op          1 allocs/op
BenchmarkGetOne_Gjson-16                                9431 ns/op        1380.81 MB/s           0 B/op          0 allocs/op
BenchmarkGetOne_Jsoniter-16                            51178 ns/op         254.46 MB/s       27936 B/op        647 allocs/op
BenchmarkGetOne_Parallel_Sonic-16                      216.7 ns/op       60098.95 MB/s          24 B/op          1 allocs/op
BenchmarkGetOne_Parallel_Gjson-16                       1076 ns/op        12098.62 MB/s          0 B/op          0 allocs/op
BenchmarkGetOne_Parallel_Jsoniter-16                   17741 ns/op         734.06 MB/s       27945 B/op        647 allocs/op
BenchmarkSetOne_Sonic-16                               9571 ns/op         1360.61 MB/s        1584 B/op         17 allocs/op
BenchmarkSetOne_Sjson-16                               36456 ns/op         357.22 MB/s       52180 B/op          9 allocs/op
BenchmarkSetOne_Jsoniter-16                            79475 ns/op         163.86 MB/s       45862 B/op        964 allocs/op
BenchmarkSetOne_Parallel_Sonic-16                      850.9 ns/op       15305.31 MB/s        1584 B/op         17 allocs/op
BenchmarkSetOne_Parallel_Sjson-16                      18194 ns/op         715.77 MB/s       52247 B/op          9 allocs/op
BenchmarkSetOne_Parallel_Jsoniter-16                   33560 ns/op         388.05 MB/s       45892 B/op        964 allocs/op
BenchmarkLoadNode/LoadAll()-16                         11384 ns/op        1143.93 MB/s        6307 B/op         25 allocs/op
BenchmarkLoadNode_Parallel/LoadAll()-16                 5493 ns/op        2370.68 MB/s        7145 B/op         25 allocs/op
BenchmarkLoadNode/Interface()-16                       17722 ns/op         734.85 MB/s       13323 B/op         88 allocs/op
BenchmarkLoadNode_Parallel/Interface()-16              10330 ns/op        1260.70 MB/s       15178 B/op         88 allocs/op
```

- [小型](https://github.com/bytedance/sonic/blob/main/testdata/small.go) (400B, 11 个键, 3 层)
![small benchmarks](./docs/imgs/bench-small.png)
- [大型](https://github.com/bytedance/sonic/blob/main/testdata/twitter.json) (635kB, 10000+ 个键, 6 层)
![large benchmarks](./docs/imgs/bench-large.png)

要查看基准测试代码,请参阅 [bench.sh](https://github.com/bytedance/sonic/blob/main/scripts/bench.sh) 。

## 工作原理

请参阅 [INTRODUCTION_ZH_CN.md](./docs/INTRODUCTION_ZH_CN.md).

## 使用方式

### 序列化/反序列化

默认的行为基本上与 `encoding/json` 相一致,除了 HTML 转义形式(参见 [Escape HTML](https://github.com/bytedance/sonic/blob/main/README.md#escape-html)) 和 `SortKeys` 功能(参见 [Sort Keys](https://github.com/bytedance/sonic/blob/main/README.md#sort-keys))**没有**遵循 [RFC8259](https://datatracker.ietf.org/doc/html/rfc8259) 。

 ```go
import "github.com/bytedance/sonic"

var data YourSchema
// Marshal
output, err := sonic.Marshal(&data)
// Unmarshal
err := sonic.Unmarshal(output, &data)
 ```

### 流式输入输出

Sonic 支持解码 `io.Reader` 中输入的 json,或将对象编码为 json 后输出至 `io.Writer`,以处理多个值并减少内存消耗。

- 编码器

```go
var o1 = map[string]interface{}{
    "a": "b",
}
var o2 = 1
var w = bytes.NewBuffer(nil)
var enc = sonic.ConfigDefault.NewEncoder(w)
enc.Encode(o1)
enc.Encode(o2)
fmt.Println(w.String())
// Output:
// {"a":"b"}
// 1
```

- 解码器

```go
var o =  map[string]interface{}{}
var r = strings.NewReader(`{"a":"b"}{"1":"2"}`)
var dec = sonic.ConfigDefault.NewDecoder(r)
dec.Decode(&o)
dec.Decode(&o)
fmt.Printf("%+v", o)
// Output:
// map[1:2 a:b]
```

### 使用 `Number` / `int64`

```go
import "github.com/bytedance/sonic/decoder"

var input = `1`
var data interface{}

// default float64
dc := decoder.NewDecoder(input)
dc.Decode(&data) // data == float64(1)
// use json.Number
dc = decoder.NewDecoder(input)
dc.UseNumber()
dc.Decode(&data) // data == json.Number("1")
// use int64
dc = decoder.NewDecoder(input)
dc.UseInt64()
dc.Decode(&data) // data == int64(1)

root, err := sonic.GetFromString(input)
// Get json.Number
jn := root.Number()
jm := root.InterfaceUseNumber().(json.Number) // jn == jm
// Get float64
fn := root.Float64()
fm := root.Interface().(float64) // jn == jm
 ```

### 对键排序

考虑到排序带来的性能损失(约 10% ), sonic 默认不会启用这个功能。如果你的组件依赖这个行为(如 [zstd](https://github.com/facebook/zstd)) ,可以仿照下面的例子:

```go
import "github.com/bytedance/sonic"
import "github.com/bytedance/sonic/encoder"

// Binding map only
m := map[string]interface{}{}
v, err := encoder.Encode(m, encoder.SortMapKeys)

// Or ast.Node.SortKeys() before marshal
var root := sonic.Get(JSON)
err := root.SortKeys()
```

### HTML 转义

考虑到性能损失(约15%), sonic 默认不会启用这个功能。你可以使用 `encoder.EscapeHTML` 选项来开启(与 `encoding/json.HTMLEscape` 行为一致)。

```go
import "github.com/bytedance/sonic"

v := map[string]string{"&&":"<>"}
ret, err := Encode(v, EscapeHTML) // ret == `{"\u0026\u0026":{"X":"\u003c\u003e"}}`
```

### 紧凑格式

Sonic 默认将基本类型( `struct` , `map` 等)编码为紧凑格式的 JSON ,除非使用 `json.RawMessage` or `json.Marshaler` 进行编码: sonic 确保输出的 JSON 合法,但出于性能考虑,**不会**加工成紧凑格式。我们提供选项 `encoder.CompactMarshaler` 来添加此过程,

### 打印错误

如果输入的 JSON 存在无效的语法,sonic 将返回 `decoder.SyntaxError`,该错误支持错误位置的美化输出。

```go
import "github.com/bytedance/sonic"
import "github.com/bytedance/sonic/decoder"

var data interface{}
err := sonic.UnmarshalString("[[[}]]", &data)
if err != nil {
    /* One line by default */
    println(e.Error()) // "Syntax error at index 3: invalid char\n\n\t[[[}]]\n\t...^..\n"
    /* Pretty print */
    if e, ok := err.(decoder.SyntaxError); ok {
        /*Syntax error at index 3: invalid char

            [[[}]]
            ...^..
        */
        print(e.Description())
    } else if me, ok := err.(*decoder.MismatchTypeError); ok {
        // decoder.MismatchTypeError is new to Sonic v1.6.0
        print(me.Description())
    }
}
```

#### 类型不匹配 [Sonic v1.6.0]

如果给定键中存在**类型不匹配**的值, sonic 会抛出 `decoder.MismatchTypeError` (如果有多个,只会报告最后一个),但仍会跳过错误的值并解码下一个 JSON 。

```go
import "github.com/bytedance/sonic"
import "github.com/bytedance/sonic/decoder"

var data = struct{
    A int
    B int
}{}
err := UnmarshalString(`{"A":"1","B":1}`, &data)
println(err.Error())    // Mismatch type int with value string "at index 5: mismatched type with value\n\n\t{\"A\":\"1\",\"B\":1}\n\t.....^.........\n"
fmt.Printf("%+v", data) // {A:0 B:1}
```

### `Ast.Node`

Sonic/ast.Node 是完全独立的 JSON 抽象语法树库。它实现了序列化和反序列化,并提供了获取和修改JSON数据的鲁棒的 API。

#### 查找/索引

通过给定的路径搜索 JSON 片段,路径必须为非负整数,字符串或 `nil` 。

```go
import "github.com/bytedance/sonic"

input := []byte(`{"key1":[{},{"key2":{"key3":[1,2,3]}}]}`)

// no path, returns entire json
root, err := sonic.Get(input)
raw := root.Raw() // == string(input)

// multiple paths
root, err := sonic.Get(input, "key1", 1, "key2")
sub := root.Get("key3").Index(2).Int64() // == 3
```

**注意**:由于 `Index()` 使用偏移量来定位数据,比使用扫描的 `Get()` 要快的多,建议尽可能的使用 `Index` 。 Sonic 也提供了另一个 API, `IndexOrGet()` ,以偏移量为基础并且也确保键的匹配。

#### 查找选项

`ast.Searcher`提供了一些选项,以满足用户的不同需求:

```go
opts := ast.SearchOption{CopyReturn: true…}
val, err := sonic.GetWithOptions(JSON, opts, "key")
```

- CopyReturn
指示搜索器复制结果JSON字符串,而不是从输入引用。如果用户缓存结果,这有助于减少内存使用
- ConcurentRead
因为`ast.Node`使用`Lazy-Load`设计,默认不支持并发读取。如果您想同时读取,请指定它。
- ValidateJSON
指示搜索器来验证整个JSON。默认情况下启用该选项, 但是对于查找速度有一定影响。

#### 修改

使用 `Set()` / `Unset()` 修改 json 的内容

```go
import "github.com/bytedance/sonic"

// Set
exist, err := root.Set("key4", NewBool(true)) // exist == false
alias1 := root.Get("key4")
println(alias1.Valid()) // true
alias2 := root.Index(1)
println(alias1 == alias2) // true

// Unset
exist, err := root.UnsetByIndex(1) // exist == true
println(root.Get("key4").Check()) // "value not exist"
```

#### 序列化

要将 `ast.Node` 编码为 json ,使用 `MarshalJson()` 或者 `json.Marshal()` (必须传递指向节点的指针)

```go
import (
    "encoding/json"
    "github.com/bytedance/sonic"
)

buf, err := root.MarshalJson()
println(string(buf))                // {"key1":[{},{"key2":{"key3":[1,2,3]}}]}
exp, err := json.Marshal(&root)     // WARN: use pointer
println(string(buf) == string(exp)) // true
```

#### APIs

- 合法性检查: `Check()`, `Error()`, `Valid()`, `Exist()`
- 索引: `Index()`, `Get()`, `IndexPair()`, `IndexOrGet()`, `GetByPath()`
- 转换至 go 内置类型: `Int64()`, `Float64()`, `String()`, `Number()`, `Bool()`, `Map[UseNumber|UseNode]()`, `Array[UseNumber|UseNode]()`, `Interface[UseNumber|UseNode]()`
- go 类型打包: `NewRaw()`, `NewNumber()`, `NewNull()`, `NewBool()`, `NewString()`, `NewObject()`, `NewArray()`
- 迭代: `Values()`, `Properties()`, `ForEach()`, `SortKeys()`
- 修改: `Set()`, `SetByIndex()`, `Add()`

### `Ast.Visitor`

Sonic 提供了一个高级的 API 用于直接全量解析 JSON 到非标准容器里 (既不是 `struct` 也不是 `map[string]interface{}`) 且不需要借助任何中间表示 (`ast.Node` 或 `interface{}`)。举个例子,你可能定义了下述的类型,它们看起来像 `interface{}`,但实际上并不是:

```go
type UserNode interface {}

// the following types implement the UserNode interface.
type (
    UserNull    struct{}
    UserBool    struct{ Value bool }
    UserInt64   struct{ Value int64 }
    UserFloat64 struct{ Value float64 }
    UserString  struct{ Value string }
    UserObject  struct{ Value map[string]UserNode }
    UserArray   struct{ Value []UserNode }
)
```

Sonic 提供了下述的 API 来返回 **“对 JSON AST 的前序遍历”**。`ast.Visitor` 是一个 SAX 风格的接口,这在某些 C++ 的 JSON 解析库中被使用到。你需要自己实现一个 `ast.Visitor`,将它传递给 `ast.Preorder()` 方法。在你的实现中你可以使用自定义的类型来表示 JSON 的值。在你的 `ast.Visitor` 中,可能需要有一个 O(n) 空间复杂度的容器(比如说栈)来记录 object / array 的层级。

```go
func Preorder(str string, visitor Visitor, opts *VisitorOptions) error

type Visitor interface {
    OnNull() error
    OnBool(v bool) error
    OnString(v string) error
    OnInt64(v int64, n json.Number) error
    OnFloat64(v float64, n json.Number) error
    OnObjectBegin(capacity int) error
    OnObjectKey(key string) error
    OnObjectEnd() error
    OnArrayBegin(capacity int) error
    OnArrayEnd() error
}
```

详细用法参看 [ast/visitor.go](https://github.com/bytedance/sonic/blob/main/ast/visitor.go),我们还为 `UserNode` 实现了一个示例 `ast.Visitor`,你可以在 [ast/visitor_test.go](https://github.com/bytedance/sonic/blob/main/ast/visitor_test.go) 中找到它。

## 兼容性

对于想要使用sonic来满足不同场景的开发人员,我们提供了一些集成配置:

- `ConfigDefault`: sonic的默认配置 (`EscapeHTML=false`, `SortKeys=false`…) 保证性能同时兼顾安全性。
- `ConfigStd`: 与 `encoding/json` 保证完全兼容的配置
- `ConfigFastest`: 最快的配置(`NoQuoteTextMarshaler=true...`) 保证性能最优但是会缺少一些安全性检查(validate UTF8 等)
Sonic **不**确保支持所有环境,由于开发高性能代码的困难。在不支持sonic的环境中,实现将回落到 `encoding/json`。因此上述配置将全部等于`ConfigStd`。

## 注意事项

### 预热

由于 Sonic 使用 [golang-asm](https://github.com/twitchyliquid64/golang-asm) 作为 JIT 汇编器,这个库并不适用于运行时编译,第一次运行一个大型模式可能会导致请求超时甚至进程内存溢出。为了更好地稳定性,我们建议在运行大型模式或在内存有限的应用中,在使用 `Marshal()/Unmarshal()` 前运行 `Pretouch()`。

```go
import (
    "reflect"
    "github.com/bytedance/sonic"
    "github.com/bytedance/sonic/option"
)

func init() {
    var v HugeStruct

    // For most large types (nesting depth <= option.DefaultMaxInlineDepth)
    err := sonic.Pretouch(reflect.TypeOf(v))

    // with more CompileOption...
    err := sonic.Pretouch(reflect.TypeOf(v),
        // If the type is too deep nesting (nesting depth > option.DefaultMaxInlineDepth),
        // you can set compile recursive loops in Pretouch for better stability in JIT.
        option.WithCompileRecursiveDepth(loop),
        // For a large nested struct, try to set a smaller depth to reduce compiling time.
        option.WithCompileMaxInlineDepth(depth),
    )
}
```

### 拷贝字符串

当解码 **没有转义字符的字符串**时, sonic 会从原始的 JSON 缓冲区内引用而不是复制到新的一个缓冲区中。这对 CPU 的性能方面很有帮助,但是可能因此在解码后对象仍在使用的时候将整个 JSON 缓冲区保留在内存中。实践中我们发现,通过引用 JSON 缓冲区引入的额外内存通常是解码后对象的 20% 至 80% ,一旦应用长期保留这些对象(如缓存以备重用),服务器所使用的内存可能会增加。我们提供了选项 `decoder.CopyString()` 供用户选择,不引用 JSON 缓冲区。这可能在一定程度上降低 CPU 性能。

### 传递字符串还是字节数组?

为了和 `encoding/json` 保持一致,我们提供了传递 `[]byte` 作为参数的 API ,但考虑到安全性,字符串到字节的复制是同时进行的,这在原始 JSON 非常大时可能会导致性能损失。因此,你可以使用 `UnmarshalString()` 和 `GetFromString()` 来传递字符串,只要你的原始数据是字符串,或**零拷贝类型转换**对于你的字节数组是安全的。我们也提供了 `MarshalString()` 的 API ,以便对编码的 JSON 字节数组进行**零拷贝类型转换**,因为 sonic 输出的字节始终是重复并且唯一的,所以这样是安全的。

### 加速 `encoding.TextMarshaler`

为了保证数据安全性, `sonic.Encoder` 默认会对来自 `encoding.TextMarshaler` 接口的字符串进行引用和转义,如果大部分数据都是这种形式那可能会导致很大的性能损失。我们提供了 `encoder.NoQuoteTextMarshaler` 选项来跳过这些操作,但你**必须**保证他们的输出字符串依照 [RFC8259](https://datatracker.ietf.org/doc/html/rfc8259) 进行了转义和引用。

### 泛型的性能优化

在 **完全解析**的场景下, `Unmarshal()` 表现得比 `Get()`+`Node.Interface()` 更好。但是如果你只有特定 JSON 的部分模式,你可以将 `Get()` 和 `Unmarshal()` 结合使用:

```go
import "github.com/bytedance/sonic"

node, err := sonic.GetFromString(_TwitterJson, "statuses", 3, "user")
var user User // your partial schema...
err = sonic.UnmarshalString(node.Raw(), &user)
```

甚至如果你没有任何模式,可以用 `ast.Node` 代替 `map` 或 `interface` 作为泛型的容器:

```go
import "github.com/bytedance/sonic"

root, err := sonic.GetFromString(_TwitterJson)
user := root.GetByPath("statuses", 3, "user")  // === root.Get("status").Index(3).Get("user")
err = user.Check()

// err = user.LoadAll() // only call this when you want to use 'user' concurrently...
go someFunc(user)
```

为什么?因为 `ast.Node` 使用 `array` 来存储其子节点:

- 在插入(反序列化)和扫描(序列化)数据时,`Array` 的性能比 `Map` **好得多**;
- **哈希**(`map[x]`)的效率不如**索引**(`array[x]`)高效,而 `ast.Node` 可以在数组和对象上使用索引;
- 使用 `Interface()` / `Map()` 意味着 sonic 必须解析所有的底层值,而 `ast.Node` 可以**按需解析**它们。

**注意**:由于 `ast.Node` 的惰性加载设计,其**不能**直接保证并发安全性,但你可以调用 `Node.Load()` / `Node.LoadAll()` 来实现并发安全。尽管可能会带来性能损失,但仍比转换成 `map` 或 `interface{}` 更为高效。

### 使用 `ast.Node` 还是 `ast.Visitor`?

对于泛型数据的解析,`ast.Node` 在大多数场景上应该能够满足你的需求。

然而,`ast.Node` 是一种针对部分解析 JSON 而设计的泛型容器,它包含一些特殊设计,比如惰性加载,如果你希望像 `Unmarshal()` 那样直接解析整个 JSON,这些设计可能并不合适。尽管 `ast.Node` 相较于 `map` 或 `interface{}` 来说是更好的一种泛型容器,但它毕竟也是一种中间表示,如果你的最终类型是自定义的,你还得在解析完成后将上述类型转化成你自定义的类型。

在上述场景中,如果想要有更极致的性能,`ast.Visitor` 会是更好的选择。它采用和 `Unmarshal()` 类似的形式解析 JSON,并且你可以直接使用你的最终类型去表示 JSON AST,而不需要经过额外的任何中间表示。

但是,`ast.Visitor` 并不是一个很易用的 API。你可能需要写大量的代码去实现自己的 `ast.Visitor`,并且需要在解析过程中仔细维护树的层级。如果你决定要使用这个 API,请先仔细阅读 [ast/visitor.go](https://github.com/bytedance/sonic/blob/main/ast/visitor.go) 中的注释。

### 缓冲区大小

Sonic在许多地方使用内存池,如`encoder.Encode`, `ast.Node.MarshalJSON`等来提高性能,这可能会在服务器负载高时产生更多的内存使用(in-use)。参见[issue 614](https://github.com/bytedance/sonic/issues/614)。因此,我们引入了一些选项来让用户配置内存池的行为。参见[option](https://pkg.go.dev/github.com/bytedance/sonic@v1.11.9/option#pkg-variables)包。

### 更快的 JSON Skip

为了安全起见,在跳过原始JSON 时,sonic decoder 默认使用[FSM](native/skip_one.c)算法扫描来跳过同时校验 JSON。它相比[SIMD-searching-pair](native/skip_one_fast.c)算法跳过要慢得多(1~10倍)。如果用户有很多冗余的JSON值,并且不需要严格验证JSON的正确性,你可以启用以下选项:

- `Config.NoValidateSkipJSON`: 用于在解码时更快地跳过JSON,例如未知字段,`json.RawMessage`,不匹配的值和冗余的数组元素等
- `Config.NoValidateJSONMarshaler`: 编码JSON时避免验证JSON。封送拆收器
- `SearchOption.ValidateJSON`: 指示当`Get`时是否验证定位的JSON值

## 社区

Sonic 是 [CloudWeGo](https://www.cloudwego.io/) 下的一个子项目。我们致力于构建云原生生态系统。


================================================
FILE: api.go
================================================
/*
 * Copyright 2021 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package sonic

import (
	"io"

	"github.com/bytedance/sonic/ast"
	"github.com/bytedance/sonic/internal/rt"
)

const (
	// UseStdJSON indicates you are using fallback implementation (encoding/json)
	UseStdJSON = iota
	// UseSonicJSON indicates you are using real sonic implementation
	UseSonicJSON
)

// APIKind is the kind of API, 0 is std json, 1 is sonic.
const APIKind = apiKind

// Config is a combination of sonic/encoder.Options and sonic/decoder.Options
type Config struct {
	// EscapeHTML indicates encoder to escape all HTML characters
	// after serializing into JSON (see https://pkg.go.dev/encoding/json#HTMLEscape).
	// WARNING: This hurts performance A LOT, USE WITH CARE.
	EscapeHTML bool

	// SortMapKeys indicates encoder that the keys of a map needs to be sorted
	// before serializing into JSON.
	// WARNING: This hurts performance A LOT, USE WITH CARE.
	SortMapKeys bool

	// CompactMarshaler indicates encoder that the output JSON from json.Marshaler
	// is always compact and needs no validation
	CompactMarshaler bool

	// NoQuoteTextMarshaler indicates encoder that the output text from encoding.TextMarshaler
	// is always escaped string and needs no quoting
	NoQuoteTextMarshaler bool

	// NoNullSliceOrMap indicates encoder that all empty Array or Object are encoded as '[]' or '{}',
	// instead of 'null'
	NoNullSliceOrMap bool

	// UseInt64 indicates decoder to unmarshal an integer into an interface{} as an
	// int64 instead of as a float64.
	UseInt64 bool

	// UseNumber indicates decoder to unmarshal a number into an interface{} as a
	// json.Number instead of as a float64.
	UseNumber bool

	// UseUnicodeErrors indicates decoder to return an error when encounter invalid
	// UTF-8 escape sequences.
	UseUnicodeErrors bool

	// DisallowUnknownFields indicates decoder to return an error when the destination
	// is a struct and the input contains object keys which do not match any
	// non-ignored, exported fields in the destination.
	DisallowUnknownFields bool

	// CopyString indicates decoder to decode string values by copying instead of referring.
	CopyString bool

	// ValidateString indicates decoder and encoder to validate string values: decoder will return errors
	// when unescaped control chars(\u0000-\u001f) in the string value of JSON.
	ValidateString bool

	// NoValidateJSONMarshaler indicates that the encoder should not validate the output string
	// after encoding the JSONMarshaler to JSON.
	NoValidateJSONMarshaler bool

	// NoValidateJSONSkip indicates the decoder should not validate the JSON value when skipping it,
	// such as unknown-fields, mismatched-type, redundant elements..
	NoValidateJSONSkip bool

	// NoEncoderNewline indicates that the encoder should not add a newline after every message
	NoEncoderNewline bool

	// Encode Infinity or Nan float into `null`, instead of returning an error.
	EncodeNullForInfOrNan bool

	// CaseSensitive indicates that the decoder should not ignore the case of object keys.
	CaseSensitive bool
}

var (
	// ConfigDefault is the default config of APIs, aiming at efficiency and safety.
	ConfigDefault = Config{}.Froze()

	// ConfigStd is the standard config of APIs, aiming at being compatible with encoding/json.
	ConfigStd = Config{
		EscapeHTML:       true,
		SortMapKeys:      true,
		CompactMarshaler: true,
		CopyString:       true,
		ValidateString:   true,
	}.Froze()

	// ConfigFastest is the fastest config of APIs, aiming at speed.
	ConfigFastest = Config{
		NoValidateJSONMarshaler: true,
		NoValidateJSONSkip:      true,
	}.Froze()
)

// API is a binding of specific config.
// This interface is inspired by github.com/json-iterator/go,
// and has same behaviors under equivalent config.
type API interface {
	// MarshalToString returns the JSON encoding string of v
	MarshalToString(v interface{}) (string, error)
	// Marshal returns the JSON encoding bytes of v.
	Marshal(v interface{}) ([]byte, error)
	// MarshalIndent returns the JSON encoding bytes with indent and prefix.
	MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)
	// UnmarshalFromString parses the JSON-encoded bytes and stores the result in the value pointed to by v.
	UnmarshalFromString(str string, v interface{}) error
	// Unmarshal parses the JSON-encoded string and stores the result in the value pointed to by v.
	Unmarshal(data []byte, v interface{}) error
	// NewEncoder create a Encoder holding writer
	NewEncoder(writer io.Writer) Encoder
	// NewDecoder create a Decoder holding reader
	NewDecoder(reader io.Reader) Decoder
	// Valid validates the JSON-encoded bytes and reports if it is valid
	Valid(data []byte) bool
}

// Encoder encodes JSON into io.Writer
type Encoder interface {
	// Encode writes the JSON encoding of v to the stream, followed by a newline character.
	Encode(val interface{}) error
	// SetEscapeHTML specifies whether problematic HTML characters
	// should be escaped inside JSON quoted strings.
	// The default behavior NOT ESCAPE
	SetEscapeHTML(on bool)
	// SetIndent instructs the encoder to format each subsequent encoded value
	// as if indented by the package-level function Indent(dst, src, prefix, indent).
	// Calling SetIndent("", "") disables indentation
	SetIndent(prefix, indent string)
}

// Decoder decodes JSON from io.Read
type Decoder interface {
	// Decode reads the next JSON-encoded value from its input and stores it in the value pointed to by v.
	Decode(val interface{}) error
	// Buffered returns a reader of the data remaining in the Decoder's buffer.
	// The reader is valid until the next call to Decode.
	Buffered() io.Reader
	// DisallowUnknownFields causes the Decoder to return an error when the destination is a struct
	// and the input contains object keys which do not match any non-ignored, exported fields in the destination.
	DisallowUnknownFields()
	// More reports whether there is another element in the current array or object being parsed.
	More() bool
	// UseNumber causes the Decoder to unmarshal a number into an interface{} as a Number instead of as a float64.
	UseNumber()
}

// Marshal returns the JSON encoding bytes of v.
func Marshal(val interface{}) ([]byte, error) {
	return ConfigDefault.Marshal(val)
}

// MarshalIndent is like Marshal but applies Indent to format the output.
// Each JSON element in the output will begin on a new line beginning with prefix
// followed by one or more copies of indent according to the indentation nesting.
func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
	return ConfigDefault.MarshalIndent(v, prefix, indent)
}

// MarshalString returns the JSON encoding string of v.
func MarshalString(val interface{}) (string, error) {
	return ConfigDefault.MarshalToString(val)
}

// Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v.
// NOTICE: This API copies given buffer by default,
// if you want to pass JSON more efficiently, use UnmarshalString instead.
func Unmarshal(buf []byte, val interface{}) error {
	return ConfigDefault.Unmarshal(buf, val)
}

// UnmarshalString is like Unmarshal, except buf is a string.
func UnmarshalString(buf string, val interface{}) error {
	return ConfigDefault.UnmarshalFromString(buf, val)
}

// Get searches and locates the given path from src json,
// and returns a ast.Node representing the partially json.
//
// Each path arg must be integer or string:
//   - Integer is target index(>=0), means searching current node as array.
//   - String is target key, means searching current node as object.
//
// Notice: It expects the src json is **Well-formed** and **Immutable** when calling,
// otherwise it may return unexpected result.
// Considering memory safety, the returned JSON is **Copied** from the input
func Get(src []byte, path ...interface{}) (ast.Node, error) {
	return GetCopyFromString(rt.Mem2Str(src), path...)
}

// GetWithOptions searches and locates the given path from src json,
// with specific options of ast.Searcher
func GetWithOptions(src []byte, opts ast.SearchOptions, path ...interface{}) (ast.Node, error) {
	s := ast.NewSearcher(rt.Mem2Str(src))
	s.SearchOptions = opts
	return s.GetByPath(path...)
}

// GetFromString is same with Get except src is string.
//
// WARNING: The returned JSON is **Referenced** from the input.
// Caching or long-time holding the returned node may cause OOM.
// If your src is big, consider use GetFromStringCopy().
func GetFromString(src string, path ...interface{}) (ast.Node, error) {
	return ast.NewSearcher(src).GetByPath(path...)
}

// GetCopyFromString is same with Get except src is string
func GetCopyFromString(src string, path ...interface{}) (ast.Node, error) {
	return ast.NewSearcher(src).GetByPathCopy(path...)
}

// Valid reports whether data is a valid JSON encoding.
func Valid(data []byte) bool {
	return ConfigDefault.Valid(data)
}

// Valid reports whether data is a valid JSON encoding.
func ValidString(data string) bool {
	return ConfigDefault.Valid(rt.Str2Mem(data))
}


================================================
FILE: api_test.go
================================================
/*
 * Copyright 2021 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package sonic

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestValid(t *testing.T) {
	require.False(t, Valid(nil))

	testCase := []struct {
		data     string
		expected bool
	}{
		{``, false},
		{`s`, false},
		{`{`, false},
		{`[`, false},
		{`[1,2`, false},
		{`{"so":nic"}`, false},

		{`null`, true},
		{`""`, true},
		{`1`, true},
		{`"sonic"`, true},
		{`{}`, true},
		{`[]`, true},
		{`[1,2]`, true},
		{`{"so":"nic"}`, true},
	}
	for _, tc := range testCase {
		require.Equal(t, tc.expected, Valid([]byte(tc.data)), tc.data)
	}
}

func TestIdent(t *testing.T) {
	foo := struct {
		Name string
		Age  int
	}{
		Name: "sonic",
		Age:  20,
	}

	out, err := MarshalIndent(&foo, "", "  ")
	require.Nil(t, err)
	require.Equal(t, `{
  "Name": "sonic",
  "Age": 20
}`, string(out))
}


================================================
FILE: ast/api.go
================================================
//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)
// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1.27

/*
 * Copyright 2022 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"runtime"
	"unsafe"

	"github.com/bytedance/sonic/encoder"
	"github.com/bytedance/sonic/internal/encoder/alg"
	"github.com/bytedance/sonic/internal/native"
	"github.com/bytedance/sonic/internal/native/types"
	"github.com/bytedance/sonic/internal/rt"
	"github.com/bytedance/sonic/utf8"
)

var typeByte = rt.UnpackEface(byte(0)).Type

func quote(buf *[]byte, val string) {
	*buf = alg.Quote(*buf, val, false)
}

func (self *Parser) decodeValue() (val types.JsonState) {
	sv := (*rt.GoString)(unsafe.Pointer(&self.s))
	flag := types.F_USE_NUMBER
	if self.dbuf != nil {
		flag = 0
		val.Dbuf = self.dbuf
		val.Dcap = types.MaxDigitNums
	}
	self.p = native.Value(sv.Ptr, sv.Len, self.p, &val, uint64(flag))
	return
}

func (self *Parser) skip() (int, types.ParsingError) {
	fsm := types.NewStateMachine()
	start := native.SkipOne(&self.s, &self.p, fsm, 0)
	types.FreeStateMachine(fsm)

	if start < 0 {
		return self.p, types.ParsingError(-start)
	}
	return start, 0
}

func (self *Node) encodeInterface(buf *[]byte) error {
	//WARN: NOT compatible with json.Encoder
	return encoder.EncodeInto(buf, self.packAny(), encoder.NoEncoderNewline)
}

func (self *Parser) skipFast() (int, types.ParsingError) {
	start := native.SkipOneFast(&self.s, &self.p)
	if start < 0 {
		return self.p, types.ParsingError(-start)
	}
	return start, 0
}

func (self *Parser) getByPath(validate bool, path ...interface{}) (int, types.ParsingError) {
	var fsm *types.StateMachine
	if validate {
		fsm = types.NewStateMachine()
	}
	start := native.GetByPath(&self.s, &self.p, &path, fsm)
	if validate {
		types.FreeStateMachine(fsm)
	}
	runtime.KeepAlive(path)
	if start < 0 {
		return self.p, types.ParsingError(-start)
	}
	return start, 0
}

func validate_utf8(str string) bool {
	return utf8.ValidateString(str)
}


================================================
FILE: ast/api_compat.go
================================================
//go:build (!amd64 && !arm64) || go1.27 || !go1.17 || (arm64 && !go1.20)
// +build !amd64,!arm64 go1.27 !go1.17 arm64,!go1.20

/*
* Copyright 2022 ByteDance Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
 */

package ast

import (
	"encoding/json"
	"unicode/utf8"

	"github.com/bytedance/sonic/internal/compat"
	"github.com/bytedance/sonic/internal/native/types"
)

func init() {
	compat.Warn("sonic/ast")
}

func quote(buf *[]byte, val string) {
	quoteString(buf, val)
}

func (self *Parser) decodeValue() (val types.JsonState) {
	e, v := decodeValue(self.s, self.p, self.dbuf == nil)
	if e < 0 {
		return v
	}
	self.p = e
	return v
}

func (self *Parser) skip() (int, types.ParsingError) {
	e, s := skipValue(self.s, self.p)
	if e < 0 {
		return self.p, types.ParsingError(-e)
	}
	self.p = e
	return s, 0
}

func (self *Parser) skipFast() (int, types.ParsingError) {
	e, s := skipValueFast(self.s, self.p)
	if e < 0 {
		return self.p, types.ParsingError(-e)
	}
	self.p = e
	return s, 0
}

func (self *Node) encodeInterface(buf *[]byte) error {
	out, err := json.Marshal(self.packAny())
	if err != nil {
		return err
	}
	*buf = append(*buf, out...)
	return nil
}

func (self *Parser) getByPath(validate bool, path ...interface{}) (int, types.ParsingError) {
	for _, p := range path {
		if idx, ok := p.(int); ok && idx >= 0 {
			if err := self.searchIndex(idx); err != 0 {
				return self.p, err
			}
		} else if key, ok := p.(string); ok {
			if err := self.searchKey(key); err != 0 {
				return self.p, err
			}
		} else {
			panic("path must be either int(>=0) or string")
		}
	}

	var start int
	var e types.ParsingError
	if validate {
		start, e = self.skip()
	} else {
		start, e = self.skipFast()
	}
	if e != 0 {
		return self.p, e
	}
	return start, 0
}

func validate_utf8(str string) bool {
	return utf8.ValidString(str)
}


================================================
FILE: ast/api_native_test.go
================================================
//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)
// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1.27

/*
 * Copyright 2022 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"encoding/json"
	"fmt"
	"reflect"
	"runtime"
	"runtime/debug"
	"testing"

	"github.com/bytedance/sonic/encoder"
	"github.com/stretchr/testify/require"
)

func TestSortNodeTwitter(t *testing.T) {
	if encoder.EnableFallback {
		return
	}
	root, err := NewSearcher(_TwitterJson).GetByPath()
	if err != nil {
		t.Fatal(err)
	}
	obj, err := root.MapUseNumber()
	if err != nil {
		t.Fatal(err)
	}
	exp, err := encoder.Encode(obj, encoder.SortMapKeys|encoder.NoEncoderNewline)
	if err != nil {
		t.Fatal(err)
	}
	var expObj interface{}
	require.NoError(t, json.Unmarshal(exp, &expObj))

	if err := root.SortKeys(true); err != nil {
		t.Fatal(err)
	}
	act, err := root.MarshalJSON()
	if err != nil {
		t.Fatal(err)
	}
	var actObj interface{}
	require.NoError(t, json.Unmarshal(act, &actObj))
	require.Equal(t, expObj, actObj)
	require.Equal(t, len(exp), len(act))
	require.Equal(t, string(exp), string(act))
}

func TestNodeAny(t *testing.T) {
	empty := Node{}
	_, err := empty.SetAny("any", map[string]interface{}{"a": []int{0}})
	if err != nil {
		t.Fatal(err)
	}
	if m, err := empty.Get("any").Interface(); err != nil {
		t.Fatal(err)
	} else if v, ok := m.(map[string]interface{}); !ok {
		t.Fatal(v)
	}
	if buf, err := empty.MarshalJSON(); err != nil {
		t.Fatal(err)
	} else if string(buf) != `{"any":{"a":[0]}}` {
		t.Fatal(string(buf))
	}
	if _, err := empty.Set("any2", Node{}); err != nil {
		t.Fatal(err)
	}
	if err := empty.Get("any2").AddAny(nil); err != nil {
		t.Fatal(err)
	}
	if buf, err := empty.MarshalJSON(); err != nil {
		t.Fatal(err)
	} else if string(buf) != `{"any":{"a":[0]},"any2":[null]}` {
		t.Fatal(string(buf))
	}
	if _, err := empty.Get("any2").SetAnyByIndex(0, NewNumber("-0.0")); err != nil {
		t.Fatal(err)
	}
	if buf, err := empty.MarshalJSON(); err != nil {
		t.Fatal(err)
	} else if string(buf) != `{"any":{"a":[0]},"any2":[-0.0]}` {
		t.Fatal(string(buf))
	}
}

func TestTypeCast2(t *testing.T) {
	type tcase struct {
		method string
		node   Node
		exp    interface{}
		err    error
	}
	var cases = []tcase{
		{"Raw", NewAny(""), "\"\"", nil},
	}

	for i, c := range cases {
		fmt.Println(i, c)
		rt := reflect.ValueOf(&c.node)
		m := rt.MethodByName(c.method)
		rets := m.Call([]reflect.Value{})
		if len(rets) != 2 {
			t.Fatal(i, rets)
		}
		require.Equal(t, c.exp, rets[0].Interface())
		v := rets[1].Interface()
		if v != c.err {
			t.Fatal(i, v)
		}
	}
}

func TestStackAny(t *testing.T) {
	var obj = stackObj()
	any := NewAny(obj)
	fmt.Printf("any: %#v\n", any)
	runtime.GC()
	debug.FreeOSMemory()
	println("finish GC")
	buf, err := any.MarshalJSON()
	println("finish marshal")
	if err != nil {
		t.Fatal(err)
	}
	if string(buf) != "1" {
		t.Fatal(string(buf))
	}
}

func Test_Export(t *testing.T) {
	type args struct {
		src  string
		path []interface{}
	}
	tests := []struct {
		name      string
		args      args
		wantStart int
		wantEnd   int
		wantTyp   int
		wantErr   bool
		wantValid bool
	}{
		{"bool", args{`[true  ,2]`, []interface{}{0}}, 1, 5, V_TRUE, false, true},
		{"bool", args{`[t2ue  ,2]`, []interface{}{0}}, 1, 5, V_TRUE, false, false},
		{"number", args{`[1  ,2]`, []interface{}{0}}, 1, 2, V_NUMBER, false, true},
		{"number", args{`[1w ,2]`, []interface{}{0}}, 1, 3, V_NUMBER, false, false},
		{"string", args{`[" "  ,2]`, []interface{}{0}}, 1, 4, V_STRING, false, true},
		{"string", args{`[" "]  ,2]`, []interface{}{0}}, 1, 4, V_STRING, false, true},
		{"object", args{`[{"":""}  ,2]`, []interface{}{0}}, 1, 8, V_OBJECT, false, true},
		{"object", args{`[{x}  ,2]`, []interface{}{0}}, 1, 4, V_OBJECT, false, false},
		{"array", args{`[[{}]  ,2]`, []interface{}{0}}, 1, 5, V_ARRAY, false, true},
		{"array", args{`[[xx]  ,2]`, []interface{}{0}}, 1, 5, V_ARRAY, false, false},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			gotStart, gotEnd, gotTyp, err := _GetByPath(tt.args.src, tt.args.path...)
			if (err != nil) != tt.wantErr {
				t.Errorf("_GetByPath() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
			if gotStart != tt.wantStart {
				t.Errorf("_GetByPath() gotStart = %v, want %v", gotStart, tt.wantStart)
			}
			if gotEnd != tt.wantEnd {
				t.Errorf("_GetByPath() gotEnd = %v, want %v", gotEnd, tt.wantEnd)
			}
			if gotTyp != tt.wantTyp {
				t.Errorf("_GetByPath() gotTyp = %v, want %v", gotTyp, tt.wantTyp)
			}
			gotStart, gotEnd, err = _SkipFast(tt.args.src, tt.wantStart)
			if (err != nil) != tt.wantErr {
				t.Errorf("_SkipFast() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
			if gotStart != tt.wantStart {
				t.Errorf("_SkipFast() gotStart = %v, want %v", gotStart, tt.wantStart)
			}
			if gotEnd != tt.wantEnd {
				t.Errorf("_SkipFast() gotEnd = %v, want %v", gotEnd, tt.wantEnd)
			}
			valid := _ValidSyntax(tt.args.src[tt.wantStart:tt.wantEnd])
			if valid != tt.wantValid {
				t.Errorf("_ValidSyntax() gotValid = %v, want %v", valid, tt.wantValid)
			}
		})
	}
}


================================================
FILE: ast/asm.s
================================================


================================================
FILE: ast/buffer.go
================================================
/**
 * Copyright 2023 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"sort"
	"unsafe"

	"github.com/bytedance/sonic/internal/caching"
)

type nodeChunk [_DEFAULT_NODE_CAP]Node

type linkedNodes struct {
	head nodeChunk
	tail []*nodeChunk
	size int
}

func (self *linkedNodes) Cap() int {
	if self == nil {
		return 0
	}
	return (len(self.tail) + 1) * _DEFAULT_NODE_CAP
}

func (self *linkedNodes) Len() int {
	if self == nil {
		return 0
	}
	return self.size
}

func (self *linkedNodes) At(i int) *Node {
	if self == nil {
		return nil
	}
	if i >= 0 && i < self.size && i < _DEFAULT_NODE_CAP {
		return &self.head[i]
	} else if i >= _DEFAULT_NODE_CAP && i < self.size {
		a, b := i/_DEFAULT_NODE_CAP-1, i%_DEFAULT_NODE_CAP
		if a < len(self.tail) {
			return &self.tail[a][b]
		}
	}
	return nil
}

func (self *linkedNodes) MoveOne(source int, target int) {
	if source == target {
		return
	}
	if source < 0 || source >= self.size || target < 0 || target >= self.size {
		return
	}
	// reserve source
	n := *self.At(source)
	if source < target {
		// move every element (source,target] one step back
		for i := source; i < target; i++ {
			*self.At(i) = *self.At(i + 1)
		}
	} else {
		// move every element [target,source) one step forward
		for i := source; i > target; i-- {
			*self.At(i) = *self.At(i - 1)
		}
	}
	// set target
	*self.At(target) = n
}

func (self *linkedNodes) Pop() {
	if self == nil || self.size == 0 {
		return
	}
	self.Set(self.size-1, Node{})
	self.size--
}

func (self *linkedNodes) Push(v Node) {
	self.Set(self.size, v)
}

func (self *linkedNodes) Set(i int, v Node) {
	if i < _DEFAULT_NODE_CAP {
		self.head[i] = v
		if self.size <= i {
			self.size = i + 1
		}
		return
	}
	a, b := i/_DEFAULT_NODE_CAP-1, i%_DEFAULT_NODE_CAP
	if a < 0 {
		self.head[b] = v
	} else {
		self.growTailLength(a + 1)
		var n = &self.tail[a]
		if *n == nil {
			*n = new(nodeChunk)
		}
		(*n)[b] = v
	}
	if self.size <= i {
		self.size = i + 1
	}
}

func (self *linkedNodes) growTailLength(l int) {
	if l <= len(self.tail) {
		return
	}
	c := cap(self.tail)
	for c < l {
		c += 1 + c>>_APPEND_GROW_SHIFT
	}
	if c == cap(self.tail) {
		self.tail = self.tail[:l]
		return
	}
	tmp := make([]*nodeChunk, l, c)
	copy(tmp, self.tail)
	self.tail = tmp
}

func (self *linkedNodes) ToSlice(con []Node) {
	if len(con) < self.size {
		return
	}
	i := (self.size - 1)
	a, b := i/_DEFAULT_NODE_CAP-1, i%_DEFAULT_NODE_CAP
	if a < 0 {
		copy(con, self.head[:b+1])
		return
	} else {
		copy(con, self.head[:])
		con = con[_DEFAULT_NODE_CAP:]
	}

	for i := 0; i < a; i++ {
		copy(con, self.tail[i][:])
		con = con[_DEFAULT_NODE_CAP:]
	}
	copy(con, self.tail[a][:b+1])
}

func (self *linkedNodes) FromSlice(con []Node) {
	self.size = len(con)
	i := self.size - 1
	a, b := i/_DEFAULT_NODE_CAP-1, i%_DEFAULT_NODE_CAP
	if a < 0 {
		copy(self.head[:b+1], con)
		return
	} else {
		copy(self.head[:], con)
		con = con[_DEFAULT_NODE_CAP:]
	}

	if cap(self.tail) <= a {
		c := (a + 1) + (a+1)>>_APPEND_GROW_SHIFT
		self.tail = make([]*nodeChunk, a+1, c)
	}
	self.tail = self.tail[:a+1]

	for i := 0; i < a; i++ {
		self.tail[i] = new(nodeChunk)
		copy(self.tail[i][:], con)
		con = con[_DEFAULT_NODE_CAP:]
	}

	self.tail[a] = new(nodeChunk)
	copy(self.tail[a][:b+1], con)
}

type pairChunk [_DEFAULT_NODE_CAP]Pair

type linkedPairs struct {
	index map[uint64]int
	head  pairChunk
	tail  []*pairChunk
	size  int
}

func (self *linkedPairs) BuildIndex() {
	if self.index == nil {
		self.index = make(map[uint64]int, self.size)
	}
	for i := 0; i < self.size; i++ {
		p := self.At(i)
		self.index[p.hash] = i
	}
}

func (self *linkedPairs) Cap() int {
	if self == nil {
		return 0
	}
	return (len(self.tail) + 1) * _DEFAULT_NODE_CAP
}

func (self *linkedPairs) Len() int {
	if self == nil {
		return 0
	}
	return self.size
}

func (self *linkedPairs) At(i int) *Pair {
	if self == nil {
		return nil
	}
	if i >= 0 && i < _DEFAULT_NODE_CAP && i < self.size {
		return &self.head[i]
	} else if i >= _DEFAULT_NODE_CAP && i < self.size {
		a, b := i/_DEFAULT_NODE_CAP-1, i%_DEFAULT_NODE_CAP
		if a < len(self.tail) {
			return &self.tail[a][b]
		}
	}
	return nil
}

func (self *linkedPairs) Push(v Pair) {
	self.Set(self.size, v)
}

func (self *linkedPairs) Pop() {
	if self == nil || self.size == 0 {
		return
	}
	self.Unset(self.size - 1)
	self.size--
}

func (self *linkedPairs) Unset(i int) {
	if self.index != nil {
		p := self.At(i)
		delete(self.index, p.hash)
	}
	self.set(i, Pair{})
}

func (self *linkedPairs) Set(i int, v Pair) {
	if self.index != nil {
		h := v.hash
		self.index[h] = i
	}
	self.set(i, v)
}

func (self *linkedPairs) set(i int, v Pair) {
	if i < _DEFAULT_NODE_CAP {
		self.head[i] = v
		if self.size <= i {
			self.size = i + 1
		}
		return
	}
	a, b := i/_DEFAULT_NODE_CAP-1, i%_DEFAULT_NODE_CAP
	if a < 0 {
		self.head[b] = v
	} else {
		self.growTailLength(a + 1)
		var n = &self.tail[a]
		if *n == nil {
			*n = new(pairChunk)
		}
		(*n)[b] = v
	}
	if self.size <= i {
		self.size = i + 1
	}
}

func (self *linkedPairs) growTailLength(l int) {
	if l <= len(self.tail) {
		return
	}
	c := cap(self.tail)
	for c < l {
		c += 1 + c>>_APPEND_GROW_SHIFT
	}
	if c == cap(self.tail) {
		self.tail = self.tail[:l]
		return
	}
	tmp := make([]*pairChunk, l, c)
	copy(tmp, self.tail)
	self.tail = tmp
}

// linear search
func (self *linkedPairs) Get(key string) (*Pair, int) {
	if self.index != nil {
		// fast-path
		i, ok := self.index[caching.StrHash(key)]
		if ok {
			n := self.At(i)
			if n.Key == key {
				return n, i
			}
			// hash conflicts
			goto linear_search
		} else {
			return nil, -1
		}
	}
linear_search:
	for i := 0; i < self.size; i++ {
		if n := self.At(i); n.Key == key {
			return n, i
		}
	}
	return nil, -1
}

func (self *linkedPairs) ToSlice(con []Pair) {
	if len(con) < self.size {
		return
	}
	i := self.size - 1
	a, b := i/_DEFAULT_NODE_CAP-1, i%_DEFAULT_NODE_CAP

	if a < 0 {
		copy(con, self.head[:b+1])
		return
	} else {
		copy(con, self.head[:])
		con = con[_DEFAULT_NODE_CAP:]
	}

	for i := 0; i < a; i++ {
		copy(con, self.tail[i][:])
		con = con[_DEFAULT_NODE_CAP:]
	}
	copy(con, self.tail[a][:b+1])
}

func (self *linkedPairs) ToMap(con map[string]Node) {
	for i := 0; i < self.size; i++ {
		n := self.At(i)
		con[n.Key] = n.Value
	}
}

func (self *linkedPairs) copyPairs(to []Pair, from []Pair, l int) {
	copy(to, from)
	if self.index != nil {
		for i := 0; i < l; i++ {
			// NOTICE: in case of user not pass hash, just cal it
			h := caching.StrHash(from[i].Key)
			from[i].hash = h
			self.index[h] = i
		}
	}
}

func (self *linkedPairs) FromSlice(con []Pair) {
	self.size = len(con)
	i := self.size - 1
	a, b := i/_DEFAULT_NODE_CAP-1, i%_DEFAULT_NODE_CAP
	if a < 0 {
		self.copyPairs(self.head[:b+1], con, b+1)
		return
	} else {
		self.copyPairs(self.head[:], con, len(self.head))
		con = con[_DEFAULT_NODE_CAP:]
	}

	if cap(self.tail) <= a {
		c := (a + 1) + (a+1)>>_APPEND_GROW_SHIFT
		self.tail = make([]*pairChunk, a+1, c)
	}
	self.tail = self.tail[:a+1]

	for i := 0; i < a; i++ {
		self.tail[i] = new(pairChunk)
		self.copyPairs(self.tail[i][:], con, len(self.tail[i]))
		con = con[_DEFAULT_NODE_CAP:]
	}

	self.tail[a] = new(pairChunk)
	self.copyPairs(self.tail[a][:b+1], con, b+1)
}

func (self *linkedPairs) Less(i, j int) bool {
	return lessFrom(self.At(i).Key, self.At(j).Key, 0)
}

func (self *linkedPairs) Swap(i, j int) {
	a, b := self.At(i), self.At(j)
	if self.index != nil {
		self.index[a.hash] = j
		self.index[b.hash] = i
	}
	*a, *b = *b, *a
}

func (self *linkedPairs) Sort() {
	sort.Stable(self)
}

// Compare two strings from the pos d.
func lessFrom(a, b string, d int) bool {
	l := len(a)
	if l > len(b) {
		l = len(b)
	}
	for i := d; i < l; i++ {
		if a[i] == b[i] {
			continue
		}
		return a[i] < b[i]
	}
	return len(a) < len(b)
}

type parseObjectStack struct {
	parser Parser
	v      linkedPairs
}

type parseArrayStack struct {
	parser Parser
	v      linkedNodes
}

func newLazyArray(p *Parser) Node {
	s := new(parseArrayStack)
	s.parser = *p
	return Node{
		t: _V_ARRAY_LAZY,
		p: unsafe.Pointer(s),
	}
}

func newLazyObject(p *Parser) Node {
	s := new(parseObjectStack)
	s.parser = *p
	return Node{
		t: _V_OBJECT_LAZY,
		p: unsafe.Pointer(s),
	}
}

func (self *Node) getParserAndArrayStack() (*Parser, *parseArrayStack) {
	stack := (*parseArrayStack)(self.p)
	return &stack.parser, stack
}

func (self *Node) getParserAndObjectStack() (*Parser, *parseObjectStack) {
	stack := (*parseObjectStack)(self.p)
	return &stack.parser, stack
}


================================================
FILE: ast/buffer_test.go
================================================
/**
 * Copyright 2023 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"strconv"
	"testing"

	"github.com/stretchr/testify/require"
)

func makeNodes(l int) []Node {
	r := make([]Node, l)
	for i := 0; i < l; i++ {
		r[i] = NewBool(true)
	}
	return r
}

func makePairs(l int) []Pair {
	r := make([]Pair, l)
	for i := 0; i < l; i++ {
		r[i] = NewPair(strconv.Itoa(i), NewBool(true))
	}
	return r
}

func Test_linkedPairs_Push(t *testing.T) {
	type args struct {
		in  []Pair
		v   Pair
		exp []Pair
	}
	tests := []struct {
		name string
		args args
	}{
		{
			name: "add empty",
			args: args{
				in:  []Pair{},
				v:   NewPair("a", NewBool(true)),
				exp: []Pair{NewPair("a", NewBool(true))},
			},
		},
		{
			name: "add one",
			args: args{
				in:  []Pair{NewPair("a", NewBool(false))},
				v:   NewPair("b", NewBool(true)),
				exp: []Pair{NewPair("a", NewBool(false)), NewPair("b", NewBool(true))},
			},
		},
		{
			name: "add _DEFAULT_NODE_CAP",
			args: args{
				in:  makePairs(_DEFAULT_NODE_CAP),
				v:   NewPair(strconv.Itoa(_DEFAULT_NODE_CAP), NewBool(true)),
				exp: makePairs(_DEFAULT_NODE_CAP + 1),
			},
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			self := &linkedPairs{}
			self.FromSlice(tt.args.in)
			self.Push(tt.args.v)
			act := make([]Pair, self.Len())
			self.ToSlice(act)
			require.Equal(t, tt.args.exp, act)
		})
	}
}

func Test_linkedNodes_Push(t *testing.T) {
	type args struct {
		in  []Node
		v   Node
		exp []Node
	}
	tests := []struct {
		name string
		args args
	}{
		{
			name: "add empty",
			args: args{
				in:  []Node{},
				v:   NewBool(true),
				exp: []Node{NewBool(true)},
			},
		},
		{
			name: "add one",
			args: args{
				in:  []Node{NewBool(false)},
				v:   NewBool(true),
				exp: []Node{NewBool(false), NewBool(true)},
			},
		},
		{
			name: "add _DEFAULT_NODE_CAP",
			args: args{
				in:  makeNodes(_DEFAULT_NODE_CAP),
				v:   NewBool(true),
				exp: makeNodes(_DEFAULT_NODE_CAP + 1),
			},
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			self := &linkedNodes{}
			self.FromSlice(tt.args.in)
			self.Push(tt.args.v)
			act := make([]Node, self.Len())
			self.ToSlice(act)
			require.Equal(t, tt.args.exp, act)
		})
	}
}

func Test_linkedNodes_Pop(t *testing.T) {
	type args struct {
		in  []Node
		exp []Node
	}
	tests := []struct {
		name string
		args args
	}{
		{
			name: "remove empty",
			args: args{
				in:  []Node{},
				exp: []Node{},
			},
		},
		{
			name: "remove one",
			args: args{
				in:  []Node{NewBool(false)},
				exp: []Node{},
			},
		},
		{
			name: "add _DEFAULT_NODE_CAP",
			args: args{
				in:  makeNodes(_DEFAULT_NODE_CAP),
				exp: makeNodes(_DEFAULT_NODE_CAP - 1),
			},
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			self := &linkedNodes{}
			self.FromSlice(tt.args.in)
			self.Pop()
			act := make([]Node, self.Len())
			self.ToSlice(act)
			require.Equal(t, tt.args.exp, act)
		})
	}
}

func Test_linkedNodes_MoveOne(t *testing.T) {
	type args struct {
		in     []Node
		source int
		target int
		exp    []Node
	}
	tests := []struct {
		name string
		args args
	}{
		{
			name: "over index",
			args: args{
				in:     []Node{NewBool(true)},
				source: 1,
				target: 0,
				exp:    []Node{NewBool(true)},
			},
		},
		{
			name: "equal index",
			args: args{
				in:     []Node{NewBool(true)},
				source: 0,
				target: 0,
				exp:    []Node{NewBool(true)},
			},
		},
		{
			name: "forward index",
			args: args{
				in:     []Node{NewString("a"), NewString("b"), NewString("c")},
				source: 0,
				target: 2,
				exp:    []Node{NewString("b"), NewString("c"), NewString("a")},
			},
		},
		{
			name: "backward index",
			args: args{
				in:     []Node{NewString("a"), NewString("b"), NewString("c")},
				source: 2,
				target: 1,
				exp:    []Node{NewString("a"), NewString("c"), NewString("b")},
			},
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			self := &linkedNodes{}
			self.FromSlice(tt.args.in)
			self.MoveOne(tt.args.source, tt.args.target)
			act := make([]Node, self.Len())
			self.ToSlice(act)
			require.Equal(t, tt.args.exp, act)
		})
	}
}


================================================
FILE: ast/decode.go
================================================
/*
 * Copyright 2022 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"encoding/base64"
	"runtime"
	"strconv"
	"unsafe"

	"github.com/bytedance/sonic/internal/native/types"
	"github.com/bytedance/sonic/internal/rt"
	"github.com/bytedance/sonic/internal/utils"
	"github.com/bytedance/sonic/unquote"
)

var bytesNull = []byte("null")

const (
	strNull     = "null"
	bytesTrue   = "true"
	bytesFalse  = "false"
	bytesObject = "{}"
	bytesArray  = "[]"
)

//go:nocheckptr
func skipBlank(src string, pos int) int {
	se := uintptr(rt.IndexChar(src, len(src)))
	sp := uintptr(rt.IndexChar(src, pos))

	for sp < se {
		if !utils.IsSpace(*(*byte)(unsafe.Pointer(sp))) {
			break
		}
		sp += 1
	}
	if sp >= se {
		return -int(types.ERR_EOF)
	}
	runtime.KeepAlive(src)
	return int(sp - uintptr(rt.IndexChar(src, 0)))
}

func decodeNull(src string, pos int) (ret int) {
	ret = pos + 4
	if ret > len(src) {
		return -int(types.ERR_EOF)
	}
	if src[pos:ret] == strNull {
		return ret
	} else {
		return -int(types.ERR_INVALID_CHAR)
	}
}

func decodeTrue(src string, pos int) (ret int) {
	ret = pos + 4
	if ret > len(src) {
		return -int(types.ERR_EOF)
	}
	if src[pos:ret] == bytesTrue {
		return ret
	} else {
		return -int(types.ERR_INVALID_CHAR)
	}

}

func decodeFalse(src string, pos int) (ret int) {
	ret = pos + 5
	if ret > len(src) {
		return -int(types.ERR_EOF)
	}
	if src[pos:ret] == bytesFalse {
		return ret
	}
	return -int(types.ERR_INVALID_CHAR)
}

//go:nocheckptr
func decodeString(src string, pos int) (ret int, v string) {
	ret, ep := skipString(src, pos)
	if ep == -1 {
		(*rt.GoString)(unsafe.Pointer(&v)).Ptr = rt.IndexChar(src, pos+1)
		(*rt.GoString)(unsafe.Pointer(&v)).Len = ret - pos - 2
		return ret, v
	}

	result, err := unquote.String(src[pos:ret])
	if err != 0 {
		return -int(types.ERR_INVALID_CHAR), ""
	}

	runtime.KeepAlive(src)
	return ret, result
}

func decodeBinary(src string, pos int) (ret int, v []byte) {
	var vv string
	ret, vv = decodeString(src, pos)
	if ret < 0 {
		return ret, nil
	}
	var err error
	v, err = base64.StdEncoding.DecodeString(vv)
	if err != nil {
		return -int(types.ERR_INVALID_CHAR), nil
	}
	return ret, v
}

func isDigit(c byte) bool {
	return c >= '0' && c <= '9'
}

//go:nocheckptr
func decodeInt64(src string, pos int) (ret int, v int64, err error) {
	sp := uintptr(rt.IndexChar(src, pos))
	ss := uintptr(sp)
	se := uintptr(rt.IndexChar(src, len(src)))
	if uintptr(sp) >= se {
		return -int(types.ERR_EOF), 0, nil
	}

	if c := *(*byte)(unsafe.Pointer(sp)); c == '-' {
		sp += 1
	}
	if sp == se {
		return -int(types.ERR_EOF), 0, nil
	}

	for ; sp < se; sp += uintptr(1) {
		if !isDigit(*(*byte)(unsafe.Pointer(sp))) {
			break
		}
	}

	if sp < se {
		if c := *(*byte)(unsafe.Pointer(sp)); c == '.' || c == 'e' || c == 'E' {
			return -int(types.ERR_INVALID_NUMBER_FMT), 0, nil
		}
	}

	var vv string
	ret = int(uintptr(sp) - uintptr((*rt.GoString)(unsafe.Pointer(&src)).Ptr))
	(*rt.GoString)(unsafe.Pointer(&vv)).Ptr = unsafe.Pointer(ss)
	(*rt.GoString)(unsafe.Pointer(&vv)).Len = ret - pos

	v, err = strconv.ParseInt(vv, 10, 64)
	if err != nil {
		//NOTICE: allow overflow here
		if err.(*strconv.NumError).Err == strconv.ErrRange {
			return ret, 0, err
		}
		return -int(types.ERR_INVALID_CHAR), 0, err
	}

	runtime.KeepAlive(src)
	return ret, v, nil
}

func isNumberChars(c byte) bool {
	return (c >= '0' && c <= '9') || c == '+' || c == '-' || c == 'e' || c == 'E' || c == '.'
}

//go:nocheckptr
func decodeFloat64(src string, pos int) (ret int, v float64, err error) {
	sp := uintptr(rt.IndexChar(src, pos))
	ss := uintptr(sp)
	se := uintptr(rt.IndexChar(src, len(src)))
	if uintptr(sp) >= se {
		return -int(types.ERR_EOF), 0, nil
	}

	if c := *(*byte)(unsafe.Pointer(sp)); c == '-' {
		sp += 1
	}
	if sp == se {
		return -int(types.ERR_EOF), 0, nil
	}

	for ; sp < se; sp += uintptr(1) {
		if !isNumberChars(*(*byte)(unsafe.Pointer(sp))) {
			break
		}
	}

	var vv string
	ret = int(uintptr(sp) - uintptr((*rt.GoString)(unsafe.Pointer(&src)).Ptr))
	(*rt.GoString)(unsafe.Pointer(&vv)).Ptr = unsafe.Pointer(ss)
	(*rt.GoString)(unsafe.Pointer(&vv)).Len = ret - pos

	v, err = strconv.ParseFloat(vv, 64)
	if err != nil {
		//NOTICE: allow overflow here
		if err.(*strconv.NumError).Err == strconv.ErrRange {
			return ret, 0, err
		}
		return -int(types.ERR_INVALID_CHAR), 0, err
	}

	runtime.KeepAlive(src)
	return ret, v, nil
}

func decodeValue(src string, pos int, skipnum bool) (ret int, v types.JsonState) {
	pos = skipBlank(src, pos)
	if pos < 0 {
		return pos, types.JsonState{Vt: types.ValueType(pos)}
	}
	switch c := src[pos]; c {
	case 'n':
		ret = decodeNull(src, pos)
		if ret < 0 {
			return ret, types.JsonState{Vt: types.ValueType(ret)}
		}
		return ret, types.JsonState{Vt: types.V_NULL}
	case '"':
		var ep int
		ret, ep = skipString(src, pos)
		if ret < 0 {
			return ret, types.JsonState{Vt: types.ValueType(ret)}
		}
		return ret, types.JsonState{Vt: types.V_STRING, Iv: int64(pos + 1), Ep: ep}
	case '{':
		return pos + 1, types.JsonState{Vt: types.V_OBJECT}
	case '[':
		return pos + 1, types.JsonState{Vt: types.V_ARRAY}
	case 't':
		ret = decodeTrue(src, pos)
		if ret < 0 {
			return ret, types.JsonState{Vt: types.ValueType(ret)}
		}
		return ret, types.JsonState{Vt: types.V_TRUE}
	case 'f':
		ret = decodeFalse(src, pos)
		if ret < 0 {
			return ret, types.JsonState{Vt: types.ValueType(ret)}
		}
		return ret, types.JsonState{Vt: types.V_FALSE}
	case '-', '+', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
		if skipnum {
			ret = skipNumber(src, pos)
			if ret >= 0 {
				return ret, types.JsonState{Vt: types.V_DOUBLE, Iv: 0, Ep: pos}
			} else {
				return ret, types.JsonState{Vt: types.ValueType(ret)}
			}
		} else {
			var iv int64
			ret, iv, _ = decodeInt64(src, pos)
			if ret >= 0 {
				return ret, types.JsonState{Vt: types.V_INTEGER, Iv: iv, Ep: pos}
			} else if ret != -int(types.ERR_INVALID_NUMBER_FMT) {
				return ret, types.JsonState{Vt: types.ValueType(ret)}
			}
			var fv float64
			ret, fv, _ = decodeFloat64(src, pos)
			if ret >= 0 {
				return ret, types.JsonState{Vt: types.V_DOUBLE, Dv: fv, Ep: pos}
			} else {
				return ret, types.JsonState{Vt: types.ValueType(ret)}
			}
		}

	default:
		return -int(types.ERR_INVALID_CHAR), types.JsonState{Vt: -types.ValueType(types.ERR_INVALID_CHAR)}
	}
}

//go:nocheckptr
func skipNumber(src string, pos int) (ret int) {
	return utils.SkipNumber(src, pos)
}

//go:nocheckptr
func skipString(src string, pos int) (ret int, ep int) {
	if pos+1 >= len(src) {
		return -int(types.ERR_EOF), -1
	}

	sp := uintptr(rt.IndexChar(src, pos))
	se := uintptr(rt.IndexChar(src, len(src)))

	// not start with quote
	if *(*byte)(unsafe.Pointer(sp)) != '"' {
		return -int(types.ERR_INVALID_CHAR), -1
	}
	sp += 1

	ep = -1
	for sp < se {
		c := *(*byte)(unsafe.Pointer(sp))
		if c == '\\' {
			if ep == -1 {
				ep = int(uintptr(sp) - uintptr((*rt.GoString)(unsafe.Pointer(&src)).Ptr))
			}
			sp += 2
			continue
		}
		sp += 1
		if c == '"' {
			return int(uintptr(sp) - uintptr((*rt.GoString)(unsafe.Pointer(&src)).Ptr)), ep
		}
	}

	runtime.KeepAlive(src)
	// not found the closed quote until EOF
	return -int(types.ERR_EOF), -1
}

//go:nocheckptr
func skipPair(src string, pos int, lchar byte, rchar byte) (ret int) {
	if pos+1 >= len(src) {
		return -int(types.ERR_EOF)
	}

	sp := uintptr(rt.IndexChar(src, pos))
	se := uintptr(rt.IndexChar(src, len(src)))

	if *(*byte)(unsafe.Pointer(sp)) != lchar {
		return -int(types.ERR_INVALID_CHAR)
	}

	sp += 1
	nbrace := 1
	inquote := false

	for sp < se {
		c := *(*byte)(unsafe.Pointer(sp))
		if c == '\\' {
			sp += 2
			continue
		} else if c == '"' {
			inquote = !inquote
		} else if c == lchar {
			if !inquote {
				nbrace += 1
			}
		} else if c == rchar {
			if !inquote {
				nbrace -= 1
				if nbrace == 0 {
					sp += 1
					break
				}
			}
		}
		sp += 1
	}

	if nbrace != 0 {
		return -int(types.ERR_INVALID_CHAR)
	}

	runtime.KeepAlive(src)
	return int(uintptr(sp) - uintptr((*rt.GoString)(unsafe.Pointer(&src)).Ptr))
}

func skipValueFast(src string, pos int) (ret int, start int) {
	pos = skipBlank(src, pos)
	if pos < 0 {
		return pos, -1
	}
	switch c := src[pos]; c {
	case 'n':
		ret = decodeNull(src, pos)
	case '"':
		ret, _ = skipString(src, pos)
	case '{':
		ret = skipPair(src, pos, '{', '}')
	case '[':
		ret = skipPair(src, pos, '[', ']')
	case 't':
		ret = decodeTrue(src, pos)
	case 'f':
		ret = decodeFalse(src, pos)
	case '-', '+', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
		ret = skipNumber(src, pos)
	default:
		ret = -int(types.ERR_INVALID_CHAR)
	}
	return ret, pos
}

func skipValue(src string, pos int) (ret int, start int) {
	pos = skipBlank(src, pos)
	if pos < 0 {
		return pos, -1
	}
	switch c := src[pos]; c {
	case 'n':
		ret = decodeNull(src, pos)
	case '"':
		ret, _ = skipString(src, pos)
	case '{':
		ret, _ = skipObject(src, pos)
	case '[':
		ret, _ = skipArray(src, pos)
	case 't':
		ret = decodeTrue(src, pos)
	case 'f':
		ret = decodeFalse(src, pos)
	case '-', '+', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
		ret = skipNumber(src, pos)
	default:
		ret = -int(types.ERR_INVALID_CHAR)
	}
	return ret, pos
}

func skipObject(src string, pos int) (ret int, start int) {
	start = skipBlank(src, pos)
	if start < 0 {
		return start, -1
	}

	if src[start] != '{' {
		return -int(types.ERR_INVALID_CHAR), -1
	}

	pos = start + 1
	pos = skipBlank(src, pos)
	if pos < 0 {
		return pos, -1
	}
	if src[pos] == '}' {
		return pos + 1, start
	}

	for {
		pos, _ = skipString(src, pos)
		if pos < 0 {
			return pos, -1
		}

		pos = skipBlank(src, pos)
		if pos < 0 {
			return pos, -1
		}
		if src[pos] != ':' {
			return -int(types.ERR_INVALID_CHAR), -1
		}

		pos++
		pos, _ = skipValue(src, pos)
		if pos < 0 {
			return pos, -1
		}

		pos = skipBlank(src, pos)
		if pos < 0 {
			return pos, -1
		}
		if src[pos] == '}' {
			return pos + 1, start
		}
		if src[pos] != ',' {
			return -int(types.ERR_INVALID_CHAR), -1
		}

		pos++
		pos = skipBlank(src, pos)
		if pos < 0 {
			return pos, -1
		}

	}
}

func skipArray(src string, pos int) (ret int, start int) {
	start = skipBlank(src, pos)
	if start < 0 {
		return start, -1
	}

	if src[start] != '[' {
		return -int(types.ERR_INVALID_CHAR), -1
	}

	pos = start + 1
	pos = skipBlank(src, pos)
	if pos < 0 {
		return pos, -1
	}
	if src[pos] == ']' {
		return pos + 1, start
	}

	for {
		pos, _ = skipValue(src, pos)
		if pos < 0 {
			return pos, -1
		}

		pos = skipBlank(src, pos)
		if pos < 0 {
			return pos, -1
		}
		if src[pos] == ']' {
			return pos + 1, start
		}
		if src[pos] != ',' {
			return -int(types.ERR_INVALID_CHAR), -1
		}
		pos++
	}
}

// DecodeString decodes a JSON string from pos and return golang string.
//   - needEsc indicates if to unescaped escaping chars
//   - hasEsc tells if the returned string has escaping chars
//   - validStr enables validating UTF8 charset
func _DecodeString(src string, pos int, needEsc bool, validStr bool) (v string, ret int, hasEsc bool) {
	p := NewParserObj(src)
	p.p = pos
	switch val := p.decodeValue(); val.Vt {
	case types.V_STRING:
		str := p.s[val.Iv : p.p-1]
		if validStr && !validate_utf8(str) {
			return "", -int(types.ERR_INVALID_UTF8), false
		}
		/* fast path: no escape sequence */
		if val.Ep == -1 {
			return str, p.p, false
		} else if !needEsc {
			return str, p.p, true
		}
		/* unquote the string */
		out, err := unquote.String(str)
		/* check for errors */
		if err != 0 {
			return "", -int(err), true
		} else {
			return out, p.p, true
		}
	default:
		return "", -int(_ERR_UNSUPPORT_TYPE), false
	}
}


================================================
FILE: ast/decode_test.go
================================================
/*
 * Copyright 2022 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"testing"
	"unicode/utf8"

	"github.com/bytedance/sonic/internal/rt"
)

func Test_DecodeString(t *testing.T) {
	type args struct {
		src      string
		pos      int
		needEsc  bool
		validStr bool
	}
	invalidstr := rt.Mem2Str([]byte{'"', 193, 255, '"'})
	println(utf8.ValidString(invalidstr))

	tests := []struct {
		name       string
		args       args
		wantV      string
		wantRet    int
		wantHasEsc bool
	}{
		{"empty", args{`""`, 0, false, false}, "", 2, false},
		{"one", args{`"1"`, 0, false, false}, "1", 3, false},
		{"escape", args{`"\\"`, 0, false, false}, `\\`, 4, true},
		{"escape", args{`"\\"`, 0, true, true}, `\`, 4, true},
		{"uft8", args{`"\u263a"`, 0, false, false}, `\u263a`, 8, true},
		{"uft8", args{`"\u263a"`, 0, true, true}, `☺`, 8, true},
		{"invalid uft8", args{`"\xx"`, 0, false, false}, `\xx`, 5, true},
		{"invalid escape", args{`"\xx"`, 0, false, true}, `\xx`, 5, true},
		{"invalid escape", args{`"\xx"`, 0, true, true}, ``, -3, true},
		{"invalid string", args{invalidstr, 0, false, false}, invalidstr[1:3], 4, false},
		{"invalid string", args{invalidstr, 0, true, true}, "", -10, false},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			gotV, gotRet, gotHasEsc := _DecodeString(tt.args.src, tt.args.pos, tt.args.needEsc, tt.args.validStr)
			if gotV != tt.wantV {
				t.Errorf("_DecodeString() gotV = %v, want %v", gotV, tt.wantV)
			}
			if gotRet != tt.wantRet {
				t.Errorf("_DecodeString() gotRet = %v, want %v", gotRet, tt.wantRet)
			}
			if gotHasEsc != tt.wantHasEsc {
				t.Errorf("_DecodeString() gotHasEsc = %v, want %v", gotHasEsc, tt.wantHasEsc)
			}
		})
	}
}


================================================
FILE: ast/encode.go
================================================
/*
 * Copyright 2021 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"sync"
	"unicode/utf8"

	"github.com/bytedance/gopkg/lang/dirtmake"
	"github.com/bytedance/sonic/internal/rt"
	"github.com/bytedance/sonic/option"
)

func quoteString(e *[]byte, s string) {
	*e = append(*e, '"')
	start := 0
	for i := 0; i < len(s); {
		if b := s[i]; b < utf8.RuneSelf {
			if rt.SafeSet[b] {
				i++
				continue
			}
			if start < i {
				*e = append(*e, s[start:i]...)
			}
			*e = append(*e, '\\')
			switch b {
			case '\\', '"':
				*e = append(*e, b)
			case '\n':
				*e = append(*e, 'n')
			case '\r':
				*e = append(*e, 'r')
			case '\t':
				*e = append(*e, 't')
			default:
				// This encodes bytes < 0x20 except for \t, \n and \r.
				// If escapeHTML is set, it also escapes <, >, and &
				// because they can lead to security holes when
				// user-controlled strings are rendered into JSON
				// and served to some browsers.
				*e = append(*e, `u00`...)
				*e = append(*e, rt.Hex[b>>4])
				*e = append(*e, rt.Hex[b&0xF])
			}
			i++
			start = i
			continue
		}
		c, size := utf8.DecodeRuneInString(s[i:])
		// if c == utf8.RuneError && size == 1 {
		//     if start < i {
		//         e.Write(s[start:i])
		//     }
		//     e.WriteString(`\ufffd`)
		//     i += size
		//     start = i
		//     continue
		// }
		if c == '\u2028' || c == '\u2029' {
			if start < i {
				*e = append(*e, s[start:i]...)
			}
			*e = append(*e, `\u202`...)
			*e = append(*e, rt.Hex[c&0xF])
			i += size
			start = i
			continue
		}
		i += size
	}
	if start < len(s) {
		*e = append(*e, s[start:]...)
	}
	*e = append(*e, '"')
}

var bytesPool = sync.Pool{}

func (self *Node) MarshalJSON() ([]byte, error) {
	if self == nil {
		return bytesNull, nil
	}

	// fast path for raw node
	if self.isRaw() {
		return rt.Str2Mem(self.toString()), nil
	}

	buf := newBuffer()
	err := self.encode(buf)
	if err != nil {
		freeBuffer(buf)
		return nil, err
	}
	var ret []byte
	if !rt.CanSizeResue(cap(*buf)) {
		ret = *buf
	} else {
		ret = dirtmake.Bytes(len(*buf), len(*buf))
		copy(ret, *buf)
		freeBuffer(buf)
	}
	return ret, err
}

func newBuffer() *[]byte {
	if ret := bytesPool.Get(); ret != nil {
		return ret.(*[]byte)
	} else {
		buf := make([]byte, 0, option.DefaultAstBufferSize)
		return &buf
	}
}

func freeBuffer(buf *[]byte) {
	if !rt.CanSizeResue(cap(*buf)) {
		return
	}
	*buf = (*buf)[:0]
	bytesPool.Put(buf)
}

func (self *Node) encode(buf *[]byte) error {
	if self.isRaw() {
		return self.encodeRaw(buf)
	}
	switch int(self.itype()) {
	case V_NONE:
		return ErrNotExist
	case V_ERROR:
		return self.Check()
	case V_NULL:
		return self.encodeNull(buf)
	case V_TRUE:
		return self.encodeTrue(buf)
	case V_FALSE:
		return self.encodeFalse(buf)
	case V_ARRAY:
		return self.encodeArray(buf)
	case V_OBJECT:
		return self.encodeObject(buf)
	case V_STRING:
		return self.encodeString(buf)
	case V_NUMBER:
		return self.encodeNumber(buf)
	case V_ANY:
		return self.encodeInterface(buf)
	default:
		return ErrUnsupportType
	}
}

func (self *Node) encodeRaw(buf *[]byte) error {
	lock := self.rlock()
	if !self.isRaw() {
		self.runlock()
		return self.encode(buf)
	}
	raw := self.toString()
	if lock {
		self.runlock()
	}
	*buf = append(*buf, raw...)
	return nil
}

func (self *Node) encodeNull(buf *[]byte) error {
	*buf = append(*buf, strNull...)
	return nil
}

func (self *Node) encodeTrue(buf *[]byte) error {
	*buf = append(*buf, bytesTrue...)
	return nil
}

func (self *Node) encodeFalse(buf *[]byte) error {
	*buf = append(*buf, bytesFalse...)
	return nil
}

func (self *Node) encodeNumber(buf *[]byte) error {
	str := self.toString()
	*buf = append(*buf, str...)
	return nil
}

func (self *Node) encodeString(buf *[]byte) error {
	if self.l == 0 {
		*buf = append(*buf, '"', '"')
		return nil
	}

	quote(buf, self.toString())
	return nil
}

func (self *Node) encodeArray(buf *[]byte) error {
	if self.isLazy() {
		if err := self.skipAllIndex(); err != nil {
			return err
		}
	}

	nb := self.len()
	if nb == 0 {
		*buf = append(*buf, bytesArray...)
		return nil
	}

	*buf = append(*buf, '[')

	var started bool
	for i := 0; i < nb; i++ {
		n := self.nodeAt(i)
		if !n.Exists() {
			continue
		}
		if started {
			*buf = append(*buf, ',')
		}
		started = true
		if err := n.encode(buf); err != nil {
			return err
		}
	}

	*buf = append(*buf, ']')
	return nil
}

func (self *Pair) encode(buf *[]byte) error {
	if len(*buf) == 0 {
		*buf = append(*buf, '"', '"', ':')
		return self.Value.encode(buf)
	}

	quote(buf, self.Key)
	*buf = append(*buf, ':')

	return self.Value.encode(buf)
}

func (self *Node) encodeObject(buf *[]byte) error {
	if self.isLazy() {
		if err := self.skipAllKey(); err != nil {
			return err
		}
	}

	nb := self.len()
	if nb == 0 {
		*buf = append(*buf, bytesObject...)
		return nil
	}

	*buf = append(*buf, '{')

	var started bool
	for i := 0; i < nb; i++ {
		n := self.pairAt(i)
		if n == nil || !n.Value.Exists() {
			continue
		}
		if started {
			*buf = append(*buf, ',')
		}
		started = true
		if err := n.encode(buf); err != nil {
			return err
		}
	}

	*buf = append(*buf, '}')
	return nil
}


================================================
FILE: ast/encode_test.go
================================================
/*
 * Copyright 2021 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"encoding/json"
	"runtime"
	"strings"
	"sync"
	"testing"

	"github.com/bytedance/sonic/internal/native/types"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestGC_Encode(t *testing.T) {
	if debugSyncGC {
		return
	}
	root, err := NewSearcher(_TwitterJson).GetByPath()
	if err != nil {
		t.Fatal(err)
	}
	root.LoadAll()
	_, err = root.MarshalJSON()
	if err != nil {
		t.Fatal(err)
	}
	wg := &sync.WaitGroup{}
	N := 10000
	for i := 0; i < N; i++ {
		wg.Add(1)
		go func(wg *sync.WaitGroup) {
			defer wg.Done()
			root, err := NewSearcher(_TwitterJson).GetByPath()
			if err != nil {
				t.Error(err)
				return
			}
			root.Load()
			_, err = root.MarshalJSON()
			if err != nil {
				t.Error(err)
				return
			}
			runtime.GC()
		}(wg)
	}
	wg.Wait()
}

func TestEncodeValue(t *testing.T) {
	obj := new(_TwitterStruct)
	if err := json.Unmarshal([]byte(_TwitterJson), obj); err != nil {
		t.Fatal(err)
	}
	// buf, err := encoder.Encode(obj, encoder.EscapeHTML|encoder.SortMapKeys)
	buf, err := json.Marshal(obj)
	if err != nil {
		t.Fatal(err)
	}
	quote, err := json.Marshal(_TwitterJson)
	if err != nil {
		t.Fatal(err)
	}
	type Case struct {
		node Node
		exp  string
		err  bool
	}
	input := []Case{
		{NewNull(), "null", false},
		{NewBool(true), "true", false},
		{NewBool(false), "false", false},
		{NewNumber("0.0"), "0.0", false},
		{NewString(""), `""`, false},
		{NewString(`\"\"`), `"\\\"\\\""`, false},
		{NewString(_TwitterJson), string(quote), false},
		{NewArray([]Node{}), "[]", false},
		{NewArray([]Node{NewString(""), NewNull()}), `["",null]`, false},
		{NewArray([]Node{NewBool(true), NewString("true"), NewString("\t")}), `[true,"true","\t"]`, false},
		{NewObject([]Pair{NewPair("a", NewNull()), NewPair("b", NewNumber("0"))}), `{"a":null,"b":0}`, false},
		{NewObject([]Pair{NewPair("\ta", NewString("\t")), NewPair("\bb", NewString("\b")), NewPair("\nb", NewString("\n")), NewPair("\ra", NewString("\r"))}), `{"\ta":"\t","\u0008b":"\u0008","\nb":"\n","\ra":"\r"}`, false},
		{NewObject([]Pair{}), `{}`, false},
		{NewObject([]Pair{Pair{Key: "", Value: NewNull()}}), `{"":null}`, false},
		{NewBytes([]byte("hello, world")), `"aGVsbG8sIHdvcmxk"`, false},
		{NewAny(obj), string(buf), false},
		{NewRaw(`[{ }]`), "[{}]", false},
		{Node{}, "", true},
		{Node{t: types.ValueType(1)}, "", true},
	}
	for i, c := range input {
		t.Log(i)
		buf, err := json.Marshal(&c.node)
		if c.err {
			if err == nil {
				t.Fatal(i)
			}
			continue
		}
		if err != nil {
			t.Fatal(i, err)
		}
		assert.Equal(t, c.exp, string(buf))
	}
}

func BenchmarkNil(b *testing.B) {
	for i := 0; i < b.N; i++ {
		null := (*Node)(nil)
		_, _ = null.MarshalJSON()
	}
}

func TestEncodeNode(t *testing.T) {
	null := (*Node)(nil)
	js, err := null.MarshalJSON()
	if err != nil {
		t.Fatal(err)
	}
	if string(js) != "null" {
		t.Fatal(string(js))
	}

	data := `{"a":[{},[],-0.1,true,false,null,""],"b":0,"c":true,"d":false,"e":null,"g":""}`
	root, e := NewSearcher(data).GetByPath()
	if e != nil {
		t.Fatal(root)
	}
	ret, err := root.MarshalJSON()
	if err != nil {
		t.Fatal(err)
	}
	if string(ret) != data {
		t.Fatal(string(ret))
	}
	root.skipAllKey()
	ret, err = root.MarshalJSON()
	if err != nil {
		t.Fatal(err)
	}
	if string(ret) != data {
		t.Fatal(string(ret))
	}
	root.Load()
	ret, err = root.MarshalJSON()
	if err != nil {
		t.Fatal(err)
	}
	if string(ret) != data {
		t.Fatal(string(ret))
	}
}

type SortableNode struct {
	sorted bool
	*Node
}

func (j *SortableNode) UnmarshalJSON(data []byte) error {
	j.Node = new(Node)
	return j.Node.UnmarshalJSON(data)
}

func (j *SortableNode) MarshalJSON() ([]byte, error) {
	if !j.sorted {
		j.Node.SortKeys(true)
		j.sorted = true
	}
	return j.Node.MarshalJSON()
}

func TestMarshalSort(t *testing.T) {
	var data = `{"d":3,"a":{"c":1,"b":2},"e":null}`
	var obj map[string]*SortableNode
	require.NoError(t, json.Unmarshal([]byte(data), &obj))
	out, err := json.Marshal(obj)
	require.NoError(t, err)
	require.Equal(t, `{"a":{"b":2,"c":1},"d":3,"e":null}`, string(out))
	out, err = json.Marshal(obj)
	require.NoError(t, err)
	require.Equal(t, `{"a":{"b":2,"c":1},"d":3,"e":null}`, string(out))
}

func BenchmarkEncodeRaw_Sonic(b *testing.B) {
	data := _TwitterJson
	root, e := NewSearcher(data).GetByPath()
	if e != nil {
		b.Fatal(root)
	}
	_, err := root.MarshalJSON()
	if err != nil {
		b.Fatal(err)
	}
	b.SetBytes(int64(len(data)))
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		_, err := root.MarshalJSON()
		if err != nil {
			b.Fatal(err)
		}
	}
}

func BenchmarkEncodeSkip_Sonic(b *testing.B) {
	data := _TwitterJson
	root, e := NewParser(data).Parse()
	if e != 0 {
		b.Fatal(root)
	}
	root.skipAllKey()
	_, err := root.MarshalJSON()
	if err != nil {
		b.Fatal(err)
	}
	b.SetBytes(int64(len(data)))
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		_, err := root.MarshalJSON()
		if err != nil {
			b.Fatal(err)
		}
	}
}

func BenchmarkEncodeLoad_Sonic(b *testing.B) {
	data := _TwitterJson
	root, e := NewParser(data).Parse()
	if e != 0 {
		b.Fatal(root)
	}
	root.Load()
	_, err := root.MarshalJSON()
	if err != nil {
		b.Fatal(err)
	}
	b.SetBytes(int64(len(data)))
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		_, err := root.MarshalJSON()
		if err != nil {
			b.Fatal(err)
		}
	}
}

func TestEncodeNone(t *testing.T) {
	n := NewObject([]Pair{{Key: "a", Value: Node{}}})
	out, err := n.MarshalJSON()
	require.NoError(t, err)
	require.Equal(t, "{}", string(out))
	n = NewObject([]Pair{{Key: "a", Value: NewNull()}, {Key: "b", Value: Node{}}})
	out, err = n.MarshalJSON()
	require.NoError(t, err)
	require.Equal(t, `{"a":null}`, string(out))

	n = NewArray([]Node{Node{}})
	out, err = n.MarshalJSON()
	require.NoError(t, err)
	require.Equal(t, "[]", string(out))
	n = NewArray([]Node{NewNull(), Node{}})
	out, err = n.MarshalJSON()
	require.NoError(t, err)
	require.Equal(t, `[null]`, string(out))
}

type Path = []interface{}

type testGetApi struct {
	json string
	path Path
}

type checkError func(error) bool

func isSyntaxError(err error) bool {
	if err == nil {
		return false
	}
	return strings.HasPrefix(err.Error(), `"Syntax error at index`)
}

func isEmptySource(err error) bool {
	if err == nil {
		return false
	}
	return strings.Contains(err.Error(), "no sources available")
}

func isErrNotExist(err error) bool {
	return err == ErrNotExist
}

func isErrUnsupportType(err error) bool {
	return err == ErrUnsupportType
}

func testSyntaxJson(t *testing.T, json string, path ...interface{}) {
	search := NewSearcher(json)
	_, err := search.GetByPath(path...)
	assert.True(t, isSyntaxError(err))
}

func TestGetFromEmptyJson(t *testing.T) {
	tests := []testGetApi{
		{"", nil},
		{"", Path{}},
		{"", Path{""}},
		{"", Path{0}},
		{"", Path{"", ""}},
	}
	for _, test := range tests {
		f := func(t *testing.T) {
			search := NewSearcher(test.json)
			_, err := search.GetByPath(test.path...)
			assert.True(t, isEmptySource(err))
		}
		t.Run(test.json, f)
	}
}

func TestGetFromSyntaxError(t *testing.T) {
	tests := []testGetApi{
		{" \r\n\f\t", Path{}},
		{"123.", Path{}},
		{"+124", Path{}},
		{"-", Path{}},
		{"-e123", Path{}},
		{"-1.e123", Path{}},
		{"-12e456.1", Path{}},
		{"-12e.1", Path{}},
		{"[", Path{}},
		{"{", Path{}},
		{"[}", Path{}},
		{"{]", Path{}},
		{"{,}", Path{}},
		{"[,]", Path{}},
		{"tru", Path{}},
		{"fals", Path{}},
		{"nul", Path{}},
		{`{"a":"`, Path{"a"}},
		{`{"`, Path{}},
		{`"`, Path{}},
		{`"\"`, Path{}},
		{`"\\\"`, Path{}},
		{`"hello`, Path{}},
		{`{{}}`, Path{}},
		{`{[]}`, Path{}},
		{`{:,}`, Path{}},
		{`{test:error}`, Path{}},
		{`{":true}`, Path{}},
		{`{"" false}`, Path{}},
		{`{ "" : "false }`, Path{}},
		{`{"":"",}`, Path{}},
		{`{ " test : true}`, Path{}},
		{`{ "test" : tru }`, Path{}},
		{`{ "test" : true , }`, Path{}},
		{`{ {"test" : true , } }`, Path{}},
		{`{"test":1. }`, Path{}},
		{`{"\\\""`, Path{}},
		{`{"\\\"":`, Path{}},
		{`{"\\\":",""}`, Path{}},
		{`[{]`, Path{}},
		{`[tru]`, Path{}},
		{`[-1.]`, Path{}},
		{`[[]`, Path{}},
		{`[[],`, Path{}},
		{`[ true , false , [ ]`, Path{}},
		{`[true, false, [],`, Path{}},
		{`[true, false, [],]`, Path{}},
		{`{"key": [true, false, []], "key2": {{}}`, Path{}},
	}

	for _, test := range tests {
		f := func(t *testing.T) {
			testSyntaxJson(t, test.json, test.path...)
			path := append(Path{"key"}, test.path...)
			testSyntaxJson(t, `{"key":`+test.json, path...)
			path = append(Path{""}, test.path...)
			testSyntaxJson(t, `{"":`+test.json, path...)
			path = append(Path{1}, test.path...)
			testSyntaxJson(t, `["",`+test.json, path...)
		}
		t.Run(test.json, f)
	}
}

// NOTE: GetByPath API not validate the undemanded fields for performance.
func TestGetWithInvalidUndemandedField(t *testing.T) {
	type Any = interface{}
	tests := []struct {
		json string
		path Path
		exp  Any
	}{
		{"-0xyz", Path{}, Any(float64(-0))},
		{"-12e4xyz", Path{}, Any(float64(-12e4))},
		{"truex", Path{}, Any(true)},
		{"false,", Path{}, Any(false)},
		{`{"a":{,xxx},"b":true}`, Path{"b"}, Any(true)},
		{`{"a":[,xxx],"b":true}`, Path{"b"}, Any(true)},
	}

	for _, test := range tests {
		f := func(t *testing.T) {
			search := NewSearcher(test.json)
			node, err := search.GetByPath(test.path...)
			assert.NoError(t, err)
			v, err := node.Interface()
			assert.NoError(t, err)
			assert.Equal(t, v, test.exp)
		}
		t.Run(test.json, f)
	}
}

func TestGet_InvalidPathType(t *testing.T) {
	assert.Panics(t, assert.PanicTestFunc(func() {
		data := `{"a":[{"b":true}]}`
		s := NewSearcher(data)
		s.GetByPath("a", true)

		s = NewSearcher(data)
		s.GetByPath("a", nil)

		s = NewSearcher(data)
		s.GetByPath("a", -1)
	}))
}


================================================
FILE: ast/error.go
================================================
package ast

import (
	"fmt"
	"strings"
	"unsafe"

	"github.com/bytedance/sonic/internal/native/types"
)

func newError(err types.ParsingError, msg string) *Node {
	return &Node{
		t: V_ERROR,
		l: uint(err),
		p: unsafe.Pointer(&msg),
	}
}

func newErrorPair(err SyntaxError) *Pair {
	return &Pair{0, "", *newSyntaxError(err)}
}

// Error returns error message if the node is invalid
func (self Node) Error() string {
	if self.t != V_ERROR {
		return ""
	} else {
		return *(*string)(self.p)
	}
}

func newSyntaxError(err SyntaxError) *Node {
	msg := err.Description()
	return &Node{
		t: V_ERROR,
		l: uint(err.Code),
		p: unsafe.Pointer(&msg),
	}
}

func (self *Parser) syntaxError(err types.ParsingError) SyntaxError {
	return SyntaxError{
		Pos:  self.p,
		Src:  self.s,
		Code: err,
	}
}

func unwrapError(err error) *Node {
	if se, ok := err.(*Node); ok {
		return se
	} else if sse, ok := err.(Node); ok {
		return &sse
	} else {
		msg := err.Error()
		return &Node{
			t: V_ERROR,
			p: unsafe.Pointer(&msg),
		}
	}
}

type SyntaxError struct {
	Pos  int
	Src  string
	Code types.ParsingError
	Msg  string
}

func (self SyntaxError) Error() string {
	return fmt.Sprintf("%q", self.Description())
}

func (self SyntaxError) Description() string {
	return "Syntax error " + self.description()
}

func (self SyntaxError) description() string {
	i := 16
	p := self.Pos - i
	q := self.Pos + i

	/* check for empty source */
	if self.Src == "" {
		return fmt.Sprintf("no sources available, the input json is empty: %#v", self)
	}

	/* prevent slicing before the beginning */
	if p < 0 {
		p, q, i = 0, q-p, i+p
	}

	/* prevent slicing beyond the end */
	if n := len(self.Src); q > n {
		n = q - n
		q = len(self.Src)

		/* move the left bound if possible */
		if p > n {
			i += n
			p -= n
		}
	}

	/* left and right length */
	x := clamp_zero(i)
	y := clamp_zero(q - p - i - 1)

	/* compose the error description */
	return fmt.Sprintf(
		"at index %d: %s\n\n\t%s\n\t%s^%s\n",
		self.Pos,
		self.Message(),
		self.Src[p:q],
		strings.Repeat(".", x),
		strings.Repeat(".", y),
	)
}

func (self SyntaxError) Message() string {
	if self.Msg == "" {
		return self.Code.Message()
	}
	return self.Msg
}

func clamp_zero(v int) int {
	if v < 0 {
		return 0
	} else {
		return v
	}
}


================================================
FILE: ast/iterator.go
================================================
/*
 * Copyright 2021 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"fmt"

	"github.com/bytedance/sonic/internal/caching"
	"github.com/bytedance/sonic/internal/native/types"
)

type Pair struct {
	hash  uint64
	Key   string
	Value Node
}

func NewPair(key string, val Node) Pair {
	return Pair{
		hash:  caching.StrHash(key),
		Key:   key,
		Value: val,
	}
}

// Values returns iterator for array's children traversal
func (self *Node) Values() (ListIterator, error) {
	if err := self.should(types.V_ARRAY); err != nil {
		return ListIterator{}, err
	}
	return self.values(), nil
}

func (self *Node) values() ListIterator {
	return ListIterator{Iterator{p: self}}
}

// Properties returns iterator for object's children traversal
func (self *Node) Properties() (ObjectIterator, error) {
	if err := self.should(types.V_OBJECT); err != nil {
		return ObjectIterator{}, err
	}
	return self.properties(), nil
}

func (self *Node) properties() ObjectIterator {
	return ObjectIterator{Iterator{p: self}}
}

type Iterator struct {
	i int
	p *Node
}

func (self *Iterator) Pos() int {
	return self.i
}

func (self *Iterator) Len() int {
	return self.p.len()
}

// HasNext reports if it is the end of iteration or has error.
func (self *Iterator) HasNext() bool {
	if !self.p.isLazy() {
		return self.p.Valid() && self.i < self.p.len()
	} else if self.p.t == _V_ARRAY_LAZY {
		return self.p.skipNextNode().Valid()
	} else if self.p.t == _V_OBJECT_LAZY {
		pair := self.p.skipNextPair()
		if pair == nil {
			return false
		}
		return pair.Value.Valid()
	}
	return false
}

// ListIterator is specialized iterator for V_ARRAY
type ListIterator struct {
	Iterator
}

// ObjectIterator is specialized iterator for V_ARRAY
type ObjectIterator struct {
	Iterator
}

func (self *ListIterator) next() *Node {
next_start:
	if !self.HasNext() {
		return nil
	} else {
		n := self.p.nodeAt(self.i)
		self.i++
		if !n.Exists() {
			goto next_start
		}
		return n
	}
}

// Next scans through children of underlying V_ARRAY,
// copies each child to v, and returns .HasNext().
func (self *ListIterator) Next(v *Node) bool {
	n := self.next()
	if n == nil {
		return false
	}
	*v = *n
	return true
}

func (self *ObjectIterator) next() *Pair {
next_start:
	if !self.HasNext() {
		return nil
	} else {
		n := self.p.pairAt(self.i)
		self.i++
		if n == nil || !n.Value.Exists() {
			goto next_start
		}
		return n
	}
}

// Next scans through children of underlying V_OBJECT,
// copies each child to v, and returns .HasNext().
func (self *ObjectIterator) Next(p *Pair) bool {
	n := self.next()
	if n == nil {
		return false
	}
	*p = *n
	return true
}

// Sequence represents scanning path of single-layer nodes.
// Index indicates the value's order in both V_ARRAY and V_OBJECT json.
// Key is the value's key (for V_OBJECT json only, otherwise it will be nil).
type Sequence struct {
	Index int
	Key   *string
	// Level int
}

// String is string representation of one Sequence
func (s Sequence) String() string {
	k := ""
	if s.Key != nil {
		k = *s.Key
	}
	return fmt.Sprintf("Sequence(%d, %q)", s.Index, k)
}

type Scanner func(path Sequence, node *Node) bool

// ForEach scans one V_OBJECT node's children from JSON head to tail,
// and pass the Sequence and Node of corresponding JSON value.
//
// Especially, if the node is not V_ARRAY or V_OBJECT,
// the node itself will be returned and Sequence.Index == -1.
//
// NOTICE: An unset node WON'T trigger sc, but its index still counts into Path.Index
func (self *Node) ForEach(sc Scanner) error {
	if err := self.checkRaw(); err != nil {
		return err
	}
	switch self.itype() {
	case types.V_ARRAY:
		iter, err := self.Values()
		if err != nil {
			return err
		}
		v := iter.next()
		for v != nil {
			if !sc(Sequence{iter.i - 1, nil}, v) {
				return nil
			}
			v = iter.next()
		}
	case types.V_OBJECT:
		iter, err := self.Properties()
		if err != nil {
			return err
		}
		v := iter.next()
		for v != nil {
			if !sc(Sequence{iter.i - 1, &v.Key}, &v.Value) {
				return nil
			}
			v = iter.next()
		}
	default:
		if self.Check() != nil {
			return self
		}
		sc(Sequence{-1, nil}, self)
	}
	return nil
}


================================================
FILE: ast/iterator_test.go
================================================
/*
 * Copyright 2021 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"fmt"
	"strconv"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func getTestIteratorSample(loop int) (string, int) {
	var data []int
	var v1 = ""
	var v2 = ""
	for i := 0; i < loop; i++ {
		data = append(data, i*i)
		v1 += strconv.Itoa(i)
		v2 += `"k` + strconv.Itoa(i) + `":` + strconv.Itoa(i)
		if i != loop-1 {
			v1 += `,`
			v2 += `,`
		}
	}
	return `{"array":[` + v1 + `], "object":{` + v2 + `}}`, loop
}

func TestForEach(t *testing.T) {
	pathes := []Sequence{}
	values := []*Node{}
	sc := func(path Sequence, node *Node) bool {
		pathes = append(pathes, path)
		values = append(values, node)
		if path.Key != nil && *path.Key == "array" {
			node.ForEach(func(path Sequence, node *Node) bool {
				pathes = append(pathes, path)
				values = append(values, node)
				return true
			})
		}
		return true
	}

	str, _ := getTestIteratorSample(3)
	fmt.Println(str)
	root, err := NewSearcher(str).GetByPath()
	if err != nil {
		t.Fatal(err)
	}
	err = root.ForEach(sc)
	if err != nil {
		t.Fatal(err)
	}
	eObjKey := "object"
	eArrKey := "array"
	expPath := []Sequence{
		{0, &eArrKey},
		{0, nil},
		{1, nil},
		{2, nil},
		{1, &eObjKey},
	}
	expValue := []*Node{
		root.Get("array"),
		root.GetByPath("array", 0),
		root.GetByPath("array", 1),
		root.GetByPath("array", 2),
		root.Get("object"),
	}
	// fmt.Printf("pathes:%+v\n", pathes)
	// fmt.Printf("values:%+v\n", values)
	assert.Equal(t, expPath, pathes)
	assert.Equal(t, expValue, values)

}

func TestRawIterator(t *testing.T) {
	str, loop := getTestIteratorSample(_DEFAULT_NODE_CAP)
	fmt.Println(str)

	root, err := NewSearcher(str).GetByPath("array")
	if err != nil {
		t.Fatal(err)
	}
	ai, _ := root.Values()
	i := int64(0)
	for ai.HasNext() {
		v := &Node{}
		if !ai.Next(v) {
			t.Fatalf("no next")
		}
		x, _ := v.Int64()
		if i < int64(loop) && x != i {
			t.Fatalf("exp:%v, got:%v", i, v)
		}
		if i != int64(ai.Pos())-1 || i >= int64(ai.Len()) {
			t.Fatal(i)
		}
		i++
	}
	if i != int64(loop) {
		t.Fatal(i)
	}

	root, err = NewSearcher(str).GetByPath("object")
	if err != nil {
		t.Fatal(err)
	}
	mi, _ := root.Properties()
	i = int64(0)
	for mi.HasNext() {
		v := &Pair{}
		if !mi.Next(v) {
			t.Fatalf("no next")
		}
		x, _ := v.Value.Int64()
		if i < int64(loop) && (x != i || v.Key != fmt.Sprintf("k%d", i)) {
			vv, _ := v.Value.Interface()
			t.Fatalf("exp:%v, got:%v", i, vv)
		}
		if i != int64(mi.Pos())-1 || i >= int64(mi.Len()) {
			t.Fatal(i)
		}
		i++
	}
	if i != int64(loop) {
		t.Fatal(i)
	}
}

func TestIterator(t *testing.T) {
	str, loop := getTestIteratorSample(_DEFAULT_NODE_CAP)
	fmt.Println(str)

	root, err := NewParser(str).Parse()
	if err != 0 {
		t.Fatal(err)
	}
	ai, _ := root.Get("array").Values()
	i := int64(0)
	for ai.HasNext() {
		v := &Node{}
		if !ai.Next(v) {
			t.Fatalf("no next")
		}
		x, _ := v.Int64()
		if i < int64(loop) && x != i {
			t.Fatalf("exp:%v, got:%v", i, v)
		}
		if i != int64(ai.Pos())-1 || i >= int64(ai.Len()) {
			t.Fatal(i)
		}
		i++
	}
	if i != int64(loop) {
		t.Fatal(i)
	}

	root, err = NewParser(str).Parse()
	if err != 0 {
		t.Fatal(err)
	}
	mi, _ := root.Get("object").Properties()
	i = int64(0)
	for mi.HasNext() {
		v := &Pair{}
		if !mi.Next(v) {
			t.Fatalf("no next")
		}
		x, _ := v.Value.Int64()
		if i < int64(loop) && (x != i || v.Key != fmt.Sprintf("k%d", i)) {
			vv, _ := v.Value.Interface()
			t.Fatalf("exp:%v, got:%v", i, vv)
		}
		if i != int64(mi.Pos())-1 || i >= int64(mi.Len()) {
			t.Fatal(i)
		}
		i++
	}
	if i != int64(loop) {
		t.Fatal(i)
	}

	str, _ = getTestIteratorSample(0)
	root, err = NewParser(str).Parse()
	if err != 0 {
		t.Fatal(err)
	}
	mi, _ = root.Get("object").Properties()
	if mi.HasNext() {
		t.Fatalf("should not have next")
	}
}

func TestExist(t *testing.T) {
	n := NewRaw(`null`)
	if !n.Exists() {
		t.Fatal()
	}
	nn := n.Get("xx")
	if nn.Exists() {
		t.Fatal()
	}

	root := NewRaw(`{"a":1, "b":[1,2], "c":{"1":1, "2":2}}`)
	if !root.Exists() {
		t.Fatal()
	}
	exi, err := root.Unset("a")
	if !exi || err != nil {
		t.Fatal(exi, err)
	}

	root.ForEach(func(path Sequence, node *Node) bool {
		if path.Key != nil && *path.Key == "a" {
			t.Fatal()
		}
		if path.Index == 0 {
			if *path.Key != "b" {
				t.Fatal()
			}
			exi, err := node.UnsetByIndex(1)
			if !exi || err != nil {
				t.Fatal(exi, err)
			}
			node.ForEach(func(path Sequence, node *Node) bool {
				if path.Index == 1 {
					t.Fatal()
				}
				return true
			})
		}

		if path.Index == 1 {
			if *path.Key != "c" {
				t.Fatal()
			}
			exi, err := node.UnsetByIndex(1)
			if !exi || err != nil {
				t.Fatal(exi, err)
			}
			node.ForEach(func(path Sequence, node *Node) bool {
				if path.Index == 1 {
					t.Fatal()
				}
				return true
			})
		}
		return true
	})

	out, err := root.Raw()
	if err != nil {
		t.Fatal(err)
	}
	require.Equal(t, `{"b":[1],"c":{"1":1}}`, out)

}

func BenchmarkArrays(b *testing.B) {
	for i := 0; i < b.N; i++ {
		root, err := NewSearcher(_TwitterJson).GetByPath("statuses", 1, "entities", "hashtags")
		if err != nil {
			b.Fatal(err)
		}
		a, _ := root.Array()
		for _, v := range a {
			_ = v
		}
	}
}

func BenchmarkListIterator(b *testing.B) {
	for i := 0; i < b.N; i++ {
		root, err := NewSearcher(_TwitterJson).GetByPath("statuses", 1, "entities", "hashtags")
		if err != nil {
			b.Fatal(err)
		}
		it, _ := root.Values()
		for it.HasNext() {
			v := &Node{}
			if !it.Next(v) {
				b.Fatalf("no value")
			}
		}
	}
}

func BenchmarkMap(b *testing.B) {
	for i := 0; i < b.N; i++ {
		root, err := NewSearcher(_TwitterJson).GetByPath("statuses", 1, "user")
		if err != nil {
			b.Fatal(err)
		}
		m, _ := root.Map()
		for k, v := range m {
			_ = v
			_ = k
		}
	}
}

func BenchmarkObjectIterator(b *testing.B) {
	for i := 0; i < b.N; i++ {
		root, err := NewSearcher(_TwitterJson).GetByPath("statuses", 1, "user")
		if err != nil {
			b.Fatal(err)
		}
		it, _ := root.Properties()
		for it.HasNext() {
			v := &Pair{}
			if !it.Next(v) {
				b.Fatalf("no value")
			}
		}
	}
}


================================================
FILE: ast/node.go
================================================
/*
 * Copyright 2021 ByteDance Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ast

import (
	"encoding/json"
	"fmt"
	"strconv"
	"sync"
	"sync/atomic"
	"unsafe"

	"github.com/bytedance/sonic/internal/native/types"
	"github.com/bytedance/sonic/internal/rt"
)

const (
	_V_NONE        types.ValueType = 0
	_V_NODE_BASE   types.ValueType = 1 << 5
	_V_LAZY        types.ValueType = 1 << 7
	_V_RAW         types.ValueType = 1 << 8
	_V_NUMBER                      = _V_NODE_BASE + 1
	_V_ANY                         = _V_NODE_BASE + 2
	_V_ARRAY_LAZY                  = _V_LAZY | types.V_ARRAY
	_V_OBJECT_LAZY                 = _V_LAZY | types.V_OBJECT
	_MASK_LAZY                     = _V_LAZY - 1
	_MASK_RAW                      = _V_RAW - 1
)

const (
	V_NONE   = 0
	V_ERROR  = 1
	V_NULL   = int(types.V_NULL)
	V_TRUE   = int(types.V_TRUE)
	V_FALSE  = int(types.V_FALSE)
	V_ARRAY  = int(types.V_ARRAY)
	V_OBJECT = int(types.V_OBJECT)
	V_STRING = int(types.V_STRING)
	V_NUMBER = int(_V_NUMBER)
	V_ANY    = int(_V_ANY)
)

type Node struct {
	t types.ValueType
	l uint
	p unsafe.Pointer
	m *sync.RWMutex
}

// UnmarshalJSON is just an adapter to json.Unmarshaler.
// If you want better performance, use Searcher.GetByPath() directly
func (self *Node) UnmarshalJSON(data []byte) (err error) {
	*self = newRawNode(rt.Mem2Str(data), switchRawType(data[0]), false)
	return nil
}

/** Node Type Accessor **/

// Type returns json type represented by the node
// It will be one of bellows:
//
//	V_NONE   = 0 (empty node, key not exists)
//	V_ERROR  = 1 (error node)
//	V_NULL   = 2 (json value `null`, key exists)
//	V_TRUE   = 3 (json value `true`)
//	V_FALSE  = 4 (json value `false`)
//	V_ARRAY  = 5 (json value array)
//	V_OBJECT = 6 (json value object)
//	V_STRING = 7 (json value string)
//	V_NUMBER = 33 (json value number )
//	V_ANY    = 34 (golang interface{})
//
// Deprecated: not concurrent safe. Use TypeSafe instead
func (self Node) Type() int {
	return int(self.t & _MASK_LAZY & _MASK_RAW)
}

// Type concurrently-safe returns json type represented by the node
// It will be one of bellows:
//
//	V_NONE   = 0 (empty node, key not exists)
//	V_ERROR  = 1 (error node)
//	V_NULL   = 2 (json value `null`, key exists)
//	V_TRUE   = 3 (json value `true`)
//	V_FALSE  = 4 (json value `false`)
//	V_ARRAY  = 5 (json value array)
//	V_OBJECT = 6 (json value object)
//	V_STRING = 7 (json value string)
//	V_NUMBER = 33 (json value number )
//	V_ANY    = 34 (golang interface{})
func (self *Node) TypeSafe() int {
	return int(self.loadt() & _MASK_LAZY & _MASK_RAW)
}

func (self *Node) itype() types.ValueType {
	return self.t & _MASK_LAZY & _MASK_RAW
}

// Exists returns false only if the self is nil or empty node V_NONE
func (self *Node) Exists() bool {
	if self == nil {
		return false
	}
	t := self.loadt()
	return t != V_ERROR && t != _V_NONE
}

// Valid reports if self is NOT V_ERROR or nil
func (self *Node) Valid() bool {
	if self == nil {
		return false
	}
	return self.loadt() != V_ERROR
}

// Check checks if the node itself is valid, and return:
//   - ErrNotExist If the node is nil
//   - Its underlying error If the node is V_ERROR
func (self *Node) Check() error {
	if self == nil {
		return ErrNotExist
	} else if self.loadt() != V_ERROR {
		return nil
	} else {
		return self
	}
}

func (self *Node) checkFast() error {
	if self == nil {
		return ErrNotExist
	} else if self.t != V_ERROR {
		return nil
	} else {
		return self
	}
}

// isRaw returns true if node's underlying value is raw json
//
// Deprecated: not concurrent safe
func (self Node) IsRaw() bool {
	return self.t&_V_RAW != 0
}

// IsRaw returns true if node's underlying value is raw json
func (self *Node) isRaw() bool {
	return self.loadt()&_V_RAW != 0
}

func (self *Node) isLazy() bool {
	return self != nil && self.t&_V_LAZY != 0
}

func (self *Node) isAny() bool {
	return self != nil && self.loadt() == _V_ANY
}

/** Simple Value Methods **/

// Raw returns json representation of the node,
func (self *Node) Raw() (string, error) {
	if self == nil {
		return "", ErrNotExist
	}
	lock := self.rlock()
	if !self.isRaw() {
		if lock {
			self.runlock()
		}
		buf, err := self.MarshalJSON()
		return rt.Mem2Str(buf), err
	}
	ret := self.toString()
	if lock {
		self.runlock()
	}
	return ret, nil
}

func (self *Node) checkRaw() error {
	if self == nil {
		return ErrNotExist
	}

	t := self.loadt()
	if t == V_ERROR {
		return self
	}

	if t&_V_RAW != 0 {
		self.parseRaw(false)
	}

	return self.checkFast()
}

// Bool returns bool value represented by this node,
// including types.V_TRUE|V_FALSE|V_NUMBER|V_STRING|V_ANY|V_NULL,
// V_NONE will return error
func (self *Node) Bool() (bool, error) {
	if err := self.checkRaw(); err != nil {
		return false, err
	}
	switch self.t {
	case types.V_TRUE:
		return true, nil
	case types.V_FALSE:
		return false, nil
	case types.V_NULL:
		return false, nil
	case _V_NUMBER:
		if i, err := self.toInt64(); err == nil {
			return i != 0, nil
		} else if f, err := self.toFloat64(); err == nil {
			return f != 0, nil
		} else {
			return false, err
		}
	case types.V_STRING:
		return strconv.ParseBool(self.toString())
	case _V_ANY:
		any := self.packAny()
		switch v := any.(type) {
		case bool:
			return v, nil
		case int:
			return v != 0, nil
		case int8:
			return v != 0, nil
		case int16:
			return v != 0, nil
		case int32:
			return v != 0, nil
		case int64:
			return v != 0, nil
		case uint:
			return v != 0, nil
		case uint8:
			return v != 0, nil
		case uint16:
			return v != 0, nil
		case uint32:
			return v != 0, nil
		case uint64:
			return v != 0, nil
		case float32:
			return v != 0, nil
		case float64:
			return v != 0, nil
		case string:
			return strconv.ParseBool(v)
		case json.Number:
			if i, err := v.Int64(); err == nil {
				return i != 0, nil
			} else if f, err := v.Float64(); err == nil {
				return f != 0, nil
			} else {
				return false, err
			}
		default:
			return false, ErrUnsupportType
		}
	default:
		return false, ErrUnsupportType
	}
}

// Int64 casts the node to int64 value,
// including V_NUMBER|V_TRUE|V_FALSE|V_ANY|V_STRING
// V_NONE it will return error
func (self *Node) Int64() (int64, error) {
	if err := self.checkRaw(); err != nil {
		return 0, err
	}
	switch self.t {
	case _V_NUMBER, types.V_STRING:
		if i, err := self.toInt64(); err == nil {
			return i, nil
		} else if f, err := self.toFloat64(); err == nil {
			return int64(f), nil
		} else {
			return 0, err
		}
	case types.V_TRUE:
		return 1, nil
	case types.V_FALSE:
		return 0, nil
	case types.V_NULL:
		return 0, nil
	case _V_ANY:
		any := self.packAny()
		switch v := any.(type) {
		case bool:
			if v {
				return 1, nil
			} else {
				return 0, nil
			}
		case int:
			return int64(v), nil
		case int8:
			return int64(v), nil
		case int16:
			return int64(v), nil
		case int32:
			return int64(v), nil
		case int64:
			return int64(v), nil
		case uint:
			return int64(v), nil
		case uint8:
			return int64(v), nil
		case uint16:
			return int64(v), nil
		case uint32:
			return int64(v), nil
		case uint64:
			return int64(v), nil
		case float32:
			return int64(v), nil
		case float64:
			return int64(v), nil
		case string:
			if i, err := strconv.ParseInt(v, 10, 64); err == nil {
				return i, nil
			} else if f, err := strconv.ParseFloat(v, 64); err == nil {
				return int64(f), nil
			} else {
				return 0, err
			}
		case json.Number:
			if i, err := v.Int64(); err == nil {
				return i, nil
			} else if f, err := v.Float64(); err == nil {
				return int64(f), nil
			} else {
				return 0, err
			}
		default:
			return 0, ErrUnsupportType
		}
	default:
		return 0, ErrUnsupportType
	}
}

// StrictInt64 exports underlying int64 value, including V_NUMBER, V_ANY
func (self *Node) StrictInt64() (int64, error) {
	if err := self.checkRaw(); err != nil {
		return 0, err
	}
	switch self.t {
	case _V_NUMBER:
		return self.toInt64()
	case _V_ANY:
		any := self.packAny()
		switch v := any.(type) {
		case int:
			return int64(v), nil
		case int8:
			return int64(v), nil
		case int16:
			return int64(v), nil
		case int32:
			return int64(v), nil
		case int64:
			return int64(v), nil
		case uint:
			return int64(v), nil
		case uint8:
			return int64(v), nil
		case uint16:
			return int64(v), nil
		case uint32:
			return int64(v), nil
		case uint64:
			return int64(v), nil
		case json.Number:
			if i, err := v.Int64(); err == nil {
				return i, nil
			} else {
				return 0, err
			}
		default:
			return 0, ErrUnsupportType
		}
	default:
		return 0, ErrUnsupportType
	}
}

func castNumber(v bool) json.Number {
	if v {
		return json.Number("1")
	} else {
		return json.Number("0")
	}
}

// Number casts node to float64,
// including V_NUMBER|V_TRUE|V_FALSE|V_ANY|V_STRING|V_NULL,
// V_NONE it will return error
func (self *Node) Number() (json.Number, error) {
	if err := self.checkRaw(); err != nil {
		return json.Number(""), err
	}
	switch self.t {
	case _V_NUMBER:
		return self.toNumber(), nil
	case types.V_STRING:
		if _, err := self.toInt64(); err == nil {
			return self.toNumber(), nil
		} else if _, err := self.toFloat64(); err == nil {
			return self.toNumber(), nil
		} else {
			return json.Number(""), err
		}
	case types.V_TRUE:
		return json.Number("1"), nil
	case types.V_FALSE:
		return json.Number("0"), nil
	case types.V_NULL:
		return json.Number("0"), nil
	case _V_ANY:
		any := self.packAny()
		switch v := any.(type) {
		case bool:
			return castNumber(v), nil
		case int:
			return castNumber(v != 0), nil
		case int8:
			return castNumber(v != 0), nil
		case int16:
			return castNumber(v != 0), nil
		case int32:
			return castNumber(v != 0), nil
		case int64:
			return castNumber(v != 0), nil
		case uint:
			return castNumber(v != 0), nil
		case uint8:
			return castNumber(v != 0), nil
		case uint16:
			return castNumber(v != 0), nil
		case uint32:
			return castNumber(v != 0), nil
		case uint64:
			return castNumber(v != 0), nil
		case float32:
			return castNumber(v != 0), nil
		case float64:
			return castNumber(v != 0), nil
		case string:
			if _, err := strconv.ParseFloat(v, 64); err == nil {
				return json.Number(v), nil
			} else {
				return json.Number(""), err
			}
		case json.Number:
			return v, nil
		default:
			return json.Number(""), ErrUnsupportType
		}
	default:
		return json.Number(""), ErrUnsupportType
	}
}

// Number exports underlying float64 value, including V_NUMBER, V_ANY of json.Number
func (self *Node) StrictNumber() (json.Number, error) {
	if err := self.checkRaw(); err != nil {
		return json.Number(""), err
	}
	switch self.t {
	case _V_NUMBER:
		return self.toNumber(), nil
	case _V_ANY:
		if v, ok := self.packAny().(json.Number); ok {
			return v, nil
		} else {
			return json.Number(""), ErrUnsupportType
		}
	default:
		return json.Number(""), ErrUnsupportType
	}
}

// String cast node to string,
// including V_NUMBER|V_TRUE|V_FALSE|V_ANY|V_STRING|V_NULL,
// V_NONE it will return error
func (self *Node) String() (string, error) {
	if err := self.checkRaw(); err != nil {
		return "", err
	}
	switch self.t {
	case types.V_NULL:
		return "", nil
	case types.V_TRUE:
		return "true", nil
	case types.V_FALSE:
		return "false", nil
	case types.V_STRING, _V_NUMBER:
		return self.toString(), nil
	case _V_ANY:
		any := self.packAny()
		switch v := any.(type) {
		case bool:
			return strconv.FormatBool(v), nil
		case int:
			return strconv.Itoa(v), nil
		case int8:
			return strconv.Itoa(int(v)), nil
		case int16:
			return strconv.Itoa(int(v)), nil
		case int32:
			return strconv.Itoa(int(v)), nil
		case int64:
			return strconv.Itoa(int(v)), nil
		case uint:
			return strconv.Itoa(int(v)), nil
		case uint8:
			return strconv.Itoa(int(v)), nil
		case uint16:
			return strconv.Itoa(int(v)), nil
		case uint32:
			return strconv.Itoa(int(v)), nil
		case uint64:
			return strconv.Itoa(int(v)), nil
		case float32:
			return strconv.FormatFloat(float64(v), 'g', -1, 64), nil
		case float64:
			return strconv.FormatFloat(float64(v), 'g', -1, 64), nil
		case string:
			return v, nil
		case json.Number:
			return v.String(), nil
		default:
			return "", ErrUnsupportType
		}
	default:
		return "", ErrUnsupportType
	}
}

// StrictString returns string value (unescaped), including V_STRING, V_ANY of string.
// In other cases, it will return empty string.
func (self *Node) StrictString() (string, error) {
	if err := self.checkRaw(); err != nil {
		return "", err
	}
	switch self.t {
	case types.V_STRING:
		return self.toString(), nil
	case _V_ANY:
		if v, ok := self.packAny().(string); ok {
			return v, nil
		} else {
			return "", ErrUnsupportType
		}
	default:
		return "", ErrUnsupportType
	}
}

// Float64 cast node to float64,
// including V_NUMBER|V_TRUE|V_FALSE|V_ANY|V_STRING|V_NULL,
// V_NONE it will return error
func (self *Node) Float64() (float64, error) {
	if err := self.checkRaw(); err != nil {
		return 0.0, err
	}
	switch self.t {
	case _V_NUMBER, types.V_STRING:
		return self.toFloat64()
	case types.V_TRUE:
		return 1.0, nil
	case types.V_FALSE:
		return 0.0, nil
	case types.V_NULL:
		return 0.0, nil
	case _V_ANY:
		any := self.packAny()
		switch v := any.(type) {
		case bool:
			if v {
				return 1.0, nil
			} else {
				return 0.0, nil
			}
		case int:
			return float64(v), nil
		case int8:
			return float64(v), nil
		case int16:
			return float64(v), nil
		case int32:
			return float64(v), nil
		case int64:
			return float64(v), nil
		case uint:
			return float64(v), nil
		case uint8:
			return float64(v), nil
		case uint16:
			return float64(v), nil
		case uint32:
			return float64(v), nil
		case uint64:
			return float64(v), nil
		case float32:
			return float64(v), nil
		case float64:
			return float64(v), nil
		case string:
			if f, err := strconv.ParseFloat(v, 64); err == nil {
				return float64(f), nil
			} else {
				return 0, err
			}
		case json.Number:
			if f, err := v.Float64(); err == nil {
				return float64(f), nil
			} else {
				return 0, err
			}
		default:
			return 0, ErrUnsupportType
		}
	default:
		return 0.0, ErrUnsupportType
	}
}

func (self *Node) StrictBool() (bool, error) {
	if err := self.checkRaw(); err != nil {
		return false, err
	}
	switch self.t {
	case types.V_TRUE:
		return true, nil
	case types.V_FALSE:
		return false, nil
	case _V_ANY:
		any := self.packAny()
		switch v := any.(type) {
		case bool:
			return v, nil
		default:
			return false, ErrUnsupportType
		}
	default:
		return false, ErrUnsupportType
	}
}

// Float64 exports underlying float64 value, including V_NUMBER, V_ANY
func (self *Node) StrictFloat64() (float64, error) {
	if err := self.checkRaw(); err != nil {
		return 0.0, err
	}
	switch self.t {
	case _V_NUMBER:
		return self.toFloat64()
	case _V_ANY:
		any := self.packAny()
		switch v := any.(type) {
		case float32:
			return float64(v), nil
		case float64:
			return float64(v), nil
		default:
			return 0, ErrUnsupportType
		}
	default:
		return 0.0, ErrUnsupportType
	}
}

/** Sequential Value Methods **/

// Len returns children count of a array|object|string node
// WARN: For partially loaded node, it also works but only counts the parsed children
func (self *Node) Len() (int, error) {
	if err := self.checkRaw(); err != nil {
		return 0, err
	}
	if self.t == types.V_ARRAY || self.t == types.V_OBJECT || self.t == _V_ARRAY_LAZY || self.t == _V_OBJECT_LAZY || self.t == types.V_STRING {
		return int(self.l), nil
	} else if self.t == _V_NONE || self.t == types.V_NULL {
		return 0, nil
	} else {
		return 0, ErrUnsupportType
	}
}

func (self *Node) len() int {
	return int(self.l)
}

// Cap returns malloc capacity of a array|object node for children
func (self *Node) Cap() (int, error) {
	if err := self.checkRaw(); err != nil {
		return 0, err
	}
	switch self.t {
	case types.V_ARRAY:
		return (*linkedNodes)(self.p).Cap(), nil
	case types.V_OBJECT:
		return (*linkedPairs)(self.p).Cap(), nil
	case _V_ARRAY_LAZY:
		return (*parseArrayStack)(self.p).v.Cap(), nil
	case _V_OBJECT_LAZY:
		return (*parseObjectStack)(self.p).v.Cap(), nil
	case _V_NONE, types.V_NULL:
		return 0, nil
	default:
		return 0, ErrUnsupportType
	}
}

// Set sets the node of given key under self, and reports if the key has existed.
//
// If self is V_NONE or V_NULL, it becomes V_OBJECT and sets the node at the key.
func (self *Node) Set(key string, node Node) (bool, error) {
	if err := self.checkRaw(); err != nil {
		return false, err
	}

	// check the node, not use Check() to avoid unescape the node parameter
	if node.t == V_ERROR {
		return false, node
	}

	if self.t == _V_NONE || self.t == types.V_NULL {
		*self = NewObject([]Pair{NewPair(key, node)})
		return false, nil
	} else if self.itype() != types.V_OBJECT {
		return false, ErrUnsupportType
	}

	p := self.Get(key)

	if !p.Exists() {
		// self must be fully-loaded here
		if self.len() == 0 {
			*self = newObject(new(linkedPairs))
		}
		s := (*linkedPairs)(self.p)
		s.Push(NewPair(key, node))
		self.l++
		return false, nil

	} else if err := p.Check(); err != nil {
		return false, err
	}

	*p = node
	return true, nil
}

// SetAny wraps val with V_ANY node, and Set() the node.
func (self *Node) SetAny(key string, val interface{}) (bool, error) {
	return self.Set(key, NewAny(val))
}

// Unset REMOVE (soft) the node of given key under object parent, and reports if the key has existed.
func (self *Node) Unset(key string) (bool, error) {
	if err := self.should(types.V_OBJECT); err != nil {
		return false, err
	}
	// NOTICE: must get accurate length before deduct
	if err := self.skipAllKey(); err != nil {
		return false, err
	}
	p, i := self.skipKey(key)
	if !p.Exists() {
		return false, nil
	} else if err := p.Check(); err != nil {
		return false, err
	}
	self.removePairAt(i)
	return true, nil
}

// SetByIndex sets the node of given index, and reports if the key has existed.
//
// The index must be within self's children.
func (self *Node) SetByIndex(index int, node Node) (bool, error) {
	if err := self.checkRaw(); err != nil {
		return false, err
	}
	if err := node.Check(); err != nil {
		return false, err
	}

	if index == 0 && (self.t == _V_NONE || self.t == types.V_NULL) {
		*self = NewArray([]Node{node})
		return false, nil
	}

	p := self.Index(index)
	if !p.Exists() {
		return false, ErrNotExist
	} else if err := p.Check(); err != nil {
		return false, err
	}

	*p = node
	return true, nil
}

// SetAny wraps val with V_ANY node, and SetByIndex() the node.
func (self *Node) SetAnyByIndex(index int, val interface{}) (bool, error) {
	return self.SetByIndex(index, NewAny(val))
}

// UnsetByIndex REMOVE (softly) the node of given index.
//
// WARN: this will change address of elements, which is a dangerous action.
// Use Unset() for object or Pop() for array instead.
func (self *Node) UnsetByIndex(index int) (bool, error) {
	if err := self.checkRaw(); err != nil {
		return false, err
	}

	var p *Node
	it := self.itype()

	if it == types.V_ARRAY {
		if err := self.skipAllIndex(); err != nil {
			return false, err
		}
		p = self.nodeAt(index)
	} else if it == types.V_OBJECT {
		if err := self.skipAllKey(); err != nil {
			return false, err
		}
		pr := self.pairAt(index)
		if pr == nil {
			return false, ErrNotExist
		}
		p = &pr.Value
	} else {
		return false, ErrUnsupportType
	}

	if !p.Exists() {
		return false, ErrNotExist
	}

	// last elem
	if index == self.len()-1 {
		return true, self.Pop()
	}

	// not last elem, self.len() change but linked-chunk not change
	if it == types.V_ARRAY {
		self.removeNode(index)
	} else if it == types.V_OBJECT {
		self.removePair(index)
	}
	return true, nil
}

// Add appends the given node under self.
//
// If self is V_NONE or V_NULL, it becomes V_ARRAY and sets the node at index 0.
func (self *Node) Add(node Node) error {
	if err := self.checkRaw(); err != nil {
		return err
	}

	if self != nil && (self.t == _V_NONE || self.t == types.V_NULL) {
		*self = NewArray([]Node{node})
		return nil
	}
	if err := self.should(types.V_ARRAY); err != nil {
		return err
	}

	s, err := self.unsafeArray()
	if err != nil {
		return err
	}

	// Notice: array won't have unset node in tail
	s.Push(node)
	self.l++
	return nil
}

// Pop remove the last child of the V_Array or V_Object node.
func (self *Node) Pop() error {
	if err := self.checkRaw(); err != nil {
		return err
	}

	if it := self.itype(); it == types.V_ARRAY {
		s, err := self.unsafeArray()
		if err != nil {
			return err
		}
		// remove tail unset nodes
		for i := s.Len() - 1; i >= 0; i-- {
			if s.At(i).Exists() {
				s.Pop()
				self.l--
				break
			}
			s.Pop()
		}

	} else if it == types.V_OBJECT {
		s, err := self.unsafeMap()
		if err != nil {
			return err
		}
		// remove tail unset nodes
		for i := s.Len() - 1; i >= 0; i-- {
			if p := s.At(i); p != nil && p.Value.Exists() {
				s.Pop()
				self.l--
				break
			}
			s.Pop()
		}

	} else {
		return ErrUnsupportType
	}

	return nil
}

// Move moves the child at src index to dst index,
// meanwhile slides siblings from src+1 to dst.
//
// WARN: this will change address of elements, which is a dangerous action.
func (self *Node) Move(dst, src int) error {
	if err := self.should(types.V_ARRAY); err != nil {
		return err
	}

	s, err := self.unsafeArray()
	if err != nil {
		return err
	}

	// check if any unset node exists
	if l := s.Len(); self.len() != l {
		di, si := dst, src
		// find real pos of src and dst
		for i := 0; i < l; i++ {
			if s.At(i).Exists() {
				di--
				si--
			}
			if di == -1 {
				dst = i
				di--
			}
			if si == -1 {
				src = i
				si--
			}
			if di == -2 && si == -2 {
				break
			}
		}
	}

	s.MoveOne(src, dst)
	return nil
}

// AddAny wraps val with V_ANY node, and Add() the node.
func (self *Node) AddAny(val interface{}) error {
	return self.Add(NewAny(val))
}

// GetByPath load given path on demands,
// which only ensure nodes before this path got parsed.
//
// Note, the api expects the json is well-formed at least,
// otherwise it may return unexpected result.
func (self *Node) GetByPath(path ...interface{}) *Node {
	if !self.Valid() {
		return self
	}
	var s = self
	for _, p := range path {
		switch p := p.(type) {
		case int:
			s = s.Index(p)
			if !s.Valid() {
				return s
			}
		case string:
			s = s.Get(p)
			if !s.Valid() {
				return s
			}
		default:
			panic("path must be either int or string")
		}
	}
	return s
}

// Get loads given key of an object node on demands
func (self *Node) Get(key string) *Node {
	if err := self.should(types.V_OBJECT); err != nil {
		return unwrapError(err)
	}
	n, _ := self.skipKey(key)
	return n
}

// Index indexies node at given idx,
// node type CAN be either V_OBJECT or V_ARRAY
func (self *Node) Index(idx int) *Node {
	if err := self.checkRaw(); err != nil {
		return unwrapError(err)
	}

	it := self.itype()
	if it == types.V_ARRAY {
		return self.skipIndex(idx)

	} else if it == types.V_OBJECT {
		pr := self.skipIndexPair(idx)
		if pr == nil {
			return newError(_ERR_NOT_FOUND, "value not exists")
		}
		return &pr.Value

	} else {
		return newError(_ERR_UNSUPPORT_TYPE, fmt.Sprintf("unsupported type: %v", self.itype()))
	}
}

// IndexPair indexies pair at given idx,
// node type MUST be either V_OBJECT
func (self *Node) IndexPair(idx int) *Pair {
	if err := self.should(types.V_OBJECT); err != nil {
		return nil
	}
	return self.skipIndexPair(idx)
}

func (self *Node) indexOrGet(idx int, key string) (*Node, int) {
	if err := self.should(types.V_OBJECT); err != nil {
		return unwrapError(err), idx
	}

	pr := self.skipIndexPair(idx)
	if pr != nil && pr.Key == key {
		return &pr.Value, idx
	}

	return self.skipKey(key)
}

// IndexOrGet firstly use idx to index a value and check if its key matches
// If not, then use the key to search value
func (self *Node) IndexOrGet(idx int, key string) *Node {
	node, _ := self.indexOrGet(idx, key)
	return node
}

// IndexOrGetWithIdx attempts to retrieve a node by index and key, returning the node and its correct index.
// If the key does not match at the given index, it searches by key and returns the node with its updated index.
func (self *Node) IndexOrGetWithIdx(idx int, key string) (*Node, int) {
	return self.indexOrGet(idx, key)
}

/** Generic Value Converters **/

// Map loads all keys of an object node
func (self *Node) Map() (map[string]interface{}, error) {
	if self.isAny() {
		any := self.packAny()
		if v, ok := any.(map[string]interface{}); ok {
			return v, nil
		} else {
			return nil, ErrUnsupportType
		}
	}
	if err := self.should(types.V_OBJECT); err != nil {
		return nil, err
	}
	if err := self.loadAllKey(false); err != nil {
		return nil, err
	}
	return self.toGenericObject()
}

// MapUseNumber loads all keys of an object node, with numeric nodes cast to json.Number
func (self *Node) MapUseNumber() (map[string]interface{}, error) {
	if self.isAny() {
		any := self.packAny()
		if v, ok := any.(map[string]interface{}); ok {
			return v, nil
		} else {
			return nil, ErrUnsupportType
		}
	}
	if err := self.should(types.V_OBJECT); err != nil {
		return nil, err
	}
	if err := self.loadAllKey(false); err != nil {
		return nil, err
	}
	return self.toGenericObjectUseNumber()
}

// MapUseNode scans both parsed and non-parsed children nodes,
// and map them by their keys
func (self *Node) MapUseNode() (map[string]Node, error) {
	if self.isAny() {
		any := self.packAny()
		if v, ok := any.(map[string]Node); ok {
			return v, nil
		} else {
			return nil, ErrUnsupportType
		}
	}
	if err := self.should(types.V_OBJECT); err != nil {
		return nil, err
	}
	if err := self.skipAllKey(); err != nil {
		return nil, err
	}
	return self.toGenericObjectUseNode()
}

// MapUnsafe exports the underlying pointer to its children map
// WARN: don't use it unless you know what you are doing
//
// Deprecated:  this API now returns copied nodes instead of directly reference,
// func (self *Node) UnsafeMap() ([]Pair, error) {
//     if err := self.should(types.V_OBJECT, "an object"); err != nil {
//         return nil, err
//     }
//     if err := self.skipAllKey(); err != nil {
//         return nil, err
//     }
//     return self.toGenericObjectUsePair()
// }

//go:nocheckptr
func (self *Node) unsafeMap() (*linkedPairs, error) {
	if err := self.skipAllKey(); err != nil {
		return nil, err
	}
	if self.p == nil {
		*self = newObject(new(linkedPairs))
	}
	return (*linkedPairs)(self.p), nil
}

// SortKeys sorts children of a V_OBJECT node in ascending key-order.
// If recurse is true, it recursively sorts children's children as long as a V_OBJECT node is found.
func (self *Node) SortKeys(recurse bool) error {
	// check raw node first
	if err := self.checkRaw(); err != nil {
		return err
	}
	if self.itype() == types.V_OBJECT {
		return self.sortKeys(recurse)
	} else if self.itype() == types.V_ARRAY {
		var err error
		err2 := self.ForEach(func(path Sequence, node *Node) bool {
			it := node.itype()
			if it == types.V_ARRAY || it == types.V_OBJECT {
				err = node.SortKeys(recurse)
				if err != nil {
					return false
				}
			}
			return true
		})
		if err != nil {
			return err
		}
		return err2
	} else {
		return nil
	}
}

func (self *Node) sortKeys(recurse bool) (err error) {
	// check raw node first
	if err := self.checkRaw(); err != nil {
		return err
	}
	ps, err := self.unsafeMap()
	if err != nil {
		return err
	}
	ps.Sort()
	if recurse {
		var sc Scanner
		sc = func(path Sequence, node *Node) bool {
			if node.itype() == types.V_OBJECT {
				if err := node.sortKeys(recurse); err != nil {
					return false
				}
			}
			if node.itype() == types.V_ARRAY {
				if err := node.ForEach(sc); err != nil {
					return false
				}
			}
			return true
		}
		if err := self.ForEach(sc); err != nil {
			return err
		}
	}
	return nil
}

// Array loads all indexes of an array node
func (self *Node) Array() ([]interface{}, error) {
	if self.isAny() {
		any := self.packAny()
		if v, ok := any.([]interface{}); ok {
			return v, nil
		} else {
			return nil, ErrUnsupportType
		}
	}
	if err := self.should(types.V_ARRAY); err != nil {
		return nil, err
	}
	if err := self.loadAllIndex(false); err != nil {
		return nil, err
	}
	return self.toGenericArray()
}

// ArrayUseNumber loads all indexes of an array node, with numeric nodes cast to json.Number
func (self *Node) ArrayUseNumber() ([]interface{}, error) {
	if self.isAny() {
		any := self.packAny()
		if v, ok := any.([]interface{}); ok {
			return v, nil
		} else {
			return nil, ErrUnsupportType
		}
	}
	if err := self.should(types.V_ARRAY); err != nil {
		return nil, err
	}
	if err := self.loadAllIndex(false); err != nil {
		return nil, err
	}
	return self.toGenericArrayUseNumber()
}

// ArrayUseNode copies both parsed and non-parsed children nodes,
// and indexes them by original order
func (self *Node) ArrayUseNode() ([]Node, error) {
	if self.isAny() {
		any := self.packAny()
		if v, ok := any.([]Node); ok {
			return v, nil
		} else {
			return nil, ErrUnsupportType
		}
	}
	if err := self.should(types.V_ARRAY); err != nil {
		return nil, err
	}
	if err := self.skipAllIndex(); err != nil {
		return nil, err
	}
	return self.toGenericArrayUseNode()
}

// ArrayUnsafe exports the underlying pointer to its children array
// WARN: don't use it unless you know what you are doing
//
// Deprecated:  this API now returns copied nodes instead of directly reference,
// which has no difference with ArrayUseNode
// func (self *Node) UnsafeArray() ([]Node, error) {
//     if err := self.should(types.V_ARRAY, "an array"); err != nil {
//         return nil, err
//     }
//     if err := self.skipAllIndex(); err != nil {
//         return nil, err
//     }
//     return self.toGenericArrayUseNode()
// }

func (self *Node) unsafeArray() (*linkedNodes, error) {
	if err := self.skipAllIndex(); err != nil {
		return nil, err
	}
	if self.p == nil {
		*self = newArray(new(linkedNodes))
	}
	return (*linkedNodes)(self.p), nil
}

// Interface loads all children under all paths from this node,
// and converts itself as generic type.
// WARN: all numeric nodes are cast to float64
func (self *Node) Interface() (interface{}, error) {
	if err := self.checkRaw(); err != nil {
		return nil, err
	}
	switch self.t {
	case V_ERROR:
		return nil, self.Check()
	case types.V_NULL:
		return nil, nil
	case types.V_TRUE:
		return true, nil
	case types.V_FALSE:
		return false, nil
	case types.V_ARRAY:
		return self.toGenericArray()
	case types.V_OBJECT:
		return self.toGenericObject()
	case types.V_STRING:
		return self.toString(), nil
	case _V_NUMBER:
		v, err := self.toFloat64()
		if err != nil {
			return nil, err
		}
		return v, nil
	case _V_ARRAY_LAZY:
		if err := self.loadAllIndex(false); err != nil {
			return nil, err
		}
		return self.toGenericArray()
	case _V_OBJECT_LAZY:
		if err := self.loadAllKey(false); err != nil {
			return nil, err
		}
		return self.toGenericObject()
	case _V_ANY:
		switch v := self.packAny().(type) {
		case Node:
			return v.Interface()
		case *Node:
			return v.Interface()
		default:
			return v, nil
		}
	default:
		return nil, ErrUnsupportType
	}
}

func (self *Node) packAny() interface{} {
	return *(*interface{})(self.p)
}

// InterfaceUseNumber works same with Interface()
// except numeric nodes are cast to json.Number
func (self *Node) InterfaceUseNumber() (interface{}, error) {
	if err := self.checkRaw(); err != nil {
		return nil, err
	}
	switch self.t {
	case V_ERROR:
		return nil, self.Check()
	case types.V_NULL:
		return nil, nil
	case types.V_TRUE:
		return true, nil
	case types.V_FALSE:
		return false, nil
	case types.V_ARRAY:
		return self.toGenericArrayUseNumber()
	case types.V_OBJECT:
		return self.toGenericObjectUseNumber()
	case types.V_STRING:
		return self.toString(), nil
	case _V_NUMBER:
		return self.toNumber(), nil
	case _V_ARRAY_LAZY:
		if err := self.loadAllIndex(false); err != nil {
			return nil, err
		}
		return self.toGenericArrayUseNumber()
	case _V_OBJECT_LAZY:
		if err := self.loadAllKey(false); err != nil {
			return nil, err
		}
		return self.toGenericObjectUseNumber()
	case _V_ANY:
		return self.packAny(), nil
	default:
		return nil, ErrUnsupportType
	}
}

// InterfaceUseNode clone itself as a new node,
// or its children as map[string]Node (or []Node)
func (self *Node) InterfaceUseNode() (interface{}, error) {
	if err := self.checkRaw(); err != nil {
		return nil, err
	}
	switch self.t {
	case types.V_ARRAY:
		return self.toGenericArrayUseNode()
	case types.V_OBJECT:
		return self.toGenericObjectUseNode()
	case _V_ARRAY_LAZY:
		if err := self.skipAllIndex(); err != nil {
			return nil, err
		}
		return self.toGenericArrayUseNode()
	case _V_OBJECT_LAZY:
		if err := self.skipAllKey(); err != nil {
			return nil, err
		}
		return self.toGenericObjectUseNode()
	default:
		return *self, self.Check()
	}
}

// LoadAll loads the node's children
// and ensure all its children can be READ concurrently (include its children's children)
func (self *Node) LoadAll() error {
	return self.Load()
}

// Load loads the node's children as parsed.
// and ensure all its children can be READ concurrently (include its children's children)
func (self *Node) Load() error {
	switch self.t {
	case _V_ARRAY_LAZY:
		self.loadAllIndex(true)
	case _V_OBJECT_LAZY:
		self.loadAllKey(true)
	case V_ERROR:
		return self
	case V_NONE:
		return nil
	}
	if self.m == nil {
		self.m = new(sync.RWMutex)
	}
	return self.checkRaw()
}

/**---------------------------------- Internal Helper Methods ----------------------------------**/

func (self *Node) should(t types.ValueType) error {
	if err := self.checkRaw(); err != nil {
		return err
	}
	if self.itype() != t {
		return ErrUnsupportType
	}
	return nil
}

func (self *Node) nodeAt(i int) *Node {
	var p *linkedNodes
	if self.isLazy() {
		_, stack := self.getParserAndArrayStack()
		p = &stack.v
	} else {
		p = (*linkedNodes)(self.p)
		if l := p.Len(); l != self.len() {
			// some nodes got unset, iterate to skip them
			for j := 0; j < l; j++ {
				v := p.At(j)
				if v.Exists() {
					i--
				}
				if i < 0 {
					return v
				}
			}
			return nil
		}
	}
	return p.At(i)
}

func (self *Node) pairAt(i int) *Pair {
	var p *linkedPairs
	if self.isLazy() {
		_, stack := self.getParserAndObjectStack()
		p = &stack.v
	} else {
		p = (*linkedPairs)(self.p)
		if l := p.Len(); l != self.len() {
			// some nodes got unset, iterate to skip them
			for j := 0; j < l; j++ {
				v := p.At(j)
				if v != nil && v.Value.Exists() {
					i--
				}
				if i < 0 {
					return v
				}
			}
			return nil
		}
	}
	return p.At(i)
}

func (self *Node) skipAllIndex() error {
	if !self.isLazy() {
		return nil
	}
	var err types.Parsing
Download .txt
gitextract_08lhox7g/

├── .codespellrc
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── feature_request.md
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows/
│       ├── .ignore_words
│       ├── benchmark.yml
│       ├── compatibility_test-windows.yml
│       ├── compatibility_test.yml
│       ├── fuzzing.yml
│       ├── lint.yml
│       ├── test-arm64.yml
│       └── test-x86.yml
├── .gitignore
├── .gitmodules
├── .licenserc.yaml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── CREDITS
├── LICENSE
├── README.md
├── README_ZH_CN.md
├── api.go
├── api_test.go
├── ast/
│   ├── api.go
│   ├── api_compat.go
│   ├── api_native_test.go
│   ├── asm.s
│   ├── buffer.go
│   ├── buffer_test.go
│   ├── decode.go
│   ├── decode_test.go
│   ├── encode.go
│   ├── encode_test.go
│   ├── error.go
│   ├── iterator.go
│   ├── iterator_test.go
│   ├── node.go
│   ├── node_test.go
│   ├── parser.go
│   ├── parser_test.go
│   ├── search.go
│   ├── search_test.go
│   ├── stubs.go
│   ├── testdata_test.go
│   ├── visitor.go
│   └── visitor_test.go
├── compat.go
├── compat_test.go
├── decode_test.go
├── decoder/
│   ├── decoder_compat.go
│   ├── decoder_native.go
│   ├── decoder_native_test.go
│   ├── decoder_test.go
│   └── testdata_test.go
├── docs/
│   ├── INTRODUCTION.md
│   └── INTRODUCTION_ZH_CN.md
├── encode_test.go
├── encoder/
│   ├── encoder_compat.go
│   ├── encoder_native.go
│   ├── encoder_native_test.go
│   ├── encoder_test.go
│   └── testdata_test.go
├── examples/
│   └── example_stream_test.go
├── external_jsonlib_test/
│   ├── benchmark_test/
│   │   ├── ast_set_benchmark_test.go
│   │   ├── decoder_stream_test.go
│   │   ├── decoder_test.go
│   │   ├── encoder_stream_test.go
│   │   ├── encoder_test.go
│   │   ├── msgpack_test.go
│   │   ├── parser_test.go
│   │   ├── search_test.go
│   │   └── testdata_test.go
│   ├── go.mod
│   ├── go.sum
│   └── unit_test/
│       ├── api_test.go
│       ├── ast_compat_test.go
│       └── decoder_stream_test.go
├── fuzz/
│   ├── ast_fuzz_test.go
│   ├── corpus/
│   │   ├── htmescape3.json
│   │   ├── htmlescap2.json
│   │   ├── htmlescape.json
│   │   ├── stringnumber.json
│   │   ├── stringnumber2.json
│   │   ├── struct.json
│   │   ├── twitter.json
│   │   └── twitterescaped.json
│   ├── corpus.go
│   ├── fuzz_test.go
│   ├── go.mod
│   ├── go.sum
│   ├── other_fuzz_test.go
│   └── struct_fuzz_test.go
├── generic_test/
│   ├── benchmark_test.go
│   ├── go.mod
│   ├── go.sum
│   ├── sonic_test.go
│   └── testdata_test.go
├── go.mod
├── go.sum
├── go.work
├── go.work.sum
├── internal/
│   ├── caching/
│   │   ├── asm.s
│   │   ├── fcache.go
│   │   ├── hashing.go
│   │   ├── hashing_test.go
│   │   ├── pcache.go
│   │   └── pcache_test.go
│   ├── compat/
│   │   └── warn.go
│   ├── cpu/
│   │   └── features.go
│   ├── decoder/
│   │   ├── api/
│   │   │   ├── decoder.go
│   │   │   ├── decoder_amd64.go
│   │   │   ├── decoder_arm64.go
│   │   │   ├── norace_test.go
│   │   │   ├── stream.go
│   │   │   ├── stream_test.go
│   │   │   └── testdata_test.go
│   │   ├── consts/
│   │   │   └── option.go
│   │   ├── errors/
│   │   │   ├── errors.go
│   │   │   ├── errors_test.go
│   │   │   └── fuzz_test.go
│   │   ├── jitdec/
│   │   │   ├── asm.s
│   │   │   ├── asm_stubs_amd64_go117.go
│   │   │   ├── asm_stubs_amd64_go121.go
│   │   │   ├── assembler_regabi_amd64.go
│   │   │   ├── assembler_test.go
│   │   │   ├── compiler.go
│   │   │   ├── compiler_test.go
│   │   │   ├── debug.go
│   │   │   ├── decoder.go
│   │   │   ├── generic_regabi_amd64.go
│   │   │   ├── generic_regabi_amd64_test.s
│   │   │   ├── generic_test.go
│   │   │   ├── pcsp_test.go
│   │   │   ├── pools.go
│   │   │   ├── primitives.go
│   │   │   ├── testdata_test.go
│   │   │   ├── types.go
│   │   │   └── utils.go
│   │   └── optdec/
│   │       ├── compile_struct.go
│   │       ├── compiler.go
│   │       ├── const.go
│   │       ├── context.go
│   │       ├── decoder.go
│   │       ├── errors.go
│   │       ├── functor.go
│   │       ├── helper.go
│   │       ├── interface.go
│   │       ├── map.go
│   │       ├── native.go
│   │       ├── native_test.go
│   │       ├── node.go
│   │       ├── slice.go
│   │       ├── stringopts.go
│   │       ├── structs.go
│   │       ├── testdata_test.go
│   │       └── types.go
│   ├── encoder/
│   │   ├── alg/
│   │   │   ├── mapiter.go
│   │   │   ├── opts.go
│   │   │   ├── sort.go
│   │   │   ├── sort_test.go
│   │   │   ├── spec.go
│   │   │   ├── spec_compat.go
│   │   │   └── spec_test.go
│   │   ├── compiler.go
│   │   ├── compiler_test.go
│   │   ├── encode_norace.go
│   │   ├── encode_race.go
│   │   ├── encoder.go
│   │   ├── encoder_norace_test.go
│   │   ├── encoder_test.go
│   │   ├── ir/
│   │   │   └── op.go
│   │   ├── omitzero_test.go
│   │   ├── pools_amd64.go
│   │   ├── pools_amd64_test.go
│   │   ├── pools_compt.go
│   │   ├── prim/
│   │   │   └── primitives.go
│   │   ├── stream.go
│   │   ├── stream_test.go
│   │   ├── testdata_test.go
│   │   ├── vars/
│   │   │   ├── cache.go
│   │   │   ├── const.go
│   │   │   ├── errors.go
│   │   │   ├── stack.go
│   │   │   └── types.go
│   │   ├── vm/
│   │   │   ├── stbus.go
│   │   │   ├── vm.go
│   │   │   └── vm_test.go
│   │   └── x86/
│   │       ├── asm_stubs_amd64_go117.go
│   │       ├── asm_stubs_amd64_go121.go
│   │       ├── assembler_regabi_amd64.go
│   │       ├── assembler_test.go
│   │       ├── debug_go116.go
│   │       ├── debug_go117.go
│   │       └── stbus.go
│   ├── envs/
│   │   └── decode.go
│   ├── jit/
│   │   ├── arch_amd64.go
│   │   ├── asm.s
│   │   ├── assembler_amd64.go
│   │   ├── backend.go
│   │   ├── backend_test.go
│   │   └── runtime.go
│   ├── native/
│   │   ├── avx2/
│   │   │   ├── f32toa.go
│   │   │   ├── f32toa_subr.go
│   │   │   ├── f32toa_text_amd64.go
│   │   │   ├── f64toa.go
│   │   │   ├── f64toa_subr.go
│   │   │   ├── f64toa_text_amd64.go
│   │   │   ├── fastfloat_test.go
│   │   │   ├── fastint_test.go
│   │   │   ├── get_by_path.go
│   │   │   ├── get_by_path_subr.go
│   │   │   ├── get_by_path_text_amd64.go
│   │   │   ├── html_escape.go
│   │   │   ├── html_escape_subr.go
│   │   │   ├── html_escape_text_amd64.go
│   │   │   ├── i64toa.go
│   │   │   ├── i64toa_subr.go
│   │   │   ├── i64toa_text_amd64.go
│   │   │   ├── lspace.go
│   │   │   ├── lspace_subr.go
│   │   │   ├── lspace_text_amd64.go
│   │   │   ├── native_export.go
│   │   │   ├── native_test.go
│   │   │   ├── parse_with_padding.go
│   │   │   ├── parse_with_padding_subr.go
│   │   │   ├── parse_with_padding_text_amd64.go
│   │   │   ├── quote.go
│   │   │   ├── quote_subr.go
│   │   │   ├── quote_text_amd64.go
│   │   │   ├── recover_test.go
│   │   │   ├── skip_array.go
│   │   │   ├── skip_array_subr.go
│   │   │   ├── skip_array_text_amd64.go
│   │   │   ├── skip_number.go
│   │   │   ├── skip_number_subr.go
│   │   │   ├── skip_number_text_amd64.go
│   │   │   ├── skip_object.go
│   │   │   ├── skip_object_subr.go
│   │   │   ├── skip_object_text_amd64.go
│   │   │   ├── skip_one.go
│   │   │   ├── skip_one_fast.go
│   │   │   ├── skip_one_fast_subr.go
│   │   │   ├── skip_one_fast_text_amd64.go
│   │   │   ├── skip_one_subr.go
│   │   │   ├── skip_one_text_amd64.go
│   │   │   ├── u64toa.go
│   │   │   ├── u64toa_subr.go
│   │   │   ├── u64toa_text_amd64.go
│   │   │   ├── unquote.go
│   │   │   ├── unquote_subr.go
│   │   │   ├── unquote_text_amd64.go
│   │   │   ├── validate_one.go
│   │   │   ├── validate_one_subr.go
│   │   │   ├── validate_one_text_amd64.go
│   │   │   ├── validate_utf8.go
│   │   │   ├── validate_utf8_fast.go
│   │   │   ├── validate_utf8_fast_subr.go
│   │   │   ├── validate_utf8_fast_text_amd64.go
│   │   │   ├── validate_utf8_subr.go
│   │   │   ├── validate_utf8_text_amd64.go
│   │   │   ├── value.go
│   │   │   ├── value_subr.go
│   │   │   ├── value_text_amd64.go
│   │   │   ├── vnumber.go
│   │   │   ├── vnumber_subr.go
│   │   │   ├── vnumber_text_amd64.go
│   │   │   ├── vsigned.go
│   │   │   ├── vsigned_subr.go
│   │   │   ├── vsigned_text_amd64.go
│   │   │   ├── vstring.go
│   │   │   ├── vstring_subr.go
│   │   │   ├── vstring_text_amd64.go
│   │   │   ├── vunsigned.go
│   │   │   ├── vunsigned_subr.go
│   │   │   └── vunsigned_text_amd64.go
│   │   ├── dispatch_amd64.go
│   │   ├── dispatch_arm64.go
│   │   ├── f32toa.tmpl
│   │   ├── f64toa.tmpl
│   │   ├── fastfloat_test.tmpl
│   │   ├── fastint_test.tmpl
│   │   ├── get_by_path.tmpl
│   │   ├── html_escape.tmpl
│   │   ├── i64toa.tmpl
│   │   ├── lspace.tmpl
│   │   ├── native_export.tmpl
│   │   ├── native_test.tmpl
│   │   ├── neon/
│   │   │   ├── f32toa_arm64.go
│   │   │   ├── f32toa_arm64.s
│   │   │   ├── f32toa_subr_arm64.go
│   │   │   ├── f64toa_arm64.go
│   │   │   ├── f64toa_arm64.s
│   │   │   ├── f64toa_subr_arm64.go
│   │   │   ├── fastfloat_arm64_test.go
│   │   │   ├── fastint_arm64_test.go
│   │   │   ├── get_by_path_arm64.go
│   │   │   ├── get_by_path_arm64.s
│   │   │   ├── get_by_path_subr_arm64.go
│   │   │   ├── html_escape_arm64.go
│   │   │   ├── html_escape_arm64.s
│   │   │   ├── html_escape_subr_arm64.go
│   │   │   ├── i64toa_arm64.go
│   │   │   ├── i64toa_arm64.s
│   │   │   ├── i64toa_subr_arm64.go
│   │   │   ├── lspace_arm64.go
│   │   │   ├── lspace_arm64.s
│   │   │   ├── lspace_subr_arm64.go
│   │   │   ├── native_arm64_test.go
│   │   │   ├── native_export_arm64.go
│   │   │   ├── parse_with_padding_arm64.go
│   │   │   ├── parse_with_padding_arm64.s
│   │   │   ├── parse_with_padding_subr_arm64.go
│   │   │   ├── quote_arm64.go
│   │   │   ├── quote_arm64.s
│   │   │   ├── quote_subr_arm64.go
│   │   │   ├── recover_arm64_test.go
│   │   │   ├── skip_array_arm64.go
│   │   │   ├── skip_array_arm64.s
│   │   │   ├── skip_array_subr_arm64.go
│   │   │   ├── skip_number_arm64.go
│   │   │   ├── skip_number_arm64.s
│   │   │   ├── skip_number_subr_arm64.go
│   │   │   ├── skip_object_arm64.go
│   │   │   ├── skip_object_arm64.s
│   │   │   ├── skip_object_subr_arm64.go
│   │   │   ├── skip_one_arm64.go
│   │   │   ├── skip_one_arm64.s
│   │   │   ├── skip_one_fast_arm64.go
│   │   │   ├── skip_one_fast_arm64.s
│   │   │   ├── skip_one_fast_subr_arm64.go
│   │   │   ├── skip_one_subr_arm64.go
│   │   │   ├── u64toa_arm64.go
│   │   │   ├── u64toa_arm64.s
│   │   │   ├── u64toa_subr_arm64.go
│   │   │   ├── unquote_arm64.go
│   │   │   ├── unquote_arm64.s
│   │   │   ├── unquote_subr_arm64.go
│   │   │   ├── validate_one_arm64.go
│   │   │   ├── validate_one_arm64.s
│   │   │   ├── validate_one_subr_arm64.go
│   │   │   ├── validate_utf8_arm64.go
│   │   │   ├── validate_utf8_arm64.s
│   │   │   ├── validate_utf8_fast_arm64.go
│   │   │   ├── validate_utf8_fast_arm64.s
│   │   │   ├── validate_utf8_fast_subr_arm64.go
│   │   │   ├── validate_utf8_subr_arm64.go
│   │   │   ├── value_arm64.go
│   │   │   ├── value_arm64.s
│   │   │   ├── value_subr_arm64.go
│   │   │   ├── vnumber_arm64.go
│   │   │   ├── vnumber_arm64.s
│   │   │   ├── vnumber_subr_arm64.go
│   │   │   ├── vsigned_arm64.go
│   │   │   ├── vsigned_arm64.s
│   │   │   ├── vsigned_subr_arm64.go
│   │   │   ├── vstring_arm64.go
│   │   │   ├── vstring_arm64.s
│   │   │   ├── vstring_subr_arm64.go
│   │   │   ├── vunsigned_arm64.go
│   │   │   ├── vunsigned_arm64.s
│   │   │   └── vunsigned_subr_arm64.go
│   │   ├── parse_with_padding.tmpl
│   │   ├── quote.tmpl
│   │   ├── recover_test.tmpl
│   │   ├── skip_array.tmpl
│   │   ├── skip_number.tmpl
│   │   ├── skip_object.tmpl
│   │   ├── skip_one.tmpl
│   │   ├── skip_one_fast.tmpl
│   │   ├── sse/
│   │   │   ├── f32toa.go
│   │   │   ├── f32toa_subr.go
│   │   │   ├── f32toa_text_amd64.go
│   │   │   ├── f64toa.go
│   │   │   ├── f64toa_subr.go
│   │   │   ├── f64toa_text_amd64.go
│   │   │   ├── fastfloat_test.go
│   │   │   ├── fastint_test.go
│   │   │   ├── get_by_path.go
│   │   │   ├── get_by_path_subr.go
│   │   │   ├── get_by_path_text_amd64.go
│   │   │   ├── html_escape.go
│   │   │   ├── html_escape_subr.go
│   │   │   ├── html_escape_text_amd64.go
│   │   │   ├── i64toa.go
│   │   │   ├── i64toa_subr.go
│   │   │   ├── i64toa_text_amd64.go
│   │   │   ├── lspace.go
│   │   │   ├── lspace_subr.go
│   │   │   ├── lspace_text_amd64.go
│   │   │   ├── native_export.go
│   │   │   ├── native_test.go
│   │   │   ├── parse_with_padding.go
│   │   │   ├── parse_with_padding_subr.go
│   │   │   ├── parse_with_padding_text_amd64.go
│   │   │   ├── quote.go
│   │   │   ├── quote_subr.go
│   │   │   ├── quote_text_amd64.go
│   │   │   ├── recover_test.go
│   │   │   ├── skip_array.go
│   │   │   ├── skip_array_subr.go
│   │   │   ├── skip_array_text_amd64.go
│   │   │   ├── skip_number.go
│   │   │   ├── skip_number_subr.go
│   │   │   ├── skip_number_text_amd64.go
│   │   │   ├── skip_object.go
│   │   │   ├── skip_object_subr.go
│   │   │   ├── skip_object_text_amd64.go
│   │   │   ├── skip_one.go
│   │   │   ├── skip_one_fast.go
│   │   │   ├── skip_one_fast_subr.go
│   │   │   ├── skip_one_fast_text_amd64.go
│   │   │   ├── skip_one_subr.go
│   │   │   ├── skip_one_text_amd64.go
│   │   │   ├── u64toa.go
│   │   │   ├── u64toa_subr.go
│   │   │   ├── u64toa_text_amd64.go
│   │   │   ├── unquote.go
│   │   │   ├── unquote_subr.go
│   │   │   ├── unquote_text_amd64.go
│   │   │   ├── validate_one.go
│   │   │   ├── validate_one_subr.go
│   │   │   ├── validate_one_text_amd64.go
│   │   │   ├── validate_utf8.go
│   │   │   ├── validate_utf8_fast.go
│   │   │   ├── validate_utf8_fast_subr.go
│   │   │   ├── validate_utf8_fast_text_amd64.go
│   │   │   ├── validate_utf8_subr.go
│   │   │   ├── validate_utf8_text_amd64.go
│   │   │   ├── value.go
│   │   │   ├── value_subr.go
│   │   │   ├── value_text_amd64.go
│   │   │   ├── vnumber.go
│   │   │   ├── vnumber_subr.go
│   │   │   ├── vnumber_text_amd64.go
│   │   │   ├── vsigned.go
│   │   │   ├── vsigned_subr.go
│   │   │   ├── vsigned_text_amd64.go
│   │   │   ├── vstring.go
│   │   │   ├── vstring_subr.go
│   │   │   ├── vstring_text_amd64.go
│   │   │   ├── vunsigned.go
│   │   │   ├── vunsigned_subr.go
│   │   │   └── vunsigned_text_amd64.go
│   │   ├── traceback_test.mock_tmpl
│   │   ├── types/
│   │   │   └── types.go
│   │   ├── u64toa.tmpl
│   │   ├── unquote.tmpl
│   │   ├── validate_one.tmpl
│   │   ├── validate_utf8.tmpl
│   │   ├── validate_utf8_fast.tmpl
│   │   ├── value.tmpl
│   │   ├── vnumber.tmpl
│   │   ├── vsigned.tmpl
│   │   ├── vstring.tmpl
│   │   └── vunsigned.tmpl
│   ├── optcaching/
│   │   ├── asm.s
│   │   └── fcache.go
│   ├── resolver/
│   │   ├── asm.s
│   │   ├── fields.go
│   │   ├── resolver.go
│   │   └── resolver_test.go
│   ├── rt/
│   │   ├── asm_amd64.s
│   │   ├── asm_compat.s
│   │   ├── assertI2I.go
│   │   ├── base64_amd64.go
│   │   ├── base64_compat.go
│   │   ├── fastconv.go
│   │   ├── fastconv_test.go
│   │   ├── fastmem.go
│   │   ├── fastvalue.go
│   │   ├── gcwb.go
│   │   ├── gcwb_legacy.go
│   │   ├── gotype_go126.go
│   │   ├── gotype_legacy.go
│   │   ├── growslice.go
│   │   ├── growslice_legacy.go
│   │   ├── int48.go
│   │   ├── map_go124.go
│   │   ├── map_go126.go
│   │   ├── map_legacy.go
│   │   ├── maptype_indirectelem_go126.go
│   │   ├── maptype_indirectelem_legacy.go
│   │   ├── pool.go
│   │   ├── pool_test.go
│   │   ├── stubs.go
│   │   ├── stubs_test.go
│   │   ├── table.go
│   │   └── types.go
│   └── utils/
│       └── skip.go
├── issue_test/
│   ├── common_test.go
│   ├── go.mod
│   ├── go.sum
│   ├── hugestruct_test.go
│   ├── issue100_test.go
│   ├── issue101_test.go
│   ├── issue107_test.go
│   ├── issue108_test.go
│   ├── issue112_test.go
│   ├── issue113_test.go
│   ├── issue115_test.go
│   ├── issue119_test.go
│   ├── issue123_test.go
│   ├── issue128_test.go
│   ├── issue138_test.go
│   ├── issue141_test.go
│   ├── issue144_test.go
│   ├── issue16_test.go
│   ├── issue182_test.go
│   ├── issue186_test.go
│   ├── issue195_test.go
│   ├── issue206_test.go
│   ├── issue213_test.go
│   ├── issue242_test.go
│   ├── issue248_test.go
│   ├── issue258_test.go
│   ├── issue263_test.go
│   ├── issue273_test.go
│   ├── issue27_test.go
│   ├── issue293_test.go
│   ├── issue379_test.go
│   ├── issue381_test.go
│   ├── issue390_test.go
│   ├── issue39_test.go
│   ├── issue3_test.go
│   ├── issue403_test.go
│   ├── issue406_test.go
│   ├── issue437_test.go
│   ├── issue45_test.go
│   ├── issue460_test.go
│   ├── issue465_test.go
│   ├── issue491_test.go
│   ├── issue507_test.go
│   ├── issue539_test.go
│   ├── issue58_test.go
│   ├── issue5_test.go
│   ├── issue600_test.go
│   ├── issue634_test.go
│   ├── issue670_test.go
│   ├── issue67_test.go
│   ├── issue692_test.go
│   ├── issue716_test.go
│   ├── issue739_test.go
│   ├── issue744_test.go
│   ├── issue747_test.go
│   ├── issue750_test.go
│   ├── issue755_test.go
│   ├── issue758_test.go
│   ├── issue762_test.go
│   ├── issue76_test.go
│   ├── issue772_test.go
│   ├── issue774_test.go
│   ├── issue777_test.go
│   ├── issue7_test.go
│   ├── issue805_test.go
│   ├── issue811_test.go
│   ├── issue824_test.go
│   ├── issue825_test.go
│   ├── issue827_test.go
│   ├── issue829_test.go
│   ├── issue82_test.go
│   ├── issue834_test.go
│   ├── issue83_test.go
│   ├── issue860_test.go
│   ├── issue8_test.go
│   ├── issue90_test.go
│   ├── issue912_test.go
│   ├── issue916_test.go
│   ├── issue923_test.go
│   ├── issue93_test.go
│   ├── issue98_test.go
│   ├── issue_recurse_test.go
│   ├── plugin/
│   │   └── main.go
│   ├── plugin_test.go
│   ├── pretouch_test.go
│   ├── race_test_go
│   └── testmain_test.go
├── licenses/
│   ├── LICENSE-Drachennest
│   ├── LICENSE-eisel_lemire
│   ├── LICENSE-golang
│   ├── LICENSE-golang-asm
│   ├── LICENSE-simdjson
│   └── LICENSE-yyjson
├── loader/
│   ├── funcdata.go
│   ├── funcdata_compat.go
│   ├── funcdata_go117.go
│   ├── funcdata_go118.go
│   ├── funcdata_go120.go
│   ├── funcdata_go121.go
│   ├── funcdata_go123.go
│   ├── funcdata_go126.go
│   ├── funcdata_legacy.go
│   ├── go.mod
│   ├── go.sum
│   ├── internal/
│   │   ├── abi/
│   │   │   ├── abi.go
│   │   │   ├── abi_amd64.go
│   │   │   ├── abi_legacy_amd64.go
│   │   │   ├── abi_regabi_amd64.go
│   │   │   └── stubs.go
│   │   ├── iasm/
│   │   │   ├── expr/
│   │   │   │   ├── ast.go
│   │   │   │   ├── errors.go
│   │   │   │   ├── ops.go
│   │   │   │   ├── parser.go
│   │   │   │   ├── parser_test.go
│   │   │   │   ├── pools.go
│   │   │   │   ├── term.go
│   │   │   │   └── utils.go
│   │   │   ├── obj/
│   │   │   │   ├── macho.go
│   │   │   │   ├── macho_test.go
│   │   │   │   └── obj.go
│   │   │   ├── sync.sh
│   │   │   ├── trim.py
│   │   │   └── x86_64/
│   │   │       ├── arch.go
│   │   │       ├── asm.s
│   │   │       ├── eface.go
│   │   │       ├── encodings.go
│   │   │       ├── instructions.go
│   │   │       ├── instructions_table.go
│   │   │       ├── instructions_test.go
│   │   │       ├── operands.go
│   │   │       ├── pools.go
│   │   │       ├── program.go
│   │   │       ├── program_test.go
│   │   │       ├── registers.go
│   │   │       └── utils.go
│   │   └── rt/
│   │       ├── fastmem.go
│   │       ├── fastvalue.go
│   │       └── stackmap.go
│   ├── loader.go
│   ├── loader_go117_test.go
│   ├── loader_latest.go
│   ├── mmap_unix.go
│   ├── mmap_windows.go
│   ├── moduledata.go
│   ├── pcdata.go
│   ├── register.go
│   ├── register_tango.go
│   ├── register_test.go
│   ├── stubs.go
│   ├── wrapper.go
│   └── wrapper_test.go
├── native/
│   ├── atof_eisel_lemire.h
│   ├── atof_native.h
│   ├── f32toa.c
│   ├── f64toa.c
│   ├── fastint.h
│   ├── get_by_path.c
│   ├── html_escape.c
│   ├── i64toa.c
│   ├── lspace.c
│   ├── lspace.h
│   ├── native.h
│   ├── parse_with_padding.c
│   ├── parsing.h
│   ├── quote.c
│   ├── scanning.h
│   ├── simd.h
│   ├── skip_array.c
│   ├── skip_number.c
│   ├── skip_object.c
│   ├── skip_one.c
│   ├── skip_one_fast.c
│   ├── tab.h
│   ├── test/
│   │   ├── xassert.h
│   │   └── xprintf.h
│   ├── types.h
│   ├── u64toa.c
│   ├── unittest/
│   │   ├── test_fastfint.c
│   │   └── test_to_lower.c
│   ├── unquote.c
│   ├── utf8.h
│   ├── utils.h
│   ├── validate_one.c
│   ├── validate_utf8.c
│   ├── validate_utf8_fast.c
│   ├── value.c
│   ├── vnumber.c
│   ├── vsigned.c
│   ├── vstring.c
│   ├── vstring.h
│   └── vunsigned.c
├── option/
│   └── option.go
├── rawmessage.go
├── rfc_test.go
├── scripts/
│   ├── bench-arm.sh
│   ├── bench.py
│   ├── bench.sh
│   ├── build-arm.sh
│   ├── build-x86.sh
│   ├── check_branch_name.sh
│   ├── fuzz.sh
│   ├── go_flags.sh
│   ├── qemu.sh
│   ├── test_pcsp.py
│   └── test_race.sh
├── search_test.go
├── sonic.go
├── testdata/
│   ├── JSONTestSuite/
│   │   ├── LICENSE
│   │   └── README.md
│   ├── small.go
│   ├── twitter.go
│   ├── twitter.json
│   └── twitterescaped.json
├── tools/
│   └── asm2arm/
│       ├── arm.py
│       └── requirements.txt
├── unquote/
│   ├── unquote.go
│   └── unquote_fallback.go
└── utf8/
    ├── utf8.go
    ├── utf8_fallback.go
    ├── utf8_native_test.go
    └── utf8_test.go
Download .txt
Showing preview only (436K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (5438 symbols across 530 files)

FILE: api.go
  constant UseStdJSON (line 28) | UseStdJSON = iota
  constant UseSonicJSON (line 30) | UseSonicJSON
  constant APIKind (line 34) | APIKind = apiKind
  type Config (line 37) | type Config struct
  type API (line 125) | type API interface
  type Encoder (line 145) | type Encoder interface
  type Decoder (line 159) | type Decoder interface
  function Marshal (line 175) | func Marshal(val interface{}) ([]byte, error) {
  function MarshalIndent (line 182) | func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
  function MarshalString (line 187) | func MarshalString(val interface{}) (string, error) {
  function Unmarshal (line 194) | func Unmarshal(buf []byte, val interface{}) error {
  function UnmarshalString (line 199) | func UnmarshalString(buf string, val interface{}) error {
  function Get (line 213) | func Get(src []byte, path ...interface{}) (ast.Node, error) {
  function GetWithOptions (line 219) | func GetWithOptions(src []byte, opts ast.SearchOptions, path ...interfac...
  function GetFromString (line 230) | func GetFromString(src string, path ...interface{}) (ast.Node, error) {
  function GetCopyFromString (line 235) | func GetCopyFromString(src string, path ...interface{}) (ast.Node, error) {
  function Valid (line 240) | func Valid(data []byte) bool {
  function ValidString (line 245) | func ValidString(data string) bool {

FILE: api_test.go
  function TestValid (line 25) | func TestValid(t *testing.T) {
  function TestIdent (line 53) | func TestIdent(t *testing.T) {

FILE: ast/api.go
  function quote (line 36) | func quote(buf *[]byte, val string) {
  method decodeValue (line 40) | func (self *Parser) decodeValue() (val types.JsonState) {
  method skip (line 52) | func (self *Parser) skip() (int, types.ParsingError) {
  method encodeInterface (line 63) | func (self *Node) encodeInterface(buf *[]byte) error {
  method skipFast (line 68) | func (self *Parser) skipFast() (int, types.ParsingError) {
  method getByPath (line 76) | func (self *Parser) getByPath(validate bool, path ...interface{}) (int, ...
  function validate_utf8 (line 92) | func validate_utf8(str string) bool {

FILE: ast/api_compat.go
  function init (line 30) | func init() {
  function quote (line 34) | func quote(buf *[]byte, val string) {
  method decodeValue (line 38) | func (self *Parser) decodeValue() (val types.JsonState) {
  method skip (line 47) | func (self *Parser) skip() (int, types.ParsingError) {
  method skipFast (line 56) | func (self *Parser) skipFast() (int, types.ParsingError) {
  method encodeInterface (line 65) | func (self *Node) encodeInterface(buf *[]byte) error {
  method getByPath (line 74) | func (self *Parser) getByPath(validate bool, path ...interface{}) (int, ...
  function validate_utf8 (line 102) | func validate_utf8(str string) bool {

FILE: ast/api_native_test.go
  function TestSortNodeTwitter (line 34) | func TestSortNodeTwitter(t *testing.T) {
  function TestNodeAny (line 67) | func TestNodeAny(t *testing.T) {
  function TestTypeCast2 (line 104) | func TestTypeCast2(t *testing.T) {
  function TestStackAny (line 131) | func TestStackAny(t *testing.T) {
  function Test_Export (line 148) | func Test_Export(t *testing.T) {

FILE: ast/buffer.go
  type nodeChunk (line 26) | type nodeChunk
  type linkedNodes (line 28) | type linkedNodes struct
    method Cap (line 34) | func (self *linkedNodes) Cap() int {
    method Len (line 41) | func (self *linkedNodes) Len() int {
    method At (line 48) | func (self *linkedNodes) At(i int) *Node {
    method MoveOne (line 63) | func (self *linkedNodes) MoveOne(source int, target int) {
    method Pop (line 87) | func (self *linkedNodes) Pop() {
    method Push (line 95) | func (self *linkedNodes) Push(v Node) {
    method Set (line 99) | func (self *linkedNodes) Set(i int, v Node) {
    method growTailLength (line 123) | func (self *linkedNodes) growTailLength(l int) {
    method ToSlice (line 140) | func (self *linkedNodes) ToSlice(con []Node) {
    method FromSlice (line 161) | func (self *linkedNodes) FromSlice(con []Node) {
  type pairChunk (line 189) | type pairChunk
  type linkedPairs (line 191) | type linkedPairs struct
    method BuildIndex (line 198) | func (self *linkedPairs) BuildIndex() {
    method Cap (line 208) | func (self *linkedPairs) Cap() int {
    method Len (line 215) | func (self *linkedPairs) Len() int {
    method At (line 222) | func (self *linkedPairs) At(i int) *Pair {
    method Push (line 237) | func (self *linkedPairs) Push(v Pair) {
    method Pop (line 241) | func (self *linkedPairs) Pop() {
    method Unset (line 249) | func (self *linkedPairs) Unset(i int) {
    method Set (line 257) | func (self *linkedPairs) Set(i int, v Pair) {
    method set (line 265) | func (self *linkedPairs) set(i int, v Pair) {
    method growTailLength (line 289) | func (self *linkedPairs) growTailLength(l int) {
    method Get (line 307) | func (self *linkedPairs) Get(key string) (*Pair, int) {
    method ToSlice (line 331) | func (self *linkedPairs) ToSlice(con []Pair) {
    method ToMap (line 353) | func (self *linkedPairs) ToMap(con map[string]Node) {
    method copyPairs (line 360) | func (self *linkedPairs) copyPairs(to []Pair, from []Pair, l int) {
    method FromSlice (line 372) | func (self *linkedPairs) FromSlice(con []Pair) {
    method Less (line 400) | func (self *linkedPairs) Less(i, j int) bool {
    method Swap (line 404) | func (self *linkedPairs) Swap(i, j int) {
    method Sort (line 413) | func (self *linkedPairs) Sort() {
  function lessFrom (line 418) | func lessFrom(a, b string, d int) bool {
  type parseObjectStack (line 432) | type parseObjectStack struct
  type parseArrayStack (line 437) | type parseArrayStack struct
  function newLazyArray (line 442) | func newLazyArray(p *Parser) Node {
  function newLazyObject (line 451) | func newLazyObject(p *Parser) Node {
  method getParserAndArrayStack (line 460) | func (self *Node) getParserAndArrayStack() (*Parser, *parseArrayStack) {
  method getParserAndObjectStack (line 465) | func (self *Node) getParserAndObjectStack() (*Parser, *parseObjectStack) {

FILE: ast/buffer_test.go
  function makeNodes (line 26) | func makeNodes(l int) []Node {
  function makePairs (line 34) | func makePairs(l int) []Pair {
  function Test_linkedPairs_Push (line 42) | func Test_linkedPairs_Push(t *testing.T) {
  function Test_linkedNodes_Push (line 89) | func Test_linkedNodes_Push(t *testing.T) {
  function Test_linkedNodes_Pop (line 136) | func Test_linkedNodes_Pop(t *testing.T) {
  function Test_linkedNodes_MoveOne (line 179) | func Test_linkedNodes_MoveOne(t *testing.T) {

FILE: ast/decode.go
  constant strNull (line 34) | strNull     = "null"
  constant bytesTrue (line 35) | bytesTrue   = "true"
  constant bytesFalse (line 36) | bytesFalse  = "false"
  constant bytesObject (line 37) | bytesObject = "{}"
  constant bytesArray (line 38) | bytesArray  = "[]"
  function skipBlank (line 42) | func skipBlank(src string, pos int) int {
  function decodeNull (line 59) | func decodeNull(src string, pos int) (ret int) {
  function decodeTrue (line 71) | func decodeTrue(src string, pos int) (ret int) {
  function decodeFalse (line 84) | func decodeFalse(src string, pos int) (ret int) {
  function decodeString (line 96) | func decodeString(src string, pos int) (ret int, v string) {
  function decodeBinary (line 113) | func decodeBinary(src string, pos int) (ret int, v []byte) {
  function isDigit (line 127) | func isDigit(c byte) bool {
  function decodeInt64 (line 132) | func decodeInt64(src string, pos int) (ret int, v int64, err error) {
  function isNumberChars (line 177) | func isNumberChars(c byte) bool {
  function decodeFloat64 (line 182) | func decodeFloat64(src string, pos int) (ret int, v float64, err error) {
  function decodeValue (line 221) | func decodeValue(src string, pos int, skipnum bool) (ret int, v types.Js...
  function skipNumber (line 287) | func skipNumber(src string, pos int) (ret int) {
  function skipString (line 292) | func skipString(src string, pos int) (ret int, ep int) {
  function skipPair (line 328) | func skipPair(src string, pos int, lchar byte, rchar byte) (ret int) {
  function skipValueFast (line 375) | func skipValueFast(src string, pos int) (ret int, start int) {
  function skipValue (line 401) | func skipValue(src string, pos int) (ret int, start int) {
  function skipObject (line 427) | func skipObject(src string, pos int) (ret int, start int) {
  function skipArray (line 486) | func skipArray(src string, pos int) (ret int, start int) {
  function _DecodeString (line 529) | func _DecodeString(src string, pos int, needEsc bool, validStr bool) (v ...

FILE: ast/decode_test.go
  function Test_DecodeString (line 26) | func Test_DecodeString(t *testing.T) {

FILE: ast/encode.go
  function quoteString (line 28) | func quoteString(e *[]byte, s string) {
  method MarshalJSON (line 94) | func (self *Node) MarshalJSON() ([]byte, error) {
  function newBuffer (line 121) | func newBuffer() *[]byte {
  function freeBuffer (line 130) | func freeBuffer(buf *[]byte) {
  method encode (line 138) | func (self *Node) encode(buf *[]byte) error {
  method encodeRaw (line 168) | func (self *Node) encodeRaw(buf *[]byte) error {
  method encodeNull (line 182) | func (self *Node) encodeNull(buf *[]byte) error {
  method encodeTrue (line 187) | func (self *Node) encodeTrue(buf *[]byte) error {
  method encodeFalse (line 192) | func (self *Node) encodeFalse(buf *[]byte) error {
  method encodeNumber (line 197) | func (self *Node) encodeNumber(buf *[]byte) error {
  method encodeString (line 203) | func (self *Node) encodeString(buf *[]byte) error {
  method encodeArray (line 213) | func (self *Node) encodeArray(buf *[]byte) error {
  method encode (line 247) | func (self *Pair) encode(buf *[]byte) error {
  method encodeObject (line 259) | func (self *Node) encodeObject(buf *[]byte) error {

FILE: ast/encode_test.go
  function TestGC_Encode (line 31) | func TestGC_Encode(t *testing.T) {
  function TestEncodeValue (line 67) | func TestEncodeValue(t *testing.T) {
  function BenchmarkNil (line 123) | func BenchmarkNil(b *testing.B) {
  function TestEncodeNode (line 130) | func TestEncodeNode(t *testing.T) {
  type SortableNode (line 170) | type SortableNode struct
    method UnmarshalJSON (line 175) | func (j *SortableNode) UnmarshalJSON(data []byte) error {
    method MarshalJSON (line 180) | func (j *SortableNode) MarshalJSON() ([]byte, error) {
  function TestMarshalSort (line 188) | func TestMarshalSort(t *testing.T) {
  function BenchmarkEncodeRaw_Sonic (line 200) | func BenchmarkEncodeRaw_Sonic(b *testing.B) {
  function BenchmarkEncodeSkip_Sonic (line 220) | func BenchmarkEncodeSkip_Sonic(b *testing.B) {
  function BenchmarkEncodeLoad_Sonic (line 241) | func BenchmarkEncodeLoad_Sonic(b *testing.B) {
  function TestEncodeNone (line 262) | func TestEncodeNone(t *testing.T) {
  type testGetApi (line 284) | type testGetApi struct
  type checkError (line 289) | type checkError
  function isSyntaxError (line 291) | func isSyntaxError(err error) bool {
  function isEmptySource (line 298) | func isEmptySource(err error) bool {
  function isErrNotExist (line 305) | func isErrNotExist(err error) bool {
  function isErrUnsupportType (line 309) | func isErrUnsupportType(err error) bool {
  function testSyntaxJson (line 313) | func testSyntaxJson(t *testing.T, json string, path ...interface{}) {
  function TestGetFromEmptyJson (line 319) | func TestGetFromEmptyJson(t *testing.T) {
  function TestGetFromSyntaxError (line 337) | func TestGetFromSyntaxError(t *testing.T) {
  function TestGetWithInvalidUndemandedField (line 404) | func TestGetWithInvalidUndemandedField(t *testing.T) {
  function TestGet_InvalidPathType (line 432) | func TestGet_InvalidPathType(t *testing.T) {

FILE: ast/error.go
  function newError (line 11) | func newError(err types.ParsingError, msg string) *Node {
  function newErrorPair (line 19) | func newErrorPair(err SyntaxError) *Pair {
  method Error (line 24) | func (self Node) Error() string {
  function newSyntaxError (line 32) | func newSyntaxError(err SyntaxError) *Node {
  method syntaxError (line 41) | func (self *Parser) syntaxError(err types.ParsingError) SyntaxError {
  function unwrapError (line 49) | func unwrapError(err error) *Node {
  type SyntaxError (line 63) | type SyntaxError struct
    method Error (line 70) | func (self SyntaxError) Error() string {
    method Description (line 74) | func (self SyntaxError) Description() string {
    method description (line 78) | func (self SyntaxError) description() string {
    method Message (line 120) | func (self SyntaxError) Message() string {
  function clamp_zero (line 127) | func clamp_zero(v int) int {

FILE: ast/iterator.go
  type Pair (line 26) | type Pair struct
  function NewPair (line 32) | func NewPair(key string, val Node) Pair {
  method Values (line 41) | func (self *Node) Values() (ListIterator, error) {
  method values (line 48) | func (self *Node) values() ListIterator {
  method Properties (line 53) | func (self *Node) Properties() (ObjectIterator, error) {
  method properties (line 60) | func (self *Node) properties() ObjectIterator {
  type Iterator (line 64) | type Iterator struct
    method Pos (line 69) | func (self *Iterator) Pos() int {
    method Len (line 73) | func (self *Iterator) Len() int {
    method HasNext (line 78) | func (self *Iterator) HasNext() bool {
  type ListIterator (line 94) | type ListIterator struct
    method next (line 103) | func (self *ListIterator) next() *Node {
    method Next (line 119) | func (self *ListIterator) Next(v *Node) bool {
  type ObjectIterator (line 99) | type ObjectIterator struct
    method next (line 128) | func (self *ObjectIterator) next() *Pair {
    method Next (line 144) | func (self *ObjectIterator) Next(p *Pair) bool {
  type Sequence (line 156) | type Sequence struct
    method String (line 163) | func (s Sequence) String() string {
  type Scanner (line 171) | type Scanner
  method ForEach (line 180) | func (self *Node) ForEach(sc Scanner) error {

FILE: ast/iterator_test.go
  function getTestIteratorSample (line 28) | func getTestIteratorSample(loop int) (string, int) {
  function TestForEach (line 44) | func TestForEach(t *testing.T) {
  function TestRawIterator (line 93) | func TestRawIterator(t *testing.T) {
  function TestIterator (line 147) | func TestIterator(t *testing.T) {
  function TestExist (line 211) | func TestExist(t *testing.T) {
  function BenchmarkArrays (line 276) | func BenchmarkArrays(b *testing.B) {
  function BenchmarkListIterator (line 289) | func BenchmarkListIterator(b *testing.B) {
  function BenchmarkMap (line 305) | func BenchmarkMap(b *testing.B) {
  function BenchmarkObjectIterator (line 319) | func BenchmarkObjectIterator(b *testing.B) {

FILE: ast/node.go
  constant _V_NONE (line 32) | _V_NONE        types.ValueType = 0
  constant _V_NODE_BASE (line 33) | _V_NODE_BASE   types.ValueType = 1 << 5
  constant _V_LAZY (line 34) | _V_LAZY        types.ValueType = 1 << 7
  constant _V_RAW (line 35) | _V_RAW         types.ValueType = 1 << 8
  constant _V_NUMBER (line 36) | _V_NUMBER                      = _V_NODE_BASE + 1
  constant _V_ANY (line 37) | _V_ANY                         = _V_NODE_BASE + 2
  constant _V_ARRAY_LAZY (line 38) | _V_ARRAY_LAZY                  = _V_LAZY | types.V_ARRAY
  constant _V_OBJECT_LAZY (line 39) | _V_OBJECT_LAZY                 = _V_LAZY | types.V_OBJECT
  constant _MASK_LAZY (line 40) | _MASK_LAZY                     = _V_LAZY - 1
  constant _MASK_RAW (line 41) | _MASK_RAW                      = _V_RAW - 1
  constant V_NONE (line 45) | V_NONE   = 0
  constant V_ERROR (line 46) | V_ERROR  = 1
  constant V_NULL (line 47) | V_NULL   = int(types.V_NULL)
  constant V_TRUE (line 48) | V_TRUE   = int(types.V_TRUE)
  constant V_FALSE (line 49) | V_FALSE  = int(types.V_FALSE)
  constant V_ARRAY (line 50) | V_ARRAY  = int(types.V_ARRAY)
  constant V_OBJECT (line 51) | V_OBJECT = int(types.V_OBJECT)
  constant V_STRING (line 52) | V_STRING = int(types.V_STRING)
  constant V_NUMBER (line 53) | V_NUMBER = int(_V_NUMBER)
  constant V_ANY (line 54) | V_ANY    = int(_V_ANY)
  type Node (line 57) | type Node struct
    method UnmarshalJSON (line 66) | func (self *Node) UnmarshalJSON(data []byte) (err error) {
    method Type (line 88) | func (self Node) Type() int {
    method TypeSafe (line 105) | func (self *Node) TypeSafe() int {
    method itype (line 109) | func (self *Node) itype() types.ValueType {
    method Exists (line 114) | func (self *Node) Exists() bool {
    method Valid (line 123) | func (self *Node) Valid() bool {
    method Check (line 133) | func (self *Node) Check() error {
    method checkFast (line 143) | func (self *Node) checkFast() error {
    method IsRaw (line 156) | func (self Node) IsRaw() bool {
    method isRaw (line 161) | func (self *Node) isRaw() bool {
    method isLazy (line 165) | func (self *Node) isLazy() bool {
    method isAny (line 169) | func (self *Node) isAny() bool {
    method Raw (line 176) | func (self *Node) Raw() (string, error) {
    method checkRaw (line 195) | func (self *Node) checkRaw() error {
    method Bool (line 215) | func (self *Node) Bool() (bool, error) {
    method Int64 (line 286) | func (self *Node) Int64() (int64, error) {
    method StrictInt64 (line 363) | func (self *Node) StrictInt64() (int64, error) {
    method Number (line 418) | func (self *Node) Number() (json.Number, error) {
    method StrictNumber (line 485) | func (self *Node) StrictNumber() (json.Number, error) {
    method String (line 506) | func (self *Node) String() (string, error) {
    method StrictString (line 562) | func (self *Node) StrictString() (string, error) {
    method Float64 (line 583) | func (self *Node) Float64() (float64, error) {
    method StrictBool (line 649) | func (self *Node) StrictBool() (bool, error) {
    method StrictFloat64 (line 672) | func (self *Node) StrictFloat64() (float64, error) {
    method Len (line 698) | func (self *Node) Len() (int, error) {
    method len (line 711) | func (self *Node) len() int {
    method Cap (line 716) | func (self *Node) Cap() (int, error) {
    method Set (line 739) | func (self *Node) Set(key string, node Node) (bool, error) {
    method SetAny (line 777) | func (self *Node) SetAny(key string, val interface{}) (bool, error) {
    method Unset (line 782) | func (self *Node) Unset(key string) (bool, error) {
    method SetByIndex (line 803) | func (self *Node) SetByIndex(index int, node Node) (bool, error) {
    method SetAnyByIndex (line 828) | func (self *Node) SetAnyByIndex(index int, val interface{}) (bool, err...
    method UnsetByIndex (line 836) | func (self *Node) UnsetByIndex(index int) (bool, error) {
    method Add (line 883) | func (self *Node) Add(node Node) error {
    method Pop (line 908) | func (self *Node) Pop() error {
    method Move (line 954) | func (self *Node) Move(dst, src int) error {
    method AddAny (line 992) | func (self *Node) AddAny(val interface{}) error {
    method GetByPath (line 1001) | func (self *Node) GetByPath(path ...interface{}) *Node {
    method Get (line 1026) | func (self *Node) Get(key string) *Node {
    method Index (line 1036) | func (self *Node) Index(idx int) *Node {
    method IndexPair (line 1059) | func (self *Node) IndexPair(idx int) *Pair {
    method indexOrGet (line 1066) | func (self *Node) indexOrGet(idx int, key string) (*Node, int) {
    method IndexOrGet (line 1081) | func (self *Node) IndexOrGet(idx int, key string) *Node {
    method IndexOrGetWithIdx (line 1088) | func (self *Node) IndexOrGetWithIdx(idx int, key string) (*Node, int) {
    method Map (line 1095) | func (self *Node) Map() (map[string]interface{}, error) {
    method MapUseNumber (line 1114) | func (self *Node) MapUseNumber() (map[string]interface{}, error) {
    method MapUseNode (line 1134) | func (self *Node) MapUseNode() (map[string]Node, error) {
    method unsafeMap (line 1167) | func (self *Node) unsafeMap() (*linkedPairs, error) {
    method SortKeys (line 1179) | func (self *Node) SortKeys(recurse bool) error {
    method sortKeys (line 1207) | func (self *Node) sortKeys(recurse bool) (err error) {
    method Array (line 1240) | func (self *Node) Array() ([]interface{}, error) {
    method ArrayUseNumber (line 1259) | func (self *Node) ArrayUseNumber() ([]interface{}, error) {
    method ArrayUseNode (line 1279) | func (self *Node) ArrayUseNode() ([]Node, error) {
    method unsafeArray (line 1312) | func (self *Node) unsafeArray() (*linkedNodes, error) {
    method Interface (line 1325) | func (self *Node) Interface() (interface{}, error) {
    method packAny (line 1374) | func (self *Node) packAny() interface{} {
    method InterfaceUseNumber (line 1380) | func (self *Node) InterfaceUseNumber() (interface{}, error) {
    method InterfaceUseNode (line 1420) | func (self *Node) InterfaceUseNode() (interface{}, error) {
    method LoadAll (line 1446) | func (self *Node) LoadAll() error {
    method Load (line 1452) | func (self *Node) Load() error {
    method should (line 1471) | func (self *Node) should(t types.ValueType) error {
    method nodeAt (line 1481) | func (self *Node) nodeAt(i int) *Node {
    method pairAt (line 1505) | func (self *Node) pairAt(i int) *Pair {
    method skipAllIndex (line 1529) | func (self *Node) skipAllIndex() error {
    method skipAllKey (line 1544) | func (self *Node) skipAllKey() error {
    method skipKey (line 1559) | func (self *Node) skipKey(key string) (*Node, int) {
    method skipIndex (line 1597) | func (self *Node) skipIndex(index int) *Node {
    method skipIndexPair (line 1620) | func (self *Node) skipIndexPair(index int) *Pair {
    method loadAllIndex (line 1642) | func (self *Node) loadAllIndex(loadOnce bool) error {
    method loadAllKey (line 1660) | func (self *Node) loadAllKey(loadOnce bool) error {
    method removeNode (line 1679) | func (self *Node) removeNode(i int) {
    method removePair (line 1689) | func (self *Node) removePair(i int) {
    method removePairAt (line 1699) | func (self *Node) removePairAt(i int) {
    method toGenericArray (line 1709) | func (self *Node) toGenericArray() ([]interface{}, error) {
    method toGenericArrayUseNumber (line 1730) | func (self *Node) toGenericArrayUseNumber() ([]interface{}, error) {
    method toGenericArrayUseNode (line 1751) | func (self *Node) toGenericArrayUseNode() ([]Node, error) {
    method toGenericObject (line 1764) | func (self *Node) toGenericObject() (map[string]interface{}, error) {
    method toGenericObjectUseNumber (line 1785) | func (self *Node) toGenericObjectUseNumber() (map[string]interface{}, ...
    method toGenericObjectUseNode (line 1806) | func (self *Node) toGenericObjectUseNode() (map[string]Node, error) {
    method toNumber (line 1917) | func (node *Node) toNumber() json.Number {
    method toString (line 1921) | func (self *Node) toString() string {
    method toFloat64 (line 1925) | func (node *Node) toFloat64() (float64, error) {
    method toInt64 (line 1933) | func (node *Node) toInt64() (int64, error) {
    method setArray (line 1979) | func (self *Node) setArray(v *linkedNodes) {
    method setObject (line 2004) | func (self *Node) setObject(v *linkedPairs) {
    method parseRaw (line 2013) | func (self *Node) parseRaw(full bool) {
    method assign (line 2039) | func (self *Node) assign(n Node) {
  function castNumber (line 407) | func castNumber(v bool) json.Number {
  function NewRaw (line 1830) | func NewRaw(json string) Node {
  function NewRawConcurrentRead (line 1846) | func NewRawConcurrentRead(json string) Node {
  function NewAny (line 1861) | func NewAny(any interface{}) Node {
  function NewBytes (line 1876) | func NewBytes(src []byte) Node {
  function NewNull (line 1885) | func NewNull() Node {
  function NewBool (line 1896) | func NewBool(v bool) Node {
  function NewNumber (line 1909) | func NewNumber(v string) Node {
  function newBytes (line 1941) | func newBytes(v []byte) Node {
  function NewString (line 1953) | func NewString(v string) Node {
  function NewArray (line 1963) | func NewArray(v []Node) Node {
  constant _Threshold_Index (line 1969) | _Threshold_Index = 16
  function newArray (line 1971) | func newArray(v *linkedNodes) Node {
  function NewObject (line 1987) | func NewObject(v []Pair) Node {
  function newObject (line 1993) | func newObject(v *linkedPairs) Node {

FILE: ast/node_test.go
  function TestNodeSortKeys (line 35) | func TestNodeSortKeys(t *testing.T) {
  function BenchmarkNodeSortKeys (line 83) | func BenchmarkNodeSortKeys(b *testing.B) {
  function TestNodeSortKeys2 (line 112) | func TestNodeSortKeys2(t *testing.T) {
  function stackObj (line 133) | func stackObj() interface{} {
  function TestLoadAll (line 138) | func TestLoadAll(t *testing.T) {
  function TestIndexPair (line 224) | func TestIndexPair(t *testing.T) {
  function TestIndexOrGet (line 240) | func TestIndexOrGet(t *testing.T) {
  function TestIndexOrGetWithIdx (line 256) | func TestIndexOrGetWithIdx(t *testing.T) {
  function TestTypeCast (line 267) | func TestTypeCast(t *testing.T) {
  function TestCheckError_Nil (line 551) | func TestCheckError_Nil(t *testing.T) {
  function TestCheckError_None (line 597) | func TestCheckError_None(t *testing.T) {
  function TestCheckError_Error (line 659) | func TestCheckError_Error(t *testing.T) {
  function TestCheckError_Empty (line 705) | func TestCheckError_Empty(t *testing.T) {
  function TestIndex (line 777) | func TestIndex(t *testing.T) {
  function TestUnset (line 790) | func TestUnset(t *testing.T) {
  function TestUseNode (line 951) | func TestUseNode(t *testing.T) {
  function TestUseNumber (line 1037) | func TestUseNumber(t *testing.T) {
  function TestMap (line 1073) | func TestMap(t *testing.T) {
  function TestArray (line 1094) | func TestArray(t *testing.T) {
  function TestNodeRaw (line 1115) | func TestNodeRaw(t *testing.T) {
  function TestNodeGet (line 1196) | func TestNodeGet(t *testing.T) {
  function TestNodeIndex (line 1207) | func TestNodeIndex(t *testing.T) {
  function TestNodeGetByPath (line 1218) | func TestNodeGetByPath(t *testing.T) {
  function TestNodeSet (line 1229) | func TestNodeSet(t *testing.T) {
  function TestNodeSetByIndex (line 1314) | func TestNodeSetByIndex(t *testing.T) {
  function TestNodeAdd (line 1340) | func TestNodeAdd(t *testing.T) {
  function BenchmarkLoadNode (line 1370) | func BenchmarkLoadNode(b *testing.B) {
  function BenchmarkLoadNode_Parallel (line 1420) | func BenchmarkLoadNode_Parallel(b *testing.B) {
  function BenchmarkNodeGetByPath (line 1478) | func BenchmarkNodeGetByPath(b *testing.B) {
  function BenchmarkStructGetByPath (line 1493) | func BenchmarkStructGetByPath(b *testing.B) {
  function BenchmarkNodeIndex (line 1509) | func BenchmarkNodeIndex(b *testing.B) {
  function BenchmarkStructIndex (line 1526) | func BenchmarkStructIndex(b *testing.B) {
  function BenchmarkSliceIndex (line 1541) | func BenchmarkSliceIndex(b *testing.B) {
  function BenchmarkMapIndex (line 1549) | func BenchmarkMapIndex(b *testing.B) {
  function BenchmarkNodeGet (line 1561) | func BenchmarkNodeGet(b *testing.B) {
  function BenchmarkSliceGet (line 1579) | func BenchmarkSliceGet(b *testing.B) {
  function BenchmarkMapGet (line 1592) | func BenchmarkMapGet(b *testing.B) {
  function BenchmarkNodeSet (line 1610) | func BenchmarkNodeSet(b *testing.B) {
  function BenchmarkMapSet (line 1628) | func BenchmarkMapSet(b *testing.B) {
  function BenchmarkNodeSetByIndex (line 1647) | func BenchmarkNodeSetByIndex(b *testing.B) {
  function BenchmarkSliceSetByIndex (line 1665) | func BenchmarkSliceSetByIndex(b *testing.B) {
  function BenchmarkStructSetByIndex (line 1684) | func BenchmarkStructSetByIndex(b *testing.B) {
  function BenchmarkNodeUnset (line 1700) | func BenchmarkNodeUnset(b *testing.B) {
  function BenchmarkMapUnset (line 1717) | func BenchmarkMapUnset(b *testing.B) {
  function BenchmarkNodUnsetByIndex (line 1735) | func BenchmarkNodUnsetByIndex(b *testing.B) {
  function BenchmarkSliceUnsetByIndex (line 1752) | func BenchmarkSliceUnsetByIndex(b *testing.B) {
  function BenchmarkNodeAdd (line 1772) | func BenchmarkNodeAdd(b *testing.B) {
  function BenchmarkSliceAdd (line 1781) | func BenchmarkSliceAdd(b *testing.B) {
  function BenchmarkMapAdd (line 1790) | func BenchmarkMapAdd(b *testing.B) {
  function TestNode_Move (line 1799) | func TestNode_Move(t *testing.T) {
  function TestNode_Pop (line 1885) | func TestNode_Pop(t *testing.T) {

FILE: ast/parser.go
  constant _DEFAULT_NODE_CAP (line 31) | _DEFAULT_NODE_CAP  int = 16
  constant _APPEND_GROW_SHIFT (line 32) | _APPEND_GROW_SHIFT     = 1
  constant _ERR_NOT_FOUND (line 36) | _ERR_NOT_FOUND      types.ParsingError = 33
  constant _ERR_UNSUPPORT_TYPE (line 37) | _ERR_UNSUPPORT_TYPE types.ParsingError = 34
  type Parser (line 48) | type Parser struct
    method delim (line 59) | func (self *Parser) delim() types.ParsingError {
    method object (line 78) | func (self *Parser) object() types.ParsingError {
    method array (line 97) | func (self *Parser) array() types.ParsingError {
    method lspace (line 116) | func (self *Parser) lspace(sp int) int {
    method backward (line 124) | func (self *Parser) backward() {
    method decodeArray (line 129) | func (self *Parser) decodeArray(ret *linkedNodes) (Node, types.Parsing...
    method decodeObject (line 195) | func (self *Parser) decodeObject(ret *linkedPairs) (Node, types.Parsin...
    method decodeString (line 284) | func (self *Parser) decodeString(iv int64, ep int) (Node, types.Parsin...
    method Pos (line 306) | func (self *Parser) Pos() int {
    method Parse (line 313) | func (self *Parser) Parse() (Node, types.ParsingError) {
    method searchKey (line 378) | func (self *Parser) searchKey(match string) types.ParsingError {
    method searchIndex (line 449) | func (self *Parser) searchIndex(idx int) types.ParsingError {
    method decodeNumber (line 687) | func (self *Parser) decodeNumber(decode bool) {
    method ExportError (line 699) | func (self *Parser) ExportError(err types.ParsingError) error {
  method skipNextNode (line 496) | func (self *Node) skipNextNode() *Node {
  method skipNextPair (line 554) | func (self *Node) skipNextPair() *Pair {
  function Loads (line 640) | func Loads(src string) (int, interface{}, error) {
  function LoadsUseNumber (line 657) | func LoadsUseNumber(src string) (int, interface{}, error) {
  function NewParser (line 674) | func NewParser(src string) *Parser {
  function NewParserObj (line 679) | func NewParserObj(src string) Parser {
  function backward (line 710) | func backward(src string, i int) int {
  function newRawNode (line 716) | func newRawNode(str string, typ types.ValueType, lock bool) Node {
  function switchRawType (line 748) | func switchRawType(c byte) types.ValueType {
  method loadt (line 752) | func (self *Node) loadt() types.ValueType {
  method lock (line 756) | func (self *Node) lock() bool {
  method unlock (line 764) | func (self *Node) unlock() {
  method rlock (line 770) | func (self *Node) rlock() bool {
  method runlock (line 778) | func (self *Node) runlock() {

FILE: ast/parser_test.go
  function TestMain (line 37) | func TestMain(m *testing.M) {
  function TestGC_Parse (line 53) | func TestGC_Parse(t *testing.T) {
  function runDecoderTest (line 78) | func runDecoderTest(t *testing.T, src string, expect interface{}) {
  function runDecoderTestUseNumber (line 87) | func runDecoderTestUseNumber(t *testing.T, src string, expect interface{...
  function n2f64 (line 115) | func n2f64(i json.Number) float64 {
  function TestParser_Basic (line 123) | func TestParser_Basic(t *testing.T) {
  function TestLoads (line 212) | func TestLoads(t *testing.T) {
  function TestParsehNotExist (line 225) | func TestParsehNotExist(t *testing.T) {
  function BenchmarkParser_Sonic (line 248) | func BenchmarkParser_Sonic(b *testing.B) {
  function BenchmarkParser_Parallel_Sonic (line 264) | func BenchmarkParser_Parallel_Sonic(b *testing.B) {
  function BenchmarkParseEmpty_Sonic (line 279) | func BenchmarkParseEmpty_Sonic(b *testing.B) {
  function BenchmarkParseOne_Sonic (line 293) | func BenchmarkParseOne_Sonic(b *testing.B) {
  function BenchmarkParseOne_Parallel_Sonic (line 307) | func BenchmarkParseOne_Parallel_Sonic(b *testing.B) {
  function BenchmarkParseNoLazy_Sonic (line 323) | func BenchmarkParseNoLazy_Sonic(b *testing.B) {
  function BenchmarkParseNoLazy_Parallel_Sonic (line 335) | func BenchmarkParseNoLazy_Parallel_Sonic(b *testing.B) {
  function BenchmarkNodeRaw_Parallel_Sonic (line 349) | func BenchmarkNodeRaw_Parallel_Sonic(b *testing.B) {
  function BenchmarkParseSeven_Sonic (line 363) | func BenchmarkParseSeven_Sonic(b *testing.B) {
  function BenchmarkParseSeven_Parallel_Sonic (line 381) | func BenchmarkParseSeven_Parallel_Sonic(b *testing.B) {

FILE: ast/search.go
  type SearchOptions (line 25) | type SearchOptions struct
  type Searcher (line 38) | type Searcher struct
    method GetByPathCopy (line 56) | func (self *Searcher) GetByPathCopy(path ...interface{}) (Node, error) {
    method GetByPath (line 65) | func (self *Searcher) GetByPath(path ...interface{}) (Node, error) {
    method getByPath (line 69) | func (self *Searcher) getByPath(path ...interface{}) (Node, error) {
  function NewSearcher (line 43) | func NewSearcher(str string) *Searcher {
  function _GetByPath (line 102) | func _GetByPath(src string, path ...interface{}) (start int, end int, ty...
  function _ValidSyntax (line 128) | func _ValidSyntax(json string) bool {
  function _SkipFast (line 142) | func _SkipFast(src string, i int) (int, int, error) {

FILE: ast/search_test.go
  function TestGC_Search (line 32) | func TestGC_Search(t *testing.T) {
  function TestNodeRace (line 59) | func TestNodeRace(t *testing.T) {
  function TestExportErrorInvalidChar (line 125) | func TestExportErrorInvalidChar(t *testing.T) {
  type testExportError (line 177) | type testExportError struct
  function TestExportErrNotExist (line 183) | func TestExportErrNotExist(t *testing.T) {
  function TestSearcher_GetByPath (line 227) | func TestSearcher_GetByPath(t *testing.T) {
  function TestSearch_LoadRawNumber (line 261) | func TestSearch_LoadRawNumber(t *testing.T) {
  type testGetByPath (line 287) | type testGetByPath struct
  function TestSearcher_GetByPathSingle (line 294) | func TestSearcher_GetByPathSingle(t *testing.T) {
  function TestSearcher_GetByPathErr (line 338) | func TestSearcher_GetByPathErr(t *testing.T) {
  function TestLoadIndex (line 371) | func TestLoadIndex(t *testing.T) {
  function TestSearchNotExist (line 387) | func TestSearchNotExist(t *testing.T) {
  function BenchmarkGetOne_Sonic (line 407) | func BenchmarkGetOne_Sonic(b *testing.B) {
  function BenchmarkGetOneSafe_Sonic (line 422) | func BenchmarkGetOneSafe_Sonic(b *testing.B) {
  function BenchmarkGetFull_Sonic (line 438) | func BenchmarkGetFull_Sonic(b *testing.B) {
  function BenchmarkGetWithManyCompare_Sonic (line 451) | func BenchmarkGetWithManyCompare_Sonic(b *testing.B) {
  function BenchmarkGetOne_Parallel_Sonic (line 466) | func BenchmarkGetOne_Parallel_Sonic(b *testing.B) {
  function BenchmarkGetOneSafe_Parallel_Sonic (line 483) | func BenchmarkGetOneSafe_Parallel_Sonic(b *testing.B) {
  function BenchmarkSetOne_Sonic (line 501) | func BenchmarkSetOne_Sonic(b *testing.B) {
  function BenchmarkSetOne_Parallel_Sonic (line 520) | func BenchmarkSetOne_Parallel_Sonic(b *testing.B) {

FILE: ast/stubs.go
  function mem2ptr (line 26) | func mem2ptr(s []byte) unsafe.Pointer {

FILE: ast/testdata_test.go
  constant _TwitterJson (line 19) | _TwitterJson = `{
  constant _LotsCompare (line 435) | _LotsCompare = `{"hi":0,"hi":0,"hi":0,"hi":0,"hi":0,"hi":0,"hi":0,"hi":0...
  type _TwitterStruct (line 437) | type _TwitterStruct struct

FILE: ast/visitor.go
  type Visitor (line 37) | type Visitor interface
  type VisitorOptions (line 96) | type VisitorOptions struct
  function Preorder (line 109) | func Preorder(str string, visitor Visitor, opts *VisitorOptions) error {
  type traverser (line 140) | type traverser struct
    method decodeValue (line 146) | func (self *traverser) decodeValue() error {
    method decodeArray (line 174) | func (self *traverser) decodeArray() error {
    method decodeObject (line 229) | func (self *traverser) decodeObject() error {
    method decodeString (line 313) | func (self *traverser) decodeString(iv int64, ep int) error {

FILE: ast/visitor_test.go
  type visitorNodeDiffTest (line 42) | type visitorNodeDiffTest struct
    method incrSP (line 61) | func (self *visitorNodeDiffTest) incrSP() {
    method debugStack (line 67) | func (self *visitorNodeDiffTest) debugStack() string {
    method requireType (line 86) | func (self *visitorNodeDiffTest) requireType(got int) {
    method toArrayIndex (line 92) | func (self *visitorNodeDiffTest) toArrayIndex(array Node, i int) {
    method onValueEnd (line 103) | func (self *visitorNodeDiffTest) onValueEnd() {
    method OnNull (line 132) | func (self *visitorNodeDiffTest) OnNull() error {
    method OnBool (line 141) | func (self *visitorNodeDiffTest) OnBool(v bool) error {
    method OnString (line 154) | func (self *visitorNodeDiffTest) OnString(v string) error {
    method OnInt64 (line 166) | func (self *visitorNodeDiffTest) OnInt64(v int64, n json.Number) error {
    method OnFloat64 (line 181) | func (self *visitorNodeDiffTest) OnFloat64(v float64, n json.Number) e...
    method OnObjectBegin (line 196) | func (self *visitorNodeDiffTest) OnObjectBegin(capacity int) error {
    method OnObjectKey (line 207) | func (self *visitorNodeDiffTest) OnObjectKey(key string) error {
    method OnObjectEnd (line 220) | func (self *visitorNodeDiffTest) OnObjectEnd() error {
    method OnArrayBegin (line 259) | func (self *visitorNodeDiffTest) OnArrayBegin(capacity int) error {
    method OnArrayEnd (line 271) | func (self *visitorNodeDiffTest) OnArrayEnd() error {
    method Run (line 300) | func (self *visitorNodeDiffTest) Run(t *testing.T, str string,
  function TestVisitor_NodeDiff (line 317) | func TestVisitor_NodeDiff(t *testing.T) {
  type visitorUserNode (line 343) | type visitorUserNode interface
  type visitorUserNull (line 348) | type visitorUserNull struct
    method UserNode (line 357) | func (*visitorUserNull) UserNode()    {}
  type visitorUserBool (line 349) | type visitorUserBool struct
    method UserNode (line 358) | func (*visitorUserBool) UserNode()    {}
  type visitorUserInt64 (line 350) | type visitorUserInt64 struct
    method UserNode (line 359) | func (*visitorUserInt64) UserNode()   {}
  type visitorUserFloat64 (line 351) | type visitorUserFloat64 struct
    method UserNode (line 360) | func (*visitorUserFloat64) UserNode() {}
  type visitorUserString (line 352) | type visitorUserString struct
    method UserNode (line 361) | func (*visitorUserString) UserNode()  {}
  type visitorUserObject (line 353) | type visitorUserObject struct
    method UserNode (line 362) | func (*visitorUserObject) UserNode()  {}
  type visitorUserArray (line 354) | type visitorUserArray struct
    method UserNode (line 363) | func (*visitorUserArray) UserNode()   {}
  function compareUserNode (line 365) | func compareUserNode(tb testing.TB, lhs, rhs visitorUserNode) bool {
  type visitorUserNodeDecoder (line 411) | type visitorUserNodeDecoder interface
  type visitorUserNodeASTDecoder (line 418) | type visitorUserNodeASTDecoder struct
    method Reset (line 420) | func (self *visitorUserNodeASTDecoder) Reset() {}
    method Decode (line 422) | func (self *visitorUserNodeASTDecoder) Decode(str string) (visitorUser...
    method decodeValue (line 430) | func (self *visitorUserNodeASTDecoder) decodeValue(root *Node) (visito...
  type visitorUserNodeVisitorDecoder (line 508) | type visitorUserNodeVisitorDecoder struct
    method Reset (line 520) | func (self *visitorUserNodeVisitorDecoder) Reset() {
    method Decode (line 525) | func (self *visitorUserNodeVisitorDecoder) Decode(str string) (visitor...
    method result (line 532) | func (self *visitorUserNodeVisitorDecoder) result() (visitorUserNode, ...
    method incrSP (line 539) | func (self *visitorUserNodeVisitorDecoder) incrSP() error {
    method OnNull (line 547) | func (self *visitorUserNodeVisitorDecoder) OnNull() error {
    method OnBool (line 555) | func (self *visitorUserNodeVisitorDecoder) OnBool(v bool) error {
    method OnString (line 563) | func (self *visitorUserNodeVisitorDecoder) OnString(v string) error {
    method OnInt64 (line 571) | func (self *visitorUserNodeVisitorDecoder) OnInt64(v int64, n json.Num...
    method OnFloat64 (line 579) | func (self *visitorUserNodeVisitorDecoder) OnFloat64(v float64, n json...
    method OnObjectBegin (line 587) | func (self *visitorUserNodeVisitorDecoder) OnObjectBegin(capacity int)...
    method OnObjectKey (line 592) | func (self *visitorUserNodeVisitorDecoder) OnObjectKey(key string) err...
    method OnObjectEnd (line 597) | func (self *visitorUserNodeVisitorDecoder) OnObjectEnd() error {
    method OnArrayBegin (line 603) | func (self *visitorUserNodeVisitorDecoder) OnArrayBegin(capacity int) ...
    method OnArrayEnd (line 608) | func (self *visitorUserNodeVisitorDecoder) OnArrayEnd() error {
    method onValueEnd (line 614) | func (self *visitorUserNodeVisitorDecoder) onValueEnd() error {
  function testUserNodeDiff (line 630) | func testUserNodeDiff(t *testing.T, d1, d2 visitorUserNodeDecoder, str s...
  function TestVisitor_UserNodeDiff (line 643) | func TestVisitor_UserNodeDiff(t *testing.T) {
  type skipVisitor (line 654) | type skipVisitor struct
    method OnNull (line 661) | func (self *skipVisitor) OnNull() error {
    method OnFloat64 (line 668) | func (self *skipVisitor) OnFloat64(v float64, n json.Number) error {
    method OnInt64 (line 675) | func (self *skipVisitor) OnInt64(v int64, n json.Number) error {
    method OnBool (line 682) | func (self *skipVisitor) OnBool(v bool) error {
    method OnString (line 689) | func (self *skipVisitor) OnString(v string) error {
    method OnObjectBegin (line 696) | func (self *skipVisitor) OnObjectBegin(capacity int) error {
    method OnObjectKey (line 709) | func (self *skipVisitor) OnObjectKey(key string) error {
    method OnObjectEnd (line 716) | func (self *skipVisitor) OnObjectEnd() error {
    method OnArrayBegin (line 728) | func (self *skipVisitor) OnArrayBegin(capacity int) error {
    method OnArrayEnd (line 741) | func (self *skipVisitor) OnArrayEnd() error {
  function TestVisitor_OpSkip (line 754) | func TestVisitor_OpSkip(t *testing.T) {
  function BenchmarkVisitor_UserNode (line 763) | func BenchmarkVisitor_UserNode(b *testing.B) {

FILE: compat.go
  constant apiKind (line 31) | apiKind = UseStdJSON
  type frozenConfig (line 33) | type frozenConfig struct
    method marshalOptions (line 43) | func (cfg frozenConfig) marshalOptions(val interface{}, prefix, indent...
    method Marshal (line 60) | func (cfg frozenConfig) Marshal(val interface{}) ([]byte, error) {
    method MarshalToString (line 68) | func (cfg frozenConfig) MarshalToString(val interface{}) (string, erro...
    method MarshalIndent (line 74) | func (cfg frozenConfig) MarshalIndent(val interface{}, prefix, indent ...
    method UnmarshalFromString (line 82) | func (cfg frozenConfig) UnmarshalFromString(buf string, val interface{...
    method Unmarshal (line 105) | func (cfg frozenConfig) Unmarshal(buf []byte, val interface{}) error {
    method NewEncoder (line 110) | func (cfg frozenConfig) NewEncoder(writer io.Writer) Encoder {
    method NewDecoder (line 119) | func (cfg frozenConfig) NewDecoder(reader io.Reader) Decoder {
    method Valid (line 131) | func (cfg frozenConfig) Valid(data []byte) bool {
  method Froze (line 38) | func (cfg Config) Froze() API {
  function Pretouch (line 141) | func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {

FILE: compat_test.go
  function TestCompatUnmarshalStd (line 34) | func TestCompatUnmarshalStd(t *testing.T) {
  function TestCompatMarshalStd (line 80) | func TestCompatMarshalStd(t *testing.T) {
  function TestCompatEncoderStd (line 109) | func TestCompatEncoderStd(t *testing.T) {
  function TestCompatDecoderStd (line 140) | func TestCompatDecoderStd(t *testing.T) {
  function TestPretouch (line 165) | func TestPretouch(t *testing.T) {
  function TestGet (line 179) | func TestGet(t *testing.T) {
  function TestUnmarshalWithTrailingChars (line 194) | func TestUnmarshalWithTrailingChars(t *testing.T) {
  function TestUnmarshalJSONSuite (line 213) | func TestUnmarshalJSONSuite(t *testing.T) {

FILE: decode_test.go
  type T (line 49) | type T struct
  type U (line 55) | type U struct
  type V (line 59) | type V struct
  type VOuter (line 66) | type VOuter struct
  type W (line 70) | type W struct
  type P (line 74) | type P struct
  type PP (line 78) | type PP struct
  type SS (line 83) | type SS
    method UnmarshalJSON (line 85) | func (*SS) UnmarshalJSON(_ []byte) error {
  type tx (line 105) | type tx struct
  type u8 (line 109) | type u8
  type unmarshaler (line 113) | type unmarshaler struct
    method UnmarshalJSON (line 117) | func (u *unmarshaler) UnmarshalJSON(_ []byte) error {
  type ustruct (line 122) | type ustruct struct
  type unmarshalerText (line 126) | type unmarshalerText struct
    method MarshalText (line 131) | func (u unmarshalerText) MarshalText() ([]byte, error) {
    method UnmarshalText (line 135) | func (u *unmarshalerText) UnmarshalText(b []byte) error {
  type ustructText (line 146) | type ustructText struct
  type u8marshal (line 151) | type u8marshal
    method MarshalText (line 153) | func (u8 u8marshal) MarshalText() ([]byte, error) {
    method UnmarshalText (line 159) | func (u8 *u8marshal) UnmarshalText(b []byte) error {
  type Point (line 187) | type Point struct
  type Top (line 191) | type Top struct
  type Embed0 (line 203) | type Embed0 struct
  type Embed0a (line 211) | type Embed0a struct
  type Embed0b (line 219) | type Embed0b
  type Embed0c (line 221) | type Embed0c
  type Embed0p (line 223) | type Embed0p struct
  type Embed0q (line 227) | type Embed0q struct
  type embed (line 231) | type embed struct
  type Loop (line 235) | type Loop struct
  type S5 (line 243) | type S5 struct
  type S6 (line 249) | type S6 struct
  type S7 (line 253) | type S7
  type S8 (line 255) | type S8 struct
  type S9 (line 259) | type S9 struct
  type S10 (line 266) | type S10 struct
  type S11 (line 272) | type S11 struct
  type S12 (line 276) | type S12 struct
  type S13 (line 280) | type S13 struct
  type Ambig (line 284) | type Ambig struct
  type XYZ (line 290) | type XYZ struct
  type byteWithMarshalJSON (line 296) | type byteWithMarshalJSON
    method MarshalJSON (line 298) | func (b byteWithMarshalJSON) MarshalJSON() ([]byte, error) {
    method UnmarshalJSON (line 302) | func (b *byteWithMarshalJSON) UnmarshalJSON(data []byte) error {
  type byteWithPtrMarshalJSON (line 314) | type byteWithPtrMarshalJSON
    method MarshalJSON (line 316) | func (b *byteWithPtrMarshalJSON) MarshalJSON() ([]byte, error) {
    method UnmarshalJSON (line 320) | func (b *byteWithPtrMarshalJSON) UnmarshalJSON(data []byte) error {
  type byteWithMarshalText (line 324) | type byteWithMarshalText
    method MarshalText (line 326) | func (b byteWithMarshalText) MarshalText() ([]byte, error) {
    method UnmarshalText (line 330) | func (b *byteWithMarshalText) UnmarshalText(data []byte) error {
  type byteWithPtrMarshalText (line 342) | type byteWithPtrMarshalText
    method MarshalText (line 344) | func (b *byteWithPtrMarshalText) MarshalText() ([]byte, error) {
    method UnmarshalText (line 348) | func (b *byteWithPtrMarshalText) UnmarshalText(data []byte) error {
  type intWithMarshalJSON (line 352) | type intWithMarshalJSON
    method MarshalJSON (line 354) | func (b intWithMarshalJSON) MarshalJSON() ([]byte, error) {
    method UnmarshalJSON (line 358) | func (b *intWithMarshalJSON) UnmarshalJSON(data []byte) error {
  type intWithPtrMarshalJSON (line 370) | type intWithPtrMarshalJSON
    method MarshalJSON (line 372) | func (b *intWithPtrMarshalJSON) MarshalJSON() ([]byte, error) {
    method UnmarshalJSON (line 376) | func (b *intWithPtrMarshalJSON) UnmarshalJSON(data []byte) error {
  type intWithMarshalText (line 380) | type intWithMarshalText
    method MarshalText (line 382) | func (b intWithMarshalText) MarshalText() ([]byte, error) {
    method UnmarshalText (line 386) | func (b *intWithMarshalText) UnmarshalText(data []byte) error {
  type intWithPtrMarshalText (line 398) | type intWithPtrMarshalText
    method MarshalText (line 400) | func (b *intWithPtrMarshalText) MarshalText() ([]byte, error) {
    method UnmarshalText (line 404) | func (b *intWithPtrMarshalText) UnmarshalText(data []byte) error {
  type mapStringToStringData (line 408) | type mapStringToStringData struct
  type unmarshalTest (line 412) | type unmarshalTest struct
  type B (line 423) | type B struct
  type DoublePtr (line 427) | type DoublePtr struct
  type JsonSyntaxError (line 432) | type JsonSyntaxError struct
    method err (line 437) | func (self *JsonSyntaxError) err() *json.SyntaxError {
  function trim (line 1040) | func trim(b []byte) []byte {
  function diff (line 1047) | func diff(t *testing.T, a, b []byte) {
  function TestMarshal (line 1060) | func TestMarshal(t *testing.T) {
  function TestMarshalNumberZeroVal (line 1082) | func TestMarshalNumberZeroVal(t *testing.T) {
  function TestMarshalEmbeds (line 1094) | func TestMarshalEmbeds(t *testing.T) {
  function TestUnmarshal (line 1136) | func TestUnmarshal(t *testing.T) {
  function initBig (line 1231) | func initBig() {
  function genValue (line 1243) | func genValue(n int) interface{} {
  function genString (line 1263) | func genString(stddev float64) string {
  function genArray (line 1276) | func genArray(n int) []interface{} {
  function genMap (line 1291) | func genMap(n int) map[string]interface{} {
  function TestUnmarshalMarshal (line 1304) | func TestUnmarshalMarshal(t *testing.T) {
  function TestNumberAccessors (line 1339) | func TestNumberAccessors(t *testing.T) {
  function TestLargeByteSlice (line 1358) | func TestLargeByteSlice(t *testing.T) {
  type Xint (line 1377) | type Xint struct
  function TestUnmarshalPtrPtr (line 1381) | func TestUnmarshalPtrPtr(t *testing.T) {
  function noSpace (line 1392) | func noSpace(c rune) rune {
  type All (line 1399) | type All struct
  type Small (line 1470) | type Small struct
  function TestRefUnmarshal (line 1721) | func TestRefUnmarshal(t *testing.T) {
  function TestEmptyString (line 1749) | func TestEmptyString(t *testing.T) {
  function TestNullString (line 1771) | func TestNullString(t *testing.T) {
  type NullTest (line 1791) | type NullTest struct
  function TestUnmarshalNulls (line 1828) | func TestUnmarshalNulls(t *testing.T) {
  type MustNotUnmarshalJSON (line 1951) | type MustNotUnmarshalJSON struct
    method UnmarshalJSON (line 1953) | func (x MustNotUnmarshalJSON) UnmarshalJSON(_ []byte) error {
  type MustNotUnmarshalText (line 1957) | type MustNotUnmarshalText struct
    method UnmarshalText (line 1959) | func (x MustNotUnmarshalText) UnmarshalText(_ []byte) error {
  function TestStringKind (line 1963) | func TestStringKind(t *testing.T) {
  function TestByteKind (line 1989) | func TestByteKind(t *testing.T) {
  function TestSliceOfCustomByte (line 2010) | func TestSliceOfCustomByte(t *testing.T) {
  function TestUnmarshalTypeError (line 2040) | func TestUnmarshalTypeError(t *testing.T) {
  function TestMismatchTypeError (line 2064) | func TestMismatchTypeError(t *testing.T) {
  function TestUnmarshalSyntax (line 2087) | func TestUnmarshalSyntax(t *testing.T) {
  type unexportedFields (line 2101) | type unexportedFields struct
  function TestUnmarshalUnexported (line 2109) | func TestUnmarshalUnexported(t *testing.T) {
  type Time3339 (line 2125) | type Time3339
    method UnmarshalJSON (line 2127) | func (t *Time3339) UnmarshalJSON(b []byte) error {
  function TestUnmarshalJSONLiteralError (line 2139) | func TestUnmarshalJSONLiteralError(t *testing.T) {
  function TestSkipArrayObjects (line 2153) | func TestSkipArrayObjects(t *testing.T) {
  function TestPrefilled (line 2166) | func TestPrefilled(t *testing.T) {
  function TestInvalidUnmarshal (line 2244) | func TestInvalidUnmarshal(t *testing.T) {
  function TestInvalidUnmarshalText (line 2268) | func TestInvalidUnmarshalText(t *testing.T) {
  function TestInvalidStringOption (line 2281) | func TestInvalidStringOption(t *testing.T) {
  function TestUnmarshalErrorAfterMultipleJSON (line 2302) | func TestUnmarshalErrorAfterMultipleJSON(t *testing.T) {
  type unmarshalPanic (line 2340) | type unmarshalPanic struct
    method UnmarshalJSON (line 2342) | func (unmarshalPanic) UnmarshalJSON([]byte) error { panic(0xdead) }
  function TestUnmarshalPanic (line 2344) | func TestUnmarshalPanic(t *testing.T) {
  function TestUnmarshalRecursivePointer (line 2356) | func TestUnmarshalRecursivePointer(t *testing.T) {
  type textUnmarshalerString (line 2366) | type textUnmarshalerString
    method UnmarshalText (line 2368) | func (m *textUnmarshalerString) UnmarshalText(text []byte) error {
  function TestUnmarshalMapWithTextUnmarshalerStringKey (line 2375) | func TestUnmarshalMapWithTextUnmarshalerStringKey(t *testing.T) {
  function TestUnmarshalRescanLiteralMangledUnquote (line 2386) | func TestUnmarshalRescanLiteralMangledUnquote(t *testing.T) {
  function TestUnmarshalMaxDepth (line 2431) | func TestUnmarshalMaxDepth(t *testing.T) {
  type ChargeToolPacingBucketItemTcc (line 2533) | type ChargeToolPacingBucketItemTcc struct
  type ChargeToolPacingParamsForDataRead (line 2538) | type ChargeToolPacingParamsForDataRead struct
  function TestChangeTool (line 2552) | func TestChangeTool(t *testing.T) {
  function TestDecoder_LongestInvalidUtf8 (line 2568) | func TestDecoder_LongestInvalidUtf8(t *testing.T) {
  function testDecodeInvalidUtf8 (line 2579) | func testDecodeInvalidUtf8(t *testing.T, data []byte) {
  function needEscape (line 2589) | func needEscape(b byte) bool {
  function genRandJsonBytes (line 2593) | func genRandJsonBytes(length int) []byte {
  function genRandJsonRune (line 2607) | func genRandJsonRune(length int) []byte {
  function TestDecoder_RandomInvalidUtf8 (line 2623) | func TestDecoder_RandomInvalidUtf8(t *testing.T) {
  type atofTest (line 2633) | type atofTest struct
  function TestDecodeFloat (line 2754) | func TestDecodeFloat(t *testing.T) {
  type useInt64Test (line 2769) | type useInt64Test struct
  type useFloatTest (line 2774) | type useFloatTest struct
  function TestUseInt64 (line 2801) | func TestUseInt64(t *testing.T) {
  function TestUseNumber (line 2830) | func TestUseNumber(t *testing.T) {
  function BenchmarkDecoderRawMessage (line 2858) | func BenchmarkDecoderRawMessage(b *testing.B) {
  function TestJsonNumber (line 3007) | func TestJsonNumber(t *testing.T) {

FILE: decoder/decoder_compat.go
  function init (line 35) | func init() {
  constant _F_use_int64 (line 40) | _F_use_int64       = consts.F_use_int64
  constant _F_disable_urc (line 41) | _F_disable_urc     = consts.F_disable_unknown
  constant _F_disable_unknown (line 42) | _F_disable_unknown = consts.F_disable_unknown
  constant _F_copy_string (line 43) | _F_copy_string     = consts.F_copy_string
  constant _F_use_number (line 45) | _F_use_number       = consts.F_use_number
  constant _F_validate_string (line 46) | _F_validate_string  = consts.F_validate_string
  constant _F_allow_control (line 47) | _F_allow_control    = consts.F_allow_control
  constant _F_no_validate_json (line 48) | _F_no_validate_json = consts.F_no_validate_json
  constant _F_case_sensitive (line 49) | _F_case_sensitive   = consts.F_case_sensitive
  type Options (line 52) | type Options
  constant OptionUseInt64 (line 55) | OptionUseInt64         Options = 1 << _F_use_int64
  constant OptionUseNumber (line 56) | OptionUseNumber        Options = 1 << _F_use_number
  constant OptionUseUnicodeErrors (line 57) | OptionUseUnicodeErrors Options = 1 << _F_disable_urc
  constant OptionDisableUnknown (line 58) | OptionDisableUnknown   Options = 1 << _F_disable_unknown
  constant OptionCopyString (line 59) | OptionCopyString       Options = 1 << _F_copy_string
  constant OptionValidateString (line 60) | OptionValidateString   Options = 1 << _F_validate_string
  constant OptionNoValidateJSON (line 61) | OptionNoValidateJSON   Options = 1 << _F_no_validate_json
  constant OptionCaseSensitive (line 62) | OptionCaseSensitive    Options = 1 << _F_case_sensitive
  type Decoder (line 73) | type Decoder struct
    method SetOptions (line 65) | func (self *Decoder) SetOptions(opts Options) {
    method Pos (line 85) | func (self *Decoder) Pos() int {
    method Reset (line 89) | func (self *Decoder) Reset(s string) {
    method CheckTrailings (line 96) | func (self *Decoder) CheckTrailings() error {
    method Decode (line 117) | func (self *Decoder) Decode(val interface{}) error {
    method UseInt64 (line 131) | func (self *Decoder) UseInt64() {
    method UseNumber (line 138) | func (self *Decoder) UseNumber() {
    method UseUnicodeErrors (line 145) | func (self *Decoder) UseUnicodeErrors() {
    method DisallowUnknownFields (line 152) | func (self *Decoder) DisallowUnknownFields() {
    method CopyString (line 157) | func (self *Decoder) CopyString() {
    method ValidateString (line 164) | func (self *Decoder) ValidateString() {
  function NewDecoder (line 80) | func NewDecoder(s string) *Decoder {
  function Pretouch (line 173) | func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
  function NewStreamDecoder (line 182) | func NewStreamDecoder(r io.Reader) *StreamDecoder {
  type SyntaxError (line 187) | type SyntaxError
    method Description (line 190) | func (s SyntaxError) Description() string {
    method Error (line 195) | func (s SyntaxError) Error() string {
  type MismatchTypeError (line 200) | type MismatchTypeError

FILE: decoder/decoder_native.go
  constant OptionUseInt64 (line 39) | OptionUseInt64         Options = api.OptionUseInt64
  constant OptionUseNumber (line 40) | OptionUseNumber        Options = api.OptionUseNumber
  constant OptionUseUnicodeErrors (line 41) | OptionUseUnicodeErrors Options = api.OptionUseUnicodeErrors
  constant OptionDisableUnknown (line 42) | OptionDisableUnknown   Options = api.OptionDisableUnknown
  constant OptionCopyString (line 43) | OptionCopyString       Options = api.OptionCopyString
  constant OptionValidateString (line 44) | OptionValidateString   Options = api.OptionValidateString
  constant OptionNoValidateJSON (line 45) | OptionNoValidateJSON   Options = api.OptionNoValidateJSON
  constant OptionCaseSensitive (line 46) | OptionCaseSensitive    Options = api.OptionCaseSensitive

FILE: decoder/decoder_native_test.go
  function TestDecoder_OptionCaseSensitive (line 36) | func TestDecoder_OptionCaseSensitive(t *testing.T) {
  function TestDecoder_MapWithIndirectElement (line 51) | func TestDecoder_MapWithIndirectElement(t *testing.T) {
  function TestDecoder_OptionCaseSensitiveForManyKeys (line 58) | func TestDecoder_OptionCaseSensitiveForManyKeys(t *testing.T) {
  function BenchmarkSkipValidate (line 96) | func BenchmarkSkipValidate(b *testing.B) {
  function TestSkipMismatchTypeAmd64Error (line 165) | func TestSkipMismatchTypeAmd64Error(t *testing.T) {
  function TestCopyString (line 273) | func TestCopyString(t *testing.T) {
  function TestDecoder_SetOption (line 391) | func TestDecoder_SetOption(t *testing.T) {
  function BenchmarkSkip_Sonic (line 400) | func BenchmarkSkip_Sonic(b *testing.B) {

FILE: decoder/decoder_test.go
  function TestMain (line 31) | func TestMain(m *testing.M) {
  function TestGC (line 47) | func TestGC(t *testing.T) {
  function init (line 83) | func init() {
  function TestSkipMismatchTypeError (line 87) | func TestSkipMismatchTypeError(t *testing.T) {
  function TestDecodeCorrupt (line 189) | func TestDecodeCorrupt(t *testing.T) {
  function TestDecodeOption (line 222) | func TestDecodeOption(t *testing.T) {
  function decode (line 252) | func decode(s string, v interface{}, copy bool) (int, error) {
  function TestDecoder_Basic (line 264) | func TestDecoder_Basic(t *testing.T) {
  function TestDecoder_Generic (line 272) | func TestDecoder_Generic(t *testing.T) {
  function TestDecoder_Binding (line 279) | func TestDecoder_Binding(t *testing.T) {
  function BenchmarkDecoder_Generic_Sonic (line 287) | func BenchmarkDecoder_Generic_Sonic(b *testing.B) {
  function BenchmarkDecoder_Generic_Sonic_Fast (line 298) | func BenchmarkDecoder_Generic_Sonic_Fast(b *testing.B) {
  function BenchmarkDecoder_Generic_StdLib (line 309) | func BenchmarkDecoder_Generic_StdLib(b *testing.B) {
  function BenchmarkDecoder_Binding_Sonic (line 321) | func BenchmarkDecoder_Binding_Sonic(b *testing.B) {
  function BenchmarkDecoder_Binding_Sonic_Fast (line 332) | func BenchmarkDecoder_Binding_Sonic_Fast(b *testing.B) {
  function BenchmarkDecoder_Binding_StdLib (line 343) | func BenchmarkDecoder_Binding_StdLib(b *testing.B) {
  function BenchmarkDecoder_Parallel_Generic_Sonic (line 355) | func BenchmarkDecoder_Parallel_Generic_Sonic(b *testing.B) {
  function BenchmarkDecoder_Parallel_Generic_Sonic_Fast (line 368) | func BenchmarkDecoder_Parallel_Generic_Sonic_Fast(b *testing.B) {
  function BenchmarkDecoder_Parallel_Generic_StdLib (line 381) | func BenchmarkDecoder_Parallel_Generic_StdLib(b *testing.B) {
  function BenchmarkDecoder_Parallel_Binding_Sonic (line 395) | func BenchmarkDecoder_Parallel_Binding_Sonic(b *testing.B) {
  function BenchmarkDecoder_Parallel_Binding_Sonic_Fast (line 408) | func BenchmarkDecoder_Parallel_Binding_Sonic_Fast(b *testing.B) {
  function BenchmarkDecoder_Parallel_Binding_StdLib (line 421) | func BenchmarkDecoder_Parallel_Binding_StdLib(b *testing.B) {

FILE: decoder/testdata_test.go
  constant TwitterJson (line 28) | TwitterJson = `{
  type TwitterStruct (line 444) | type TwitterStruct struct
  type Hashtags (line 449) | type Hashtags struct
  type Entities (line 454) | type Entities struct
  type Metadata (line 460) | type Metadata struct
  type Urls (line 465) | type Urls struct
  type URL (line 471) | type URL struct
  type Description (line 475) | type Description struct
  type UserEntities (line 479) | type UserEntities struct
  type User (line 484) | type User struct
  type Statuses (line 526) | type Statuses struct
  type SearchMetadata (line 550) | type SearchMetadata struct

FILE: encode_test.go
  function TestMain (line 48) | func TestMain(m *testing.M) {
  type Optionals (line 63) | type Optionals struct
  function TestOmitEmpty (line 102) | func TestOmitEmpty(t *testing.T) {
  type StringTag (line 117) | type StringTag struct
  function TestRoundtripStringTag (line 125) | func TestRoundtripStringTag(t *testing.T) {
  type renamedByte (line 189) | type renamedByte
  type renamedByteSlice (line 190) | type renamedByteSlice
  type renamedRenamedByteSlice (line 191) | type renamedRenamedByteSlice
  function TestEncodeRenamedByteSlice (line 193) | func TestEncodeRenamedByteSlice(t *testing.T) {
  type SamePointerNoCycle (line 213) | type SamePointerNoCycle struct
  type PointerCycle (line 219) | type PointerCycle struct
  type PointerCycleIndirect (line 225) | type PointerCycleIndirect struct
  type RecursiveSlice (line 229) | type RecursiveSlice
  function init (line 239) | func init() {
  function TestSamePointerNoCycle (line 256) | func TestSamePointerNoCycle(t *testing.T) {
  function TestSliceNoCycle (line 262) | func TestSliceNoCycle(t *testing.T) {
  function TestUnsupportedValues (line 279) | func TestUnsupportedValues(t *testing.T) {
  type Ref (line 292) | type Ref
    method MarshalJSON (line 294) | func (*Ref) MarshalJSON() ([]byte, error) {
    method UnmarshalJSON (line 298) | func (r *Ref) UnmarshalJSON([]byte) error {
  type Val (line 304) | type Val
    method MarshalJSON (line 306) | func (Val) MarshalJSON() ([]byte, error) {
  type RefText (line 311) | type RefText
    method MarshalText (line 313) | func (*RefText) MarshalText() ([]byte, error) {
    method UnmarshalText (line 317) | func (r *RefText) UnmarshalText([]byte) error {
  type ValText (line 323) | type ValText
    method MarshalText (line 325) | func (ValText) MarshalText() ([]byte, error) {
  function TestRefValMarshal (line 329) | func TestRefValMarshal(t *testing.T) {
  function TestAnonymousFields (line 400) | func TestAnonymousFields(t *testing.T) {
  type BugA (line 577) | type BugA struct
  type BugB (line 581) | type BugB struct
  type BugC (line 586) | type BugC struct
  type BugX (line 591) | type BugX struct
  type nilJSONMarshaler (line 600) | type nilJSONMarshaler
    method MarshalJSON (line 602) | func (nm *nilJSONMarshaler) MarshalJSON() ([]byte, error) {
  type nilTextMarshaler (line 612) | type nilTextMarshaler
    method MarshalText (line 614) | func (nm *nilTextMarshaler) MarshalText() ([]byte, error) {
  function TestNilMarshal (line 622) | func TestNilMarshal(t *testing.T) {
  function TestEmbeddedBug (line 652) | func TestEmbeddedBug(t *testing.T) {
  type BugD (line 681) | type BugD struct
  type BugY (line 686) | type BugY struct
  function TestTaggedFieldDominates (line 692) | func TestTaggedFieldDominates(t *testing.T) {
  type BugZ (line 709) | type BugZ struct
  function TestDuplicatedFieldDisappears (line 715) | func TestDuplicatedFieldDisappears(t *testing.T) {
  function TestStdLibIssue10281 (line 735) | func TestStdLibIssue10281(t *testing.T) {
  function TestEncodePointerString (line 748) | func TestEncodePointerString(t *testing.T) {
  function TestEncodeString (line 811) | func TestEncodeString(t *testing.T) {
  type jsonbyte (line 825) | type jsonbyte
    method MarshalJSON (line 827) | func (b jsonbyte) MarshalJSON() ([]byte, error) { return tenc(`{"JB":%...
  type textbyte (line 829) | type textbyte
    method MarshalText (line 831) | func (b textbyte) MarshalText() ([]byte, error) { return tenc(`TB:%d`,...
  type jsonint (line 833) | type jsonint
    method MarshalJSON (line 835) | func (i jsonint) MarshalJSON() ([]byte, error) { return tenc(`{"JI":%d...
  type textint (line 837) | type textint
    method MarshalText (line 839) | func (i textint) MarshalText() ([]byte, error) { return tenc(`TI:%d`, ...
  function tenc (line 841) | func tenc(format string, a ...interface{}) ([]byte, error) {
  function TestEncodeBytekind (line 848) | func TestEncodeBytekind(t *testing.T) {
  function TestNilMarshalerTextMapKey (line 880) | func TestNilMarshalerTextMapKey(t *testing.T) {
  function TestMarshalFloat (line 913) | func TestMarshalFloat(t *testing.T) {
  function TestMarshalRawMessageValue (line 992) | func TestMarshalRawMessageValue(t *testing.T) {
  type marshalPanic (line 1093) | type marshalPanic struct
    method MarshalJSON (line 1095) | func (marshalPanic) MarshalJSON() ([]byte, error) { panic(0xdead) }
  function TestMarshalPanic (line 1097) | func TestMarshalPanic(t *testing.T) {
  function TestMarshalUncommonFieldNames (line 1108) | func TestMarshalUncommonFieldNames(t *testing.T) {
  type DummyMarshalerError (line 1123) | type DummyMarshalerError struct
    method err (line 1129) | func (self *DummyMarshalerError) err() *json.MarshalerError {
  function TestMarshalerError (line 1133) | func TestMarshalerError(t *testing.T) {
  function TestMarshalNullNil (line 1160) | func TestMarshalNullNil(t *testing.T) {
  function TestEncoder_LongestInvalidUtf8 (line 1175) | func TestEncoder_LongestInvalidUtf8(t *testing.T) {
  function testEncodeInvalidUtf8 (line 1186) | func testEncodeInvalidUtf8(t *testing.T, data []byte) {
  function TestEncoder_RandomInvalidUtf8 (line 1195) | func TestEncoder_RandomInvalidUtf8(t *testing.T) {
  function TestMarshalInfOrNan (line 1204) | func TestMarshalInfOrNan(t *testing.T) {

FILE: encoder/encoder_compat.go
  function init (line 32) | func init() {
  constant EnableFallback (line 37) | EnableFallback = true
  type Options (line 40) | type Options
  constant bitSortMapKeys (line 43) | bitSortMapKeys = iota
  constant bitEscapeHTML (line 44) | bitEscapeHTML
  constant bitCompactMarshaler (line 45) | bitCompactMarshaler
  constant bitNoQuoteTextMarshaler (line 46) | bitNoQuoteTextMarshaler
  constant bitNoNullSliceOrMap (line 47) | bitNoNullSliceOrMap
  constant bitValidateString (line 48) | bitValidateString
  constant bitNoValidateJSONMarshaler (line 49) | bitNoValidateJSONMarshaler
  constant bitNoEncoderNewline (line 50) | bitNoEncoderNewline
  constant bitPointerValue (line 53) | bitPointerValue = 63
  constant SortMapKeys (line 60) | SortMapKeys Options = 1 << bitSortMapKeys
  constant EscapeHTML (line 65) | EscapeHTML Options = 1 << bitEscapeHTML
  constant CompactMarshaler (line 69) | CompactMarshaler Options = 1 << bitCompactMarshaler
  constant NoQuoteTextMarshaler (line 73) | NoQuoteTextMarshaler Options = 1 << bitNoQuoteTextMarshaler
  constant NoNullSliceOrMap (line 77) | NoNullSliceOrMap Options = 1 << bitNoNullSliceOrMap
  constant ValidateString (line 81) | ValidateString Options = 1 << bitValidateString
  constant NoValidateJSONMarshaler (line 85) | NoValidateJSONMarshaler Options = 1 << bitNoValidateJSONMarshaler
  constant NoEncoderNewline (line 88) | NoEncoderNewline Options = 1 << bitNoEncoderNewline
  constant CompatibleWithStd (line 91) | CompatibleWithStd Options = SortMapKeys | EscapeHTML | CompactMarshaler
  type Encoder (line 95) | type Encoder struct
    method Encode (line 102) | func (self *Encoder) Encode(v interface{}) ([]byte, error) {
    method SortKeys (line 110) | func (self *Encoder) SortKeys() *Encoder {
    method SetEscapeHTML (line 116) | func (self *Encoder) SetEscapeHTML(f bool) {
    method SetValidateString (line 125) | func (self *Encoder) SetValidateString(f bool) {
    method SetNoValidateJSONMarshaler (line 134) | func (self *Encoder) SetNoValidateJSONMarshaler(f bool) {
    method SetNoEncoderNewline (line 143) | func (self *Encoder) SetNoEncoderNewline(f bool) {
    method SetCompactMarshaler (line 152) | func (self *Encoder) SetCompactMarshaler(f bool) {
    method SetNoQuoteTextMarshaler (line 161) | func (self *Encoder) SetNoQuoteTextMarshaler(f bool) {
    method SetIndent (line 172) | func (enc *Encoder) SetIndent(prefix, indent string) {
  function Quote (line 178) | func Quote(s string) string {
  function Encode (line 189) | func Encode(val interface{}, opts Options) ([]byte, error) {
  function EncodeInto (line 195) | func EncodeInto(buf *[]byte, val interface{}, opts Options) error {
  function HTMLEscape (line 217) | func HTMLEscape(dst []byte, src []byte) []byte {
  function EncodeIndented (line 226) | func EncodeIndented(val interface{}, prefix string, indent string, opts ...
  function Pretouch (line 241) | func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
  function Valid (line 250) | func Valid(data []byte) (ok bool, start int) {
  function NewStreamEncoder (line 260) | func NewStreamEncoder(w io.Writer) *StreamEncoder {

FILE: encoder/encoder_native.go
  constant EnableFallback (line 27) | EnableFallback = false
  constant SortMapKeys (line 42) | SortMapKeys Options = encoder.SortMapKeys
  constant EscapeHTML (line 47) | EscapeHTML Options = encoder.EscapeHTML
  constant CompactMarshaler (line 51) | CompactMarshaler Options = encoder.CompactMarshaler
  constant NoQuoteTextMarshaler (line 55) | NoQuoteTextMarshaler Options = encoder.NoQuoteTextMarshaler
  constant NoNullSliceOrMap (line 59) | NoNullSliceOrMap Options = encoder.NoNullSliceOrMap
  constant ValidateString (line 63) | ValidateString Options = encoder.ValidateString
  constant NoValidateJSONMarshaler (line 67) | NoValidateJSONMarshaler Options = encoder.NoValidateJSONMarshaler
  constant NoEncoderNewline (line 70) | NoEncoderNewline Options = encoder.NoEncoderNewline
  constant CompatibleWithStd (line 73) | CompatibleWithStd Options = encoder.CompatibleWithStd
  constant EncodeNullForInfOrNan (line 77) | EncodeNullForInfOrNan Options = encoder.EncodeNullForInfOrNan

FILE: encoder/encoder_native_test.go
  function TestEncOnlyOmitNilPtr (line 31) | func TestEncOnlyOmitNilPtr(t *testing.T) {
  function TestOptionSliceOrMapNoNull (line 78) | func TestOptionSliceOrMapNoNull(t *testing.T) {
  function TestEncoder_Marshaler (line 94) | func TestEncoder_Marshaler(t *testing.T) {
  function TestMarshalerError (line 111) | func TestMarshalerError(t *testing.T) {
  function TestEncoder_RawMessage (line 118) | func TestEncoder_RawMessage(t *testing.T) {
  function TestEncoder_TextMarshaler (line 131) | func TestEncoder_TextMarshaler(t *testing.T) {
  function TestEncoder_Marshal_EscapeHTML (line 148) | func TestEncoder_Marshal_EscapeHTML(t *testing.T) {

FILE: encoder/encoder_test.go
  function TestMain (line 33) | func TestMain(m *testing.M) {
  type sample (line 49) | type sample struct
  function BenchmarkOptionSliceOrMapNoNull (line 58) | func BenchmarkOptionSliceOrMapNoNull(b *testing.B) {
  function runEncoderTest (line 83) | func runEncoderTest(t *testing.T, fn func(string) string, exp string, ar...
  function TestEncoder_String (line 87) | func TestEncoder_String(t *testing.T) {
  type StringStruct (line 98) | type StringStruct struct
  function TestEncoder_FieldStringize (line 105) | func TestEncoder_FieldStringize(t *testing.T) {
  function TestEncodeErrorAndScratchBuf (line 113) | func TestEncodeErrorAndScratchBuf(t *testing.T) {
  type MarshalerImpl (line 124) | type MarshalerImpl struct
    method MarshalJSON (line 128) | func (self *MarshalerImpl) MarshalJSON() ([]byte, error) {
  type MarshalerStruct (line 133) | type MarshalerStruct struct
  type MarshalerErrorStruct (line 137) | type MarshalerErrorStruct struct
    method MarshalJSON (line 141) | func (self *MarshalerErrorStruct) MarshalJSON() ([]byte, error) {
  type RawMessageStruct (line 145) | type RawMessageStruct struct
  type TextMarshalerImpl (line 149) | type TextMarshalerImpl struct
    method MarshalText (line 153) | func (self *TextMarshalerImpl) MarshalText() ([]byte, error) {
  type TextMarshalerImplV (line 157) | type TextMarshalerImplV struct
    method MarshalText (line 161) | func (self TextMarshalerImplV) MarshalText() ([]byte, error) {
  type TextMarshalerStruct (line 165) | type TextMarshalerStruct struct
  function TestTextMarshalTextKey_SortKeys (line 169) | func TestTextMarshalTextKey_SortKeys(t *testing.T) {
  function TestEncoder_EscapeHTML (line 198) | func TestEncoder_EscapeHTML(t *testing.T) {
  function TestEncoder_Marshal_EscapeHTML_LargeJson (line 213) | func TestEncoder_Marshal_EscapeHTML_LargeJson(t *testing.T) {
  function init (line 224) | func init() {
  function TestEncoder_Generic (line 229) | func TestEncoder_Generic(t *testing.T) {
  function TestEncoder_Binding (line 235) | func TestEncoder_Binding(t *testing.T) {
  function TestEncoder_MapSortKey (line 241) | func TestEncoder_MapSortKey(t *testing.T) {
  function BenchmarkEncoder_Generic_Sonic (line 255) | func BenchmarkEncoder_Generic_Sonic(b *testing.B) {
  function BenchmarkEncoder_Generic_Sonic_Fast (line 264) | func BenchmarkEncoder_Generic_Sonic_Fast(b *testing.B) {
  function BenchmarkEncoder_Generic_StdLib (line 273) | func BenchmarkEncoder_Generic_StdLib(b *testing.B) {
  function BenchmarkEncoder_Binding_Sonic (line 282) | func BenchmarkEncoder_Binding_Sonic(b *testing.B) {
  function BenchmarkEncoder_Binding_Sonic_Fast (line 291) | func BenchmarkEncoder_Binding_Sonic_Fast(b *testing.B) {
  function BenchmarkEncoder_Binding_StdLib (line 300) | func BenchmarkEncoder_Binding_StdLib(b *testing.B) {
  function BenchmarkEncoder_Parallel_Generic_Sonic (line 309) | func BenchmarkEncoder_Parallel_Generic_Sonic(b *testing.B) {
  function BenchmarkEncoder_Parallel_Generic_Sonic_Fast (line 320) | func BenchmarkEncoder_Parallel_Generic_Sonic_Fast(b *testing.B) {
  function BenchmarkEncoder_Parallel_Generic_StdLib (line 331) | func BenchmarkEncoder_Parallel_Generic_StdLib(b *testing.B) {
  function BenchmarkEncoder_Parallel_Binding_Sonic (line 342) | func BenchmarkEncoder_Parallel_Binding_Sonic(b *testing.B) {
  function BenchmarkEncoder_Parallel_Binding_Sonic_Fast (line 353) | func BenchmarkEncoder_Parallel_Binding_Sonic_Fast(b *testing.B) {
  function BenchmarkEncoder_Parallel_Binding_StdLib (line 364) | func BenchmarkEncoder_Parallel_Binding_StdLib(b *testing.B) {
  function BenchmarkHTMLEscape_Sonic (line 375) | func BenchmarkHTMLEscape_Sonic(b *testing.B) {
  function BenchmarkHTMLEscape_StdLib (line 386) | func BenchmarkHTMLEscape_StdLib(b *testing.B) {
  function BenchmarkValidate_Sonic (line 399) | func BenchmarkValidate_Sonic(b *testing.B) {
  function BenchmarkValidate_Std (line 412) | func BenchmarkValidate_Std(b *testing.B) {
  function BenchmarkCompact_Std (line 424) | func BenchmarkCompact_Std(b *testing.B) {
  type f64Bench (line 438) | type f64Bench struct
  function BenchmarkEncode_Float64 (line 443) | func BenchmarkEncode_Float64(b *testing.B) {
  type f32Bench (line 488) | type f32Bench struct
  function BenchmarkEncode_Float32 (line 493) | func BenchmarkEncode_Float32(b *testing.B) {

FILE: encoder/testdata_test.go
  constant TwitterJson (line 28) | TwitterJson = `{
  type TwitterStruct (line 444) | type TwitterStruct struct
  type Hashtags (line 449) | type Hashtags struct
  type Entities (line 454) | type Entities struct
  type Metadata (line 460) | type Metadata struct
  type Urls (line 465) | type Urls struct
  type URL (line 471) | type URL struct
  type Description (line 475) | type Description struct
  type UserEntities (line 479) | type UserEntities struct
  type User (line 484) | type User struct
  type Statuses (line 526) | type Statuses struct
  type SearchMetadata (line 550) | type SearchMetadata struct

FILE: examples/example_stream_test.go
  function ExampleStreamDecoder (line 13) | func ExampleStreamDecoder() {
  function ExampleStreamEncoder (line 26) | func ExampleStreamEncoder() {

FILE: external_jsonlib_test/benchmark_test/ast_set_benchmark_test.go
  function BenchmarkBuildObject_SonicAST_Original (line 11) | func BenchmarkBuildObject_SonicAST_Original(b *testing.B) {
  function BenchmarkBuildObject_Simplejson (line 22) | func BenchmarkBuildObject_Simplejson(b *testing.B) {

FILE: external_jsonlib_test/benchmark_test/decoder_stream_test.go
  type HaltReader (line 33) | type HaltReader struct
    method Read (line 47) | func (self *HaltReader) Read(p []byte) (int, error) {
    method Reset (line 67) | func (self *HaltReader) Reset(buf string) {
  function NewHaltReader (line 39) | func NewHaltReader(buf string, halts map[int]bool) *HaltReader {
  function BenchmarkDecodeStream_Jsoniter (line 79) | func BenchmarkDecodeStream_Jsoniter(b *testing.B) {

FILE: external_jsonlib_test/benchmark_test/decoder_test.go
  function init (line 27) | func init() {
  function BenchmarkDecoder_Generic_StdLib (line 31) | func BenchmarkDecoder_Generic_StdLib(b *testing.B) {
  function BenchmarkDecoder_Generic_JsonIter (line 43) | func BenchmarkDecoder_Generic_JsonIter(b *testing.B) {
  function BenchmarkDecoder_Generic_GoJson (line 55) | func BenchmarkDecoder_Generic_GoJson(b *testing.B) {
  function BenchmarkDecoder_Binding_StdLib (line 67) | func BenchmarkDecoder_Binding_StdLib(b *testing.B) {
  function BenchmarkDecoder_Binding_JsonIter (line 79) | func BenchmarkDecoder_Binding_JsonIter(b *testing.B) {
  function BenchmarkDecoder_Binding_GoJson (line 91) | func BenchmarkDecoder_Binding_GoJson(b *testing.B) {
  function BenchmarkDecoder_Parallel_Generic_StdLib (line 103) | func BenchmarkDecoder_Parallel_Generic_StdLib(b *testing.B) {
  function BenchmarkDecoder_Parallel_Generic_JsonIter (line 117) | func BenchmarkDecoder_Parallel_Generic_JsonIter(b *testing.B) {
  function BenchmarkDecoder_Parallel_Generic_GoJson (line 131) | func BenchmarkDecoder_Parallel_Generic_GoJson(b *testing.B) {
  function BenchmarkDecoder_Parallel_Binding_StdLib (line 145) | func BenchmarkDecoder_Parallel_Binding_StdLib(b *testing.B) {
  function BenchmarkDecoder_Parallel_Binding_JsonIter (line 159) | func BenchmarkDecoder_Parallel_Binding_JsonIter(b *testing.B) {
  function BenchmarkDecoder_Parallel_Binding_GoJson (line 173) | func BenchmarkDecoder_Parallel_Binding_GoJson(b *testing.B) {

FILE: external_jsonlib_test/benchmark_test/encoder_stream_test.go
  function BenchmarkEncodeStream_Jsoniter (line 28) | func BenchmarkEncodeStream_Jsoniter(b *testing.B) {

FILE: external_jsonlib_test/benchmark_test/encoder_test.go
  function TestMain (line 36) | func TestMain(m *testing.M) {
  function init (line 55) | func init() {
  function BenchmarkEncoder_Generic_JsonIter (line 60) | func BenchmarkEncoder_Generic_JsonIter(b *testing.B) {
  function BenchmarkEncoder_Generic_GoJson (line 69) | func BenchmarkEncoder_Generic_GoJson(b *testing.B) {
  function BenchmarkEncoder_Binding_JsonIter (line 78) | func BenchmarkEncoder_Binding_JsonIter(b *testing.B) {
  function BenchmarkEncoder_Binding_GoJson (line 87) | func BenchmarkEncoder_Binding_GoJson(b *testing.B) {
  function BenchmarkEncoder_Parallel_Generic_JsonIter (line 96) | func BenchmarkEncoder_Parallel_Generic_JsonIter(b *testing.B) {
  function BenchmarkEncoder_Parallel_Generic_GoJson (line 107) | func BenchmarkEncoder_Parallel_Generic_GoJson(b *testing.B) {
  function BenchmarkEncoder_Parallel_Binding_JsonIter (line 118) | func BenchmarkEncoder_Parallel_Binding_JsonIter(b *testing.B) {
  function BenchmarkEncoder_Parallel_Binding_GoJson (line 129) | func BenchmarkEncoder_Parallel_Binding_GoJson(b *testing.B) {

FILE: external_jsonlib_test/benchmark_test/msgpack_test.go
  function init (line 36) | func init() {
  function BenchmarkWithMsgPackDecode_Generic_Sonic_JSON (line 54) | func BenchmarkWithMsgPackDecode_Generic_Sonic_JSON(b *testing.B) {
  function BenchmarkWithMsgPackDecode_Generic_Msgpack (line 64) | func BenchmarkWithMsgPackDecode_Generic_Msgpack(b *testing.B) {
  function BenchmarkWithMsgPackDecode_Binding_Sonic_JSON (line 74) | func BenchmarkWithMsgPackDecode_Binding_Sonic_JSON(b *testing.B) {
  function BenchmarkWithMsgPackDecode_Binding_Msgpack (line 84) | func BenchmarkWithMsgPackDecode_Binding_Msgpack(b *testing.B) {
  function BenchmarkWithMsgPackEncode_Generic_Sonic_JSON (line 94) | func BenchmarkWithMsgPackEncode_Generic_Sonic_JSON(b *testing.B) {
  function BenchmarkWithMsgPackEncode_Generic_Msgpack (line 106) | func BenchmarkWithMsgPackEncode_Generic_Msgpack(b *testing.B) {
  function BenchmarkWithMsgPackEncode_Binding_Sonic_JSON (line 118) | func BenchmarkWithMsgPackEncode_Binding_Sonic_JSON(b *testing.B) {
  function BenchmarkWithMsgPackEncode_Binding_Msgpack (line 130) | func BenchmarkWithMsgPackEncode_Binding_Msgpack(b *testing.B) {
  function TestMsgpackDecodeMatchesSonicGeneric (line 142) | func TestMsgpackDecodeMatchesSonicGeneric(t *testing.T) {
  function TestMsgpackDecodeMatchesSonicBinding (line 152) | func TestMsgpackDecodeMatchesSonicBinding(t *testing.T) {
  function TestMsgpackEncodeMatchesSonicGeneric (line 162) | func TestMsgpackEncodeMatchesSonicGeneric(t *testing.T) {
  function TestMsgpackEncodeMatchesSonicBinding (line 178) | func TestMsgpackEncodeMatchesSonicBinding(t *testing.T) {

FILE: external_jsonlib_test/benchmark_test/parser_test.go
  function BenchmarkParser_Gjson (line 28) | func BenchmarkParser_Gjson(b *testing.B) {
  function BenchmarkParser_Jsoniter (line 49) | func BenchmarkParser_Jsoniter(b *testing.B) {
  function BenchmarkParser_Parallel_Gjson (line 61) | func BenchmarkParser_Parallel_Gjson(b *testing.B) {
  function BenchmarkParser_Parallel_Jsoniter (line 83) | func BenchmarkParser_Parallel_Jsoniter(b *testing.B) {
  function BenchmarkParseOne_Gjson (line 95) | func BenchmarkParseOne_Gjson(b *testing.B) {
  function BenchmarkParseOne_Jsoniter (line 111) | func BenchmarkParseOne_Jsoniter(b *testing.B) {
  function BenchmarkParseOne_Parallel_Gjson (line 126) | func BenchmarkParseOne_Parallel_Gjson(b *testing.B) {
  function BenchmarkParseOne_Parallel_Jsoniter (line 144) | func BenchmarkParseOne_Parallel_Jsoniter(b *testing.B) {
  function BenchmarkParseSeven_Gjson (line 162) | func BenchmarkParseSeven_Gjson(b *testing.B) {
  function BenchmarkParseSeven_Jsoniter (line 180) | func BenchmarkParseSeven_Jsoniter(b *testing.B) {
  function BenchmarkParseSeven_Parallel_Gjson (line 199) | func BenchmarkParseSeven_Parallel_Gjson(b *testing.B) {
  function BenchmarkParseSeven_Parallel_Jsoniter (line 219) | func BenchmarkParseSeven_Parallel_Jsoniter(b *testing.B) {
  function BenchmarkParseSeven_Sonic (line 241) | func BenchmarkParseSeven_Sonic(b *testing.B) {
  function BenchmarkParseSeven_Parallel_Sonic (line 259) | func BenchmarkParseSeven_Parallel_Sonic(b *testing.B) {
  function BenchmarkParseOne_Fastjson (line 279) | func BenchmarkParseOne_Fastjson(b *testing.B) {
  function BenchmarkParseOne_Parallel_Fastjson (line 301) | func BenchmarkParseOne_Parallel_Fastjson(b *testing.B) {
  function BenchmarkParseSeven_Fastjson (line 314) | func BenchmarkParseSeven_Fastjson(b *testing.B) {
  function BenchmarkParseSeven_Parallel_Fastjson (line 354) | func BenchmarkParseSeven_Parallel_Fastjson(b *testing.B) {

FILE: external_jsonlib_test/benchmark_test/search_test.go
  constant expectedID (line 34) | expectedID = 249279667666817024
  constant expectMetaCount (line 35) | expectMetaCount = 4
  function BenchmarkGetOne_Gjson (line 38) | func BenchmarkGetOne_Gjson(b *testing.B) {
  function BenchmarkGetOne_Jsoniter (line 49) | func BenchmarkGetOne_Jsoniter(b *testing.B) {
  function BenchmarkGetOne_Sonic (line 61) | func BenchmarkGetOne_Sonic(b *testing.B) {
  function BenchmarkGetOne_Parallel_Sonic (line 77) | func BenchmarkGetOne_Parallel_Sonic(b *testing.B) {
  function BenchmarkGetOne_Parallel_Gjson (line 94) | func BenchmarkGetOne_Parallel_Gjson(b *testing.B) {
  function BenchmarkGetOne_Parallel_Jsoniter (line 107) | func BenchmarkGetOne_Parallel_Jsoniter(b *testing.B) {
  function BenchmarkSetOne_Sjson (line 121) | func BenchmarkSetOne_Sjson(b *testing.B) {
  function BenchmarkSetOne_Jsoniter (line 135) | func BenchmarkSetOne_Jsoniter(b *testing.B) {
  function BenchmarkSetOne_Parallel_Sjson (line 151) | func BenchmarkSetOne_Parallel_Sjson(b *testing.B) {
  function BenchmarkSetOne_Parallel_Jsoniter (line 167) | func BenchmarkSetOne_Parallel_Jsoniter(b *testing.B) {
  function BenchmarkGetByKeys_Sonic (line 186) | func BenchmarkGetByKeys_Sonic(b *testing.B) {
  function BenchmarkGetByKeys_JsonParser (line 202) | func BenchmarkGetByKeys_JsonParser(b *testing.B) {
  function BenchmarkGetOne_Fastjson (line 216) | func BenchmarkGetOne_Fastjson(b *testing.B) {
  function BenchmarkGetOne_Parallel_Fastjson (line 240) | func BenchmarkGetOne_Parallel_Fastjson(b *testing.B) {

FILE: external_jsonlib_test/benchmark_test/testdata_test.go
  constant TwitterJson (line 19) | TwitterJson = `{
  type TwitterStruct (line 435) | type TwitterStruct struct
  type Hashtags (line 440) | type Hashtags struct
  type Entities (line 445) | type Entities struct
  type Metadata (line 451) | type Metadata struct
  type Urls (line 456) | type Urls struct
  type URL (line 462) | type URL struct
  type Description (line 466) | type Description struct
  type UserEntities (line 470) | type UserEntities struct
  type User (line 475) | type User struct
  type Statuses (line 517) | type Statuses struct
  type SearchMetadata (line 541) | type SearchMetadata struct

FILE: external_jsonlib_test/unit_test/api_test.go
  function TestMain (line 38) | func TestMain(m *testing.M) {
  function TestCompatMarshalDefault (line 57) | func TestCompatMarshalDefault(t *testing.T) {
  function TestCompatUnmarshalDefault (line 84) | func TestCompatUnmarshalDefault(t *testing.T) {
  function TestCompatEncoderDefault (line 103) | func TestCompatEncoderDefault(t *testing.T) {
  function TestCompatDecoderDefault (line 134) | func TestCompatDecoderDefault(t *testing.T) {

FILE: external_jsonlib_test/unit_test/ast_compat_test.go
  function TestNotFoud (line 28) | func TestNotFoud(t *testing.T) {
  function TestNull (line 47) | func TestNull(t *testing.T) {

FILE: external_jsonlib_test/unit_test/decoder_stream_test.go
  function TestDecodeSingle (line 37) | func TestDecodeSingle(t *testing.T) {
  function TestDecodeMulti (line 62) | func TestDecodeMulti(t *testing.T) {
  type HaltReader (line 107) | type HaltReader struct
    method Read (line 121) | func (self *HaltReader) Read(p []byte) (int, error) {
    method Reset (line 141) | func (self *HaltReader) Reset(buf string) {
  function NewHaltReader (line 113) | func NewHaltReader(buf string, halts map[int]bool) *HaltReader {
  function TestDecodeHalt (line 153) | func TestDecodeHalt(t *testing.T) {
  function TestMore (line 196) | func TestMore(t *testing.T) {

FILE: fuzz/ast_fuzz_test.go
  function fuzzAst (line 30) | func fuzzAst(t *testing.T, data []byte) {
  function fuzzASTGetFromObject (line 34) | func fuzzASTGetFromObject(t *testing.T, data []byte, m map[string]interf...
  function fuzzASTGetFromArray (line 46) | func fuzzASTGetFromArray(t *testing.T, data []byte, a []interface{}) {

FILE: fuzz/corpus.go
  function corpus (line 22) | func corpus() [][]byte {

FILE: fuzz/fuzz_test.go
  function FuzzMain (line 39) | func FuzzMain(f *testing.F) {
  type testFuzzCase (line 46) | type testFuzzCase struct
  function testJson (line 51) | func testJson(t *testing.T, data []byte, newf func() interface{}) {
  function TestFuzzCases (line 86) | func TestFuzzCases(t *testing.T) {
  function fuzzInvalidJson (line 97) | func fuzzInvalidJson(t *testing.T, data []byte) {
  function fuzzMain (line 115) | func fuzzMain(t *testing.T, data []byte) {
  type S (line 192) | type S struct
  type S1 (line 221) | type S1 struct
  type Marshaller (line 226) | type Marshaller struct
    method MarshalJSON (line 230) | func (m *Marshaller) MarshalJSON() ([]byte, error) {
    method UnmarshalJSON (line 234) | func (m *Marshaller) UnmarshalJSON(data []byte) error {
  type TextMarshaller (line 238) | type TextMarshaller struct
    method MarshalText (line 242) | func (k *TextMarshaller) MarshalText() ([]byte, error) {
    method UnmarshalText (line 246) | func (k *TextMarshaller)  UnmarshalText(data []byte) error {
  function dump (line 251) | func dump(args ...interface{}) string {
  function fdump (line 255) | func fdump(w io.Writer, args ...interface{}) {
  constant MemoryLimitEnv (line 260) | MemoryLimitEnv = "SONIC_FUZZ_MEM_LIMIT"
  constant AsynyncGCEnv (line 261) | AsynyncGCEnv   = "SONIC_NO_ASYNC_GC"
  constant KB (line 262) | KB      uint64 = 1024
  constant MB (line 263) | MB      uint64 = 1024 * KB
  constant GB (line 264) | GB      uint64 = 1024 * MB
  function setMemLimit (line 267) | func setMemLimit(limit uint64) {
  function enableSyncGC (line 280) | func enableSyncGC() {
  function TestMain (line 294) | func TestMain(m *testing.M) {

FILE: fuzz/other_fuzz_test.go
  function fuzzValidate (line 33) | func fuzzValidate(t *testing.T, data []byte){
  function fuzzHtmlEscape (line 42) | func fuzzHtmlEscape(t *testing.T, data []byte){
  function fuzzStream (line 51) | func fuzzStream(t *testing.T, data []byte) {

FILE: fuzz/struct_fuzz_test.go
  function generateNullType (line 38) | func generateNullType() reflect.Type {
  function generateNumberType (line 51) | func generateNumberType() reflect.Type {
  function generatePointerType (line 62) | func generatePointerType(ft reflect.Type) reflect.Type {
  function generateJSONTag (line 73) | func generateJSONTag(name string) reflect.StructTag {
  function Map2StructType (line 87) | func Map2StructType(m map[string]interface{}, maxDepth int) reflect.Type {
  constant _MAX_STRUCT_DEPTH (line 139) | _MAX_STRUCT_DEPTH = 30
  function isAscii (line 142) | func isAscii(s string) bool {
  function genRandString (line 153) | func genRandString(n int) string {
  function removeNonAscii (line 161) | func removeNonAscii(m map[string]interface{}) ([]byte, map[string]interf...
  function fuzzDynamicStruct (line 181) | func fuzzDynamicStruct(t *testing.T, data []byte, v map[string]interface...

FILE: generic_test/benchmark_test.go
  type jsonLibEntry (line 39) | type jsonLibEntry struct
  function init (line 55) | func init() {
  function BenchmarkUnmarshalConcrete (line 64) | func BenchmarkUnmarshalConcrete(b *testing.B)     {
  function BenchmarkUnmarshalInterface (line 68) | func BenchmarkUnmarshalInterface(b *testing.B)     {
  function BenchmarkMarshalConcrete (line 72) | func BenchmarkMarshalConcrete(b *testing.B)     {
  function BenchmarkMarshalInterface (line 76) | func BenchmarkMarshalInterface(b *testing.B)     {
  function runUnmarshalC (line 80) | func runUnmarshalC(b *testing.B) {
  function runUnmarshalI (line 125) | func runUnmarshalI(b *testing.B) {
  function runMarshalC (line 170) | func runMarshalC(b *testing.B) {
  function runMarshalI (line 225) | func runMarshalI(b *testing.B) {

FILE: generic_test/sonic_test.go
  type Str (line 30) | type Str interface
  type Bytes (line 34) | type Bytes interface
  type Any (line 38) | type Any interface
  type SliceAny (line 42) | type SliceAny interface
  function unmarshalAny (line 46) | func unmarshalAny[S Str, B Bytes, T Any](data S, val T) error {
  function marshalAny (line 50) | func marshalAny[B Bytes, T Any](val T) (B, error) {
  function getAny (line 54) | func getAny[S Str, B Bytes, T SliceAny](src S, path T) (ast.Node, error) {
  function pretouchAny (line 58) | func pretouchAny[T Any](v T, opts ...option.CompileOption) error {
  type Basic (line 63) | type Basic interface
  function unmarshalBasic (line 67) | func unmarshalBasic[S Str, B Bytes, T Basic](data S, val T) error {
  function marshalBasic (line 71) | func marshalBasic[B Bytes, T Basic](val T) (B, error) {
  function pretouchBasic (line 75) | func pretouchBasic[T Basic](v T, opts ...option.CompileOption) error {
  type Float64 (line 80) | type Float64
  function TestGenericAPI (line 82) | func TestGenericAPI(t *testing.T) {

FILE: generic_test/testdata_test.go
  type jsonTestdataEntry (line 34) | type jsonTestdataEntry struct
  function jsonTestdata (line 48) | func jsonTestdata() []jsonTestdataEntry {
  type canadaRoot (line 121) | type canadaRoot struct
  type citmRoot (line 137) | type citmRoot struct
  type golangRoot (line 182) | type golangRoot struct
  type golangNode (line 186) | type golangNode struct
  type stringRoot (line 198) | type stringRoot struct
  type syntheaRoot (line 263) | type syntheaRoot struct
  type syntheaCode (line 451) | type syntheaCode struct
  type syntheaCoding (line 455) | type syntheaCoding struct
  type syntheaReference (line 462) | type syntheaReference struct
  type syntheaAddress (line 466) | type syntheaAddress struct
  type syntheaExtension (line 474) | type syntheaExtension struct
  type syntheaRange (line 482) | type syntheaRange struct
  type syntheaCurrency (line 486) | type syntheaCurrency struct
  type twitterRoot (line 493) | type twitterRoot struct
  type twitterStatus (line 507) | type twitterStatus struct
  type twitterUser (line 537) | type twitterUser struct
  type twitterEntities (line 579) | type twitterEntities struct
  type twitterURL (line 613) | type twitterURL struct

FILE: internal/caching/fcache.go
  type FieldMap (line 26) | type FieldMap struct
    method At (line 57) | func (self *FieldMap) At(p uint64) *FieldEntry {
    method Get (line 65) | func (self *FieldMap) Get(name string) int {
    method Set (line 85) | func (self *FieldMap) Set(name string, i int) {
    method GetCaseInsensitive (line 109) | func (self *FieldMap) GetCaseInsensitive(name string) int {
  type FieldEntry (line 32) | type FieldEntry struct
  constant FieldMap_N (line 39) | FieldMap_N     = int64(unsafe.Offsetof(FieldMap{}.N))
  constant FieldMap_b (line 40) | FieldMap_b     = int64(unsafe.Offsetof(FieldMap{}.b))
  constant FieldEntrySize (line 41) | FieldEntrySize = int64(unsafe.Sizeof(FieldEntry{}))
  function newBucket (line 44) | func newBucket(n int) unsafe.Pointer {
  function CreateFieldMap (line 49) | func CreateFieldMap(n int) *FieldMap {

FILE: internal/caching/hashing.go
  function StrHash (line 30) | func StrHash(s string) uint64 {

FILE: internal/caching/hashing_test.go
  constant _H_basis (line 28) | _H_basis uint64 = 0xcbf29ce484222325
  constant _H_prime (line 29) | _H_prime uint64 = 0x00000100000001b3
  function fnv1a (line 32) | func fnv1a(s string) uint64 {
  function TestHashing_Fnv1a (line 50) | func TestHashing_Fnv1a(t *testing.T) {
  function TestHashing_StrHash (line 54) | func TestHashing_StrHash(t *testing.T) {
  function BenchmarkHashing_Fnv1a (line 61) | func BenchmarkHashing_Fnv1a(b *testing.B) {
  function BenchmarkHashing_StrHash (line 67) | func BenchmarkHashing_StrHash(b *testing.B) {

FILE: internal/caching/pcache.go
  constant _LoadFactor (line 30) | _LoadFactor   = 0.5
  constant _InitCapacity (line 31) | _InitCapacity = 4096
  type _ProgramMap (line 34) | type _ProgramMap struct
    method copy (line 53) | func (self *_ProgramMap) copy() *_ProgramMap {
    method get (line 65) | func (self *_ProgramMap) get(vt *rt.GoType) interface{} {
    method add (line 84) | func (self *_ProgramMap) add(vt *rt.GoType, fn interface{}) *_ProgramM...
    method rehash (line 98) | func (self *_ProgramMap) rehash() *_ProgramMap {
    method insert (line 113) | func (self *_ProgramMap) insert(vt *rt.GoType, fn interface{}) {
  type _ProgramEntry (line 40) | type _ProgramEntry struct
  function newProgramMap (line 45) | func newProgramMap() *_ProgramMap {
  type ProgramCache (line 136) | type ProgramCache struct
    method Reset (line 148) | func (self *ProgramCache) Reset() {
    method Get (line 154) | func (self *ProgramCache) Get(vt *rt.GoType) interface{} {
    method Compute (line 158) | func (self *ProgramCache) Compute(vt *rt.GoType, compute func(*rt.GoTy...
  function CreateProgramCache (line 141) | func CreateProgramCache() *ProgramCache {

FILE: internal/caching/pcache_test.go
  function TestPcacheRace (line 26) | func TestPcacheRace(t *testing.T) {

FILE: internal/compat/warn.go
  function Warn (line 10) | func Warn(prefix string) {

FILE: internal/cpu/features.go
  function init (line 31) | func init() {

FILE: internal/decoder/api/decoder.go
  constant _F_allow_control (line 31) | _F_allow_control   = consts.F_allow_control
  constant _F_copy_string (line 32) | _F_copy_string     = consts.F_copy_string
  constant _F_disable_unknown (line 33) | _F_disable_unknown = consts.F_disable_unknown
  constant _F_disable_urc (line 34) | _F_disable_urc     = consts.F_disable_urc
  constant _F_use_int64 (line 35) | _F_use_int64       = consts.F_use_int64
  constant _F_use_number (line 36) | _F_use_number      = consts.F_use_number
  constant _F_validate_string (line 37) | _F_validate_string = consts.F_validate_string
  constant _F_case_sensitive (line 38) | _F_case_sensitive  = consts.F_case_sensitive
  constant _MaxStack (line 40) | _MaxStack = consts.MaxStack
  constant OptionUseInt64 (line 42) | OptionUseInt64         = consts.OptionUseInt64
  constant OptionUseNumber (line 43) | OptionUseNumber        = consts.OptionUseNumber
  constant OptionUseUnicodeErrors (line 44) | OptionUseUnicodeErrors = consts.OptionUseUnicodeErrors
  constant OptionDisableUnknown (line 45) | OptionDisableUnknown   = consts.OptionDisableUnknown
  constant OptionCopyString (line 46) | OptionCopyString       = consts.OptionCopyString
  constant OptionValidateString (line 47) | OptionValidateString   = consts.OptionValidateString
  constant OptionNoValidateJSON (line 48) | OptionNoValidateJSON   = consts.OptionNoValidateJSON
  constant OptionCaseSensitive (line 49) | OptionCaseSensitive    = consts.OptionCaseSensitive
  type Decoder (line 66) | type Decoder struct
    method SetOptions (line 58) | func (self *Decoder) SetOptions(opts Options) {
    method Pos (line 78) | func (self *Decoder) Pos() int {
    method Reset (line 82) | func (self *Decoder) Reset(s string) {
    method CheckTrailings (line 88) | func (self *Decoder) CheckTrailings() error {
    method Decode (line 113) | func (self *Decoder) Decode(val interface{}) error {
    method UseInt64 (line 119) | func (self *Decoder) UseInt64() {
    method UseNumber (line 126) | func (self *Decoder) UseNumber() {
    method UseUnicodeErrors (line 133) | func (self *Decoder) UseUnicodeErrors() {
    method DisallowUnknownFields (line 140) | func (self *Decoder) DisallowUnknownFields() {
    method CopyString (line 145) | func (self *Decoder) CopyString() {
    method ValidateString (line 152) | func (self *Decoder) ValidateString() {
  function NewDecoder (line 73) | func NewDecoder(s string) *Decoder {
  function Pretouch (line 161) | func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
  function Skip (line 167) | func Skip(data []byte) (start int, end int) {

FILE: internal/decoder/api/decoder_amd64.go
  function init (line 33) | func init() {

FILE: internal/decoder/api/decoder_arm64.go
  function init (line 32) | func init() {

FILE: internal/decoder/api/norace_test.go
  function TestStringReferring (line 33) | func TestStringReferring(t *testing.T) {
  function TestDecoderErrorStackOverflower (line 88) | func TestDecoderErrorStackOverflower(t *testing.T) {

FILE: internal/decoder/api/stream.go
  type StreamDecoder (line 36) | type StreamDecoder struct
    method Decode (line 68) | func (self *StreamDecoder) Decode(val interface{}) (err error) {
    method InputOffset (line 121) | func (self *StreamDecoder) InputOffset() int64 {
    method Buffered (line 127) | func (self *StreamDecoder) Buffered() io.Reader {
    method More (line 133) | func (self *StreamDecoder) More() bool {
    method readMore (line 143) | func (self *StreamDecoder) readMore() bool {
    method setErr (line 172) | func (self *StreamDecoder) setErr(err error) {
    method peek (line 179) | func (self *StreamDecoder) peek() (byte, error) {
    method scan (line 195) | func (self *StreamDecoder) scan() (byte, bool) {
    method refill (line 207) | func (self *StreamDecoder) refill() error {
  function freeBytes (line 51) | func freeBytes(buf []byte) {
  function NewStreamDecoder (line 60) | func NewStreamDecoder(r io.Reader) *StreamDecoder {
  function realloc (line 227) | func realloc(buf *[]byte) bool {

FILE: internal/decoder/api/stream_test.go
  function TestStreamError (line 41) | func TestStreamError(t *testing.T) {
  function TestReaderError (line 74) | func TestReaderError(t *testing.T) {
  type ErrReader (line 100) | type ErrReader struct
    method Read (line 106) | func (er *ErrReader) Read(p []byte) (int, error) {
  function TestDecodeEmpty (line 115) | func TestDecodeEmpty(t *testing.T) {
  function TestDecodeRecurse (line 129) | func TestDecodeRecurse(t *testing.T) {
  type HaltReader (line 157) | type HaltReader struct
    method Read (line 171) | func (self *HaltReader) Read(p []byte) (int, error) {
    method Reset (line 191) | func (self *HaltReader) Reset(buf string) {
  function NewHaltReader (line 163) | func NewHaltReader(buf string, halts map[int]bool) *HaltReader {
  function TestBuffered (line 203) | func TestBuffered(t *testing.T) {
  function BenchmarkDecodeStream_Std (line 242) | func BenchmarkDecodeStream_Std(b *testing.B) {
  function BenchmarkDecodeStream_Sonic (line 320) | func BenchmarkDecodeStream_Sonic(b *testing.B) {

FILE: internal/decoder/api/testdata_test.go
  constant TwitterJson (line 19) | TwitterJson = `{
  type TwitterStruct (line 435) | type TwitterStruct struct
  type Hashtags (line 440) | type Hashtags struct
  type Entities (line 445) | type Entities struct
  type Metadata (line 451) | type Metadata struct
  type Urls (line 456) | type Urls struct
  type URL (line 462) | type URL struct
  type Description (line 466) | type Description struct
  type UserEntities (line 470) | type UserEntities struct
  type User (line 475) | type User struct
  type Statuses (line 517) | type Statuses struct
  type SearchMetadata (line 541) | type SearchMetadata struct

FILE: internal/decoder/consts/option.go
  constant F_use_int64 (line 8) | F_use_int64       = 0
  constant F_disable_urc (line 9) | F_disable_urc     = 2
  constant F_disable_unknown (line 10) | F_disable_unknown = 3
  constant F_copy_string (line 11) | F_copy_string     = 4
  constant F_use_number (line 13) | F_use_number       = types.B_USE_NUMBER
  constant F_validate_string (line 14) | F_validate_string  = types.B_VALIDATE_STRING
  constant F_allow_control (line 15) | F_allow_control    = types.B_ALLOW_CONTROL
  constant F_no_validate_json (line 16) | F_no_validate_json = types.B_NO_VALIDATE_JSON
  constant F_case_sensitive (line 17) | F_case_sensitive   = 7
  type Options (line 20) | type Options
  constant OptionUseInt64 (line 23) | OptionUseInt64         Options = 1 << F_use_int64
  constant OptionUseNumber (line 24) | OptionUseNumber        Options = 1 << F_use_number
  constant OptionUseUnicodeErrors (line 25) | OptionUseUnicodeErrors Options = 1 << F_disable_urc
  constant OptionDisableUnknown (line 26) | OptionDisableUnknown   Options = 1 << F_disable_unknown
  constant OptionCopyString (line 27) | OptionCopyString       Options = 1 << F_copy_string
  constant OptionValidateString (line 28) | OptionValidateString   Options = 1 << F_validate_string
  constant OptionNoValidateJSON (line 29) | OptionNoValidateJSON   Options = 1 << F_no_validate_json
  constant OptionCaseSensitive (line 30) | OptionCaseSensitive    Options = 1 << F_case_sensitive
  constant MaxStack (line 34) | MaxStack = 4096

FILE: internal/decoder/errors/errors.go
  type SyntaxError (line 31) | type SyntaxError struct
    method Error (line 38) | func (self SyntaxError) Error() string {
    method Description (line 42) | func (self SyntaxError) Description() string {
    method description (line 46) | func (self SyntaxError) description() string {
    method Message (line 98) | func (self SyntaxError) Message() string {
  function calcBounds (line 65) | func calcBounds(size int, pos int) (lbound int, lwidth int, rbound int, ...
  function clamp_zero (line 105) | func clamp_zero(v int) int {
  function ErrorWrap (line 120) | func ErrorWrap(src string, pos int, code types.ParsingError) error {
  function error_wrap_heap (line 125) | func error_wrap_heap(src string, pos int, code types.ParsingError) *Synt...
  function ErrorType (line 133) | func ErrorType(vt *rt.GoType) error {
  type MismatchTypeError (line 137) | type MismatchTypeError struct
    method Error (line 162) | func (self MismatchTypeError) Error() string {
    method Description (line 171) | func (self MismatchTypeError) Description() string {
  function swithchJSONType (line 143) | func swithchJSONType(src string, pos int) string {
  function ErrorMismatch (line 180) | func ErrorMismatch(src string, pos int, vt *rt.GoType) error {
  function ErrorField (line 188) | func ErrorField(name string) error {
  function ErrorValue (line 192) | func ErrorValue(value string, vtype reflect.Type) error {

FILE: internal/decoder/errors/errors_test.go
  function make_err (line 26) | func make_err(src string, pos int) SyntaxError {
  function TestErrors_Normal (line 34) | func TestErrors_Normal(t *testing.T) {
  function TestErrors_LeftEdge (line 38) | func TestErrors_LeftEdge(t *testing.T) {
  function TestErrors_RightEdge (line 42) | func TestErrors_RightEdge(t *testing.T) {
  function TestErrors_AfterRightEdge (line 46) | func TestErrors_AfterRightEdge(t *testing.T) {
  function TestErrors_ShortDescription (line 50) | func TestErrors_ShortDescription(t *testing.T) {
  function TestErrors_EmptyDescription (line 57) | func TestErrors_EmptyDescription(t *testing.T) {

FILE: internal/decoder/errors/fuzz_test.go
  function Fuzz_calcBounds (line 28) | func Fuzz_calcBounds(f *testing.F) {

FILE: internal/decoder/jitdec/asm_stubs_amd64_go117.go
  method WritePtrAX (line 36) | func (self *_Assembler) WritePtrAX(i int, rec obj.Addr, saveDI bool) {
  method WriteRecNotAX (line 54) | func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr,...
  method WritePtrAX (line 83) | func (self *_ValueDecoder) WritePtrAX(i int, rec obj.Addr, saveDI bool) {
  method WriteRecNotAX (line 101) | func (self *_ValueDecoder) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Ad...

FILE: internal/decoder/jitdec/asm_stubs_amd64_go121.go
  method WritePtrAX (line 39) | func (self *_Assembler) WritePtrAX(i int, rec obj.Addr, saveDI bool) {
  method WriteRecNotAX (line 62) | func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr,...
  method WritePtrAX (line 88) | func (self *_ValueDecoder) WritePtrAX(i int, rec obj.Addr, saveDI bool) {
  method WriteRecNotAX (line 111) | func (self *_ValueDecoder) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Ad...

FILE: internal/decoder/jitdec/assembler_regabi_amd64.go
  constant _FP_args (line 70) | _FP_args   = 72
  constant _FP_fargs (line 71) | _FP_fargs  = 80
  constant _FP_saves (line 72) | _FP_saves  = 48
  constant _FP_locals (line 73) | _FP_locals = 144
  constant _FP_offs (line 77) | _FP_offs = _FP_fargs + _FP_saves + _FP_locals
  constant _FP_size (line 78) | _FP_size = _FP_offs + 8
  constant _FP_base (line 79) | _FP_base = _FP_size + 8
  constant _IM_null (line 83) | _IM_null = 0x6c6c756e
  constant _IM_true (line 84) | _IM_true = 0x65757274
  constant _IM_alse (line 85) | _IM_alse = 0x65736c61
  constant _BM_space (line 89) | _BM_space = (1 << ' ') | (1 << '\t') | (1 << '\r') | (1 << '\n')
  constant _MODE_JSON (line 93) | _MODE_JSON = 1 << 3
  constant _LB_error (line 97) | _LB_error           = "_error"
  constant _LB_im_error (line 98) | _LB_im_error        = "_im_error"
  constant _LB_eof_error (line 99) | _LB_eof_error       = "_eof_error"
  constant _LB_type_error (line 100) | _LB_type_error      = "_type_error"
  constant _LB_field_error (line 101) | _LB_field_error     = "_field_error"
  constant _LB_range_error (line 102) | _LB_range_error     = "_range_error"
  constant _LB_stack_error (line 103) | _LB_stack_error     = "_stack_error"
  constant _LB_base64_error (line 104) | _LB_base64_error    = "_base64_error"
  constant _LB_unquote_error (line 105) | _LB_unquote_error   = "_unquote_error"
  constant _LB_parsing_error (line 106) | _LB_parsing_error   = "_parsing_error"
  constant _LB_parsing_error_v (line 107) | _LB_parsing_error_v = "_parsing_error_v"
  constant _LB_mismatch_error (line 108) | _LB_mismatch_error  = "_mismatch_error"
  constant _LB_char_0_error (line 112) | _LB_char_0_error  = "_char_0_error"
  constant _LB_char_1_error (line 113) | _LB_char_1_error  = "_char_1_error"
  constant _LB_char_2_error (line 114) | _LB_char_2_error  = "_char_2_error"
  constant _LB_char_3_error (line 115) | _LB_char_3_error  = "_char_3_error"
  constant _LB_char_4_error (line 116) | _LB_char_4_error  = "_char_4_error"
  constant _LB_char_m2_error (line 117) | _LB_char_m2_error = "_char_m2_error"
  constant _LB_char_m3_error (line 118) | _LB_char_m3_error = "_char_m3_error"
  constant _LB_skip_one (line 122) | _LB_skip_one       = "_skip_one"
  constant _LB_skip_key_value (line 123) | _LB_skip_key_value = "_skip_key_value"
  type _Assembler (line 209) | type _Assembler struct
    method Load (line 221) | func (self *_Assembler) Load() _Decoder {
    method Init (line 225) | func (self *_Assembler) Init(p _Program) *_Assembler {
    method compile (line 231) | func (self *_Assembler) compile() {
    method _asm_OP_debug (line 322) | func (self *_Assembler) _asm_OP_debug(_ *_Instr) {
    method instr (line 326) | func (self *_Assembler) instr(v *_Instr) {
    method instrs (line 334) | func (self *_Assembler) instrs() {
    method epilogue (line 342) | func (self *_Assembler) epilogue() {
    method prologue (line 361) | func (self *_Assembler) prologue() {
    method save (line 393) | func (self *_Assembler) save(r ...obj.Addr) {
    method load (line 403) | func (self *_Assembler) load(r ...obj.Addr) {
    method call (line 413) | func (self *_Assembler) call(fn obj.Addr) {
    method call_go (line 418) | func (self *_Assembler) call_go(fn obj.Addr) {
    method callc (line 424) | func (self *_Assembler) callc(fn obj.Addr) {
    method call_c (line 431) | func (self *_Assembler) call_c(fn obj.Addr) {
    method call_sf (line 437) | func (self *_Assembler) call_sf(fn obj.Addr) {
    method call_vf (line 447) | func (self *_Assembler) call_vf(fn obj.Addr) {
    method type_error (line 489) | func (self *_Assembler) type_error() {
    method mismatch_error (line 495) | func (self *_Assembler) mismatch_error() {
    method field_error (line 510) | func (self *_Assembler) field_error() {
    method range_error (line 518) | func (self *_Assembler) range_error() {
    method stack_error (line 529) | func (self *_Assembler) stack_error() {
    method base64_error (line 536) | func (self *_Assembler) base64_error() {
    method parsing_error (line 546) | func (self *_Assembler) parsing_error() {
    method _asm_OP_dismatch_err (line 592) | func (self *_Assembler) _asm_OP_dismatch_err(p *_Instr) {
    method _asm_OP_go_skip (line 598) | func (self *_Assembler) _asm_OP_go_skip(p *_Instr) {
    method _asm_OP_skip_empty (line 607) | func (self *_Assembler) _asm_OP_skip_empty(p *_Instr) {
    method skip_one (line 624) | func (self *_Assembler) skip_one() {
    method skip_key_value (line 634) | func (self *_Assembler) skip_key_value() {
    method malloc_AX (line 663) | func (self *_Assembler) malloc_AX(nb obj.Addr, ret obj.Addr) {
    method valloc (line 671) | func (self *_Assembler) valloc(vt reflect.Type, ret obj.Addr) {
    method valloc_AX (line 679) | func (self *_Assembler) valloc_AX(vt reflect.Type) {
    method vfollow (line 686) | func (self *_Assembler) vfollow(vt reflect.Type) {
    method check_err (line 705) | func (self *_Assembler) check_err(vt reflect.Type, pin string, pin2 in...
    method check_eof (line 733) | func (self *_Assembler) check_eof(d int64) {
    method parse_string (line 744) | func (self *_Assembler) parse_string() {
    method parse_number (line 750) | func (self *_Assembler) parse_number(vt reflect.Type, pin string, pin2...
    method parse_signed (line 756) | func (self *_Assembler) parse_signed(vt reflect.Type, pin string, pin2...
    method parse_unsigned (line 762) | func (self *_Assembler) parse_unsigned(vt reflect.Type, pin string, pi...
    method copy_string (line 769) | func (self *_Assembler) copy_string() {
    method escape_string (line 785) | func (self *_Assembler) escape_string() {
    method escape_string_twice (line 810) | func (self *_Assembler) escape_string_twice() {
    method range_single_X0 (line 854) | func (self *_Assembler) range_single_X0() {
    method range_signed_CX (line 866) | func (self *_Assembler) range_signed_CX(i *rt.GoItab, t *rt.GoType, a ...
    method range_unsigned_CX (line 876) | func (self *_Assembler) range_unsigned_CX(i *rt.GoItab, t *rt.GoType, ...
    method range_uint32_CX (line 886) | func (self *_Assembler) range_uint32_CX(i *rt.GoItab, t *rt.GoType) {
    method slice_from (line 903) | func (self *_Assembler) slice_from(p obj.Addr, d int64) {
    method slice_from_r (line 908) | func (self *_Assembler) slice_from_r(p obj.Addr, d int64) {
    method unquote_once (line 914) | func (self *_Assembler) unquote_once(p obj.Addr, n obj.Addr, stack boo...
    method unquote_twice (line 938) | func (self *_Assembler) unquote_twice(p obj.Addr, n obj.Addr, stack bo...
    method mem_clear_fn (line 976) | func (self *_Assembler) mem_clear_fn(ptrfree bool) {
    method mem_clear_rem (line 984) | func (self *_Assembler) mem_clear_rem(size int64, ptrfree bool) {
    method mapaccess_ptr (line 1015) | func (self *_Assembler) mapaccess_ptr(t reflect.Type) {
    method mapassign_std (line 1021) | func (self *_Assembler) mapassign_std(t reflect.Type, v obj.Addr) {
    method mapassign_str_fast (line 1026) | func (self *_Assembler) mapassign_str_fast(t reflect.Type, p obj.Addr,...
    method mapassign_call_from_AX (line 1036) | func (self *_Assembler) mapassign_call_from_AX(t reflect.Type, fn obj....
    method mapassign_fastx (line 1044) | func (self *_Assembler) mapassign_fastx(t reflect.Type, fn obj.Addr) {
    method mapassign_utext (line 1049) | func (self *_Assembler) mapassign_utext(t reflect.Type, addressable bo...
    method unmarshal_json (line 1095) | func (self *_Assembler) unmarshal_json(t reflect.Type, deref bool, f o...
    method unmarshal_text (line 1106) | func (self *_Assembler) unmarshal_text(t reflect.Type, deref bool) {
    method unmarshal_func (line 1112) | func (self *_Assembler) unmarshal_func(t reflect.Type, fn obj.Addr, de...
    method decode_dynamic (line 1163) | func (self *_Assembler) decode_dynamic(vt obj.Addr, vp obj.Addr) {
    method _asm_OP_any (line 1238) | func (self *_Assembler) _asm_OP_any(_ *_Instr) {
    method _asm_OP_dyn (line 1262) | func (self *_Assembler) _asm_OP_dyn(p *_Instr) {
    method _asm_OP_unsupported (line 1296) | func (self *_Assembler) _asm_OP_unsupported(p *_Instr) {
    method _asm_OP_str (line 1301) | func (self *_Assembler) _asm_OP_str(_ *_Instr) {
    method _asm_OP_bin (line 1306) | func (self *_Assembler) _asm_OP_bin(_ *_Instr) {
    method _asm_OP_bool (line 1334) | func (self *_Assembler) _asm_OP_bool(_ *_Instr) {
    method _asm_OP_num (line 1370) | func (self *_Assembler) _asm_OP_num(_ *_Instr) {
    method _asm_OP_i8 (line 1416) | func (self *_Assembler) _asm_OP_i8(_ *_Instr) {
    method _asm_OP_i16 (line 1424) | func (self *_Assembler) _asm_OP_i16(_ *_Instr) {
    method _asm_OP_i32 (line 1432) | func (self *_Assembler) _asm_OP_i32(_ *_Instr) {
    method _asm_OP_i64 (line 1440) | func (self *_Assembler) _asm_OP_i64(_ *_Instr) {
    method _asm_OP_u8 (line 1448) | func (self *_Assembler) _asm_OP_u8(_ *_Instr) {
    method _asm_OP_u16 (line 1456) | func (self *_Assembler) _asm_OP_u16(_ *_Instr) {
    method _asm_OP_u32 (line 1464) | func (self *_Assembler) _asm_OP_u32(_ *_Instr) {
    method _asm_OP_u64 (line 1472) | func (self *_Assembler) _asm_OP_u64(_ *_Instr) {
    method _asm_OP_f32 (line 1480) | func (self *_Assembler) _asm_OP_f32(_ *_Instr) {
    method _asm_OP_f64 (line 1488) | func (self *_Assembler) _asm_OP_f64(_ *_Instr) {
    method _asm_OP_unquote (line 1496) | func (self *_Assembler) _asm_OP_unquote(_ *_Instr) {
    method _asm_OP_nil_1 (line 1507) | func (self *_Assembler) _asm_OP_nil_1(_ *_Instr) {
    method _asm_OP_nil_2 (line 1512) | func (self *_Assembler) _asm_OP_nil_2(_ *_Instr) {
    method _asm_OP_nil_3 (line 1517) | func (self *_Assembler) _asm_OP_nil_3(_ *_Instr) {
    method _asm_OP_empty_bytes (line 1530) | func (self *_Assembler) _asm_OP_empty_bytes(_ *_Instr) {
    method _asm_OP_deref (line 1537) | func (self *_Assembler) _asm_OP_deref(p *_Instr) {
    method _asm_OP_index (line 1541) | func (self *_Assembler) _asm_OP_index(p *_Instr) {
    method _asm_OP_is_null (line 1546) | func (self *_Assembler) _asm_OP_is_null(p *_Instr) {
    method _asm_OP_is_null_quote (line 1556) | func (self *_Assembler) _asm_OP_is_null_quote(p *_Instr) {
    method _asm_OP_map_init (line 1568) | func (self *_Assembler) _asm_OP_map_init(_ *_Instr) {
    method _asm_OP_map_key_i8 (line 1578) | func (self *_Assembler) _asm_OP_map_key_i8(p *_Instr) {
    method _asm_OP_map_key_i16 (line 1585) | func (self *_Assembler) _asm_OP_map_key_i16(p *_Instr) {
    method _asm_OP_map_key_i32 (line 1592) | func (self *_Assembler) _asm_OP_map_key_i32(p *_Instr) {
    method _asm_OP_map_key_i64 (line 1604) | func (self *_Assembler) _asm_OP_map_key_i64(p *_Instr) {
    method _asm_OP_map_key_u8 (line 1615) | func (self *_Assembler) _asm_OP_map_key_u8(p *_Instr) {
    method _asm_OP_map_key_u16 (line 1622) | func (self *_Assembler) _asm_OP_map_key_u16(p *_Instr) {
    method _asm_OP_map_key_u32 (line 1629) | func (self *_Assembler) _asm_OP_map_key_u32(p *_Instr) {
    method _asm_OP_map_key_u64 (line 1641) | func (self *_Assembler) _asm_OP_map_key_u64(p *_Instr) {
    method _asm_OP_map_key_f32 (line 1652) | func (self *_Assembler) _asm_OP_map_key_f32(p *_Instr) {
    method _asm_OP_map_key_f64 (line 1660) | func (self *_Assembler) _asm_OP_map_key_f64(p *_Instr) {
    method _asm_OP_map_key_str (line 1666) | func (self *_Assembler) _asm_OP_map_key_str(p *_Instr) {
    method _asm_OP_map_key_utext (line 1679) | func (self *_Assembler) _asm_OP_map_key_utext(p *_Instr) {
    method _asm_OP_map_key_utext_p (line 1685) | func (self *_Assembler) _asm_OP_map_key_utext_p(p *_Instr) {
    method _asm_OP_array_skip (line 1691) | func (self *_Assembler) _asm_OP_array_skip(_ *_Instr) {
    method _asm_OP_array_clear (line 1697) | func (self *_Assembler) _asm_OP_array_clear(p *_Instr) {
    method _asm_OP_array_clear_p (line 1701) | func (self *_Assembler) _asm_OP_array_clear_p(p *_Instr) {
    method _asm_OP_slice_init (line 1705) | func (self *_Assembler) _asm_OP_slice_init(p *_Instr) {
    method _asm_OP_check_empty (line 1721) | func (self *_Assembler) _asm_OP_check_empty(p *_Instr) {
    method _asm_OP_slice_append (line 1740) | func (self *_Assembler) _asm_OP_slice_append(p *_Instr) {
    method _asm_OP_object_next (line 1786) | func (self *_Assembler) _asm_OP_object_next(_ *_Instr) {
    method _asm_OP_struct_field (line 1792) | func (self *_Assembler) _asm_OP_struct_field(p *_Instr) {
    method _asm_OP_unmarshal (line 1861) | func (self *_Assembler) _asm_OP_unmarshal(p *_Instr) {
    method _asm_OP_unmarshal_p (line 1869) | func (self *_Assembler) _asm_OP_unmarshal_p(p *_Instr) {
    method _asm_OP_unmarshal_text (line 1877) | func (self *_Assembler) _asm_OP_unmarshal_text(p *_Instr) {
    method _asm_OP_unmarshal_text_p (line 1881) | func (self *_Assembler) _asm_OP_unmarshal_text_p(p *_Instr) {
    method _asm_OP_lspace (line 1885) | func (self *_Assembler) _asm_OP_lspace(_ *_Instr) {
    method lspace (line 1889) | func (self *_Assembler) lspace(subfix string) {
    method _asm_OP_match_char (line 1925) | func (self *_Assembler) _asm_OP_match_char(p *_Instr) {
    method match_char (line 1929) | func (self *_Assembler) match_char(char byte) {
    method _asm_OP_check_char (line 1936) | func (self *_Assembler) _asm_OP_check_char(p *_Instr) {
    method _asm_OP_check_char_0 (line 1944) | func (self *_Assembler) _asm_OP_check_char_0(p *_Instr) {
    method _asm_OP_add (line 1950) | func (self *_Assembler) _asm_OP_add(p *_Instr) {
    method _asm_OP_load (line 1954) | func (self *_Assembler) _asm_OP_load(_ *_Instr) {
    method _asm_OP_save (line 1959) | func (self *_Assembler) _asm_OP_save(_ *_Instr) {
    method _asm_OP_drop (line 1968) | func (self *_Assembler) _asm_OP_drop(_ *_Instr) {
    method _asm_OP_drop_2 (line 1977) | func (self *_Assembler) _asm_OP_drop_2(_ *_Instr) {
    method _asm_OP_recurse (line 1986) | func (self *_Assembler) _asm_OP_recurse(p *_Instr) {
    method _asm_OP_goto (line 1991) | func (self *_Assembler) _asm_OP_goto(p *_Instr) {
    method _asm_OP_switch (line 1995) | func (self *_Assembler) _asm_OP_switch(p *_Instr) {
    method print_gc (line 2018) | func (self *_Assembler) print_gc(i int, p1 *_Instr, p2 *_Instr) {
  function newAssembler (line 215) | func newAssembler(p _Program) *_Assembler {
  function init (line 849) | func init() {
  function init (line 1009) | func init() {
  function init (line 1159) | func init() {
  constant _MODE_AVX2 (line 1220) | _MODE_AVX2 = 1 << 2
  constant _Fe_ID (line 1224) | _Fe_ID   = int64(unsafe.Offsetof(caching.FieldEntry{}.ID))
  constant _Fe_Name (line 1225) | _Fe_Name = int64(unsafe.Offsetof(caching.FieldEntry{}.Name))
  constant _Fe_Hash (line 1226) | _Fe_Hash = int64(unsafe.Offsetof(caching.FieldEntry{}.Hash))
  constant _Vk_Ptr (line 1230) | _Vk_Ptr       = int64(reflect.Ptr)
  constant _Gt_KindFlags (line 1231) | _Gt_KindFlags = int64(unsafe.Offsetof(rt.GoType{}.KindFlags))
  function init (line 1234) | func init() {

FILE: internal/decoder/jitdec/assembler_test.go
  type UtextValue (line 37) | type UtextValue
    method UnmarshalText (line 39) | func (UtextValue) UnmarshalText(text []byte) error {
  type UjsonValue (line 46) | type UjsonValue
    method UnmarshalJSON (line 48) | func (UjsonValue) UnmarshalJSON(json []byte) error {
  type UtextStruct (line 53) | type UtextStruct struct
    method UnmarshalText (line 57) | func (self *UtextStruct) UnmarshalText(text []byte) error {
  type UjsonStruct (line 62) | type UjsonStruct struct
    method UnmarshalJSON (line 66) | func (self *UjsonStruct) UnmarshalJSON(v []byte) error {
  constant _OP_dbg_get_sr (line 72) | _OP_dbg_get_sr _Op = 253
  constant _OP_dbg_set_sr (line 73) | _OP_dbg_set_sr _Op = 254
  constant _OP_dbg_break (line 74) | _OP_dbg_break  _Op = 255
  method _asm_OP_dbg_get_sr (line 77) | func (self *_Assembler) _asm_OP_dbg_get_sr(_ *_Instr) {
  method _asm_OP_dbg_set_sr (line 82) | func (self *_Assembler) _asm_OP_dbg_set_sr(p *_Instr) {
  method _asm_OP_dbg_break (line 87) | func (self *_Assembler) _asm_OP_dbg_break(_ *_Instr) {
  function init (line 91) | func init() {
  type testOps (line 100) | type testOps struct
  function testOpCode (line 112) | func testOpCode(t *testing.T, ops *testOps) {
  function TestAssembler_OpCode (line 138) | func TestAssembler_OpCode(t *testing.T) {
  type JsonStruct (line 674) | type JsonStruct struct
  function TestAssembler_DecodeStruct (line 681) | func TestAssembler_DecodeStruct(t *testing.T) {
  function TestAssembler_PrologueAndEpilogue (line 700) | func TestAssembler_PrologueAndEpilogue(t *testing.T) {
  type Tx (line 706) | type Tx struct
  function TestAssembler_DecodeStruct_SinglePrivateField (line 710) | func TestAssembler_DecodeStruct_SinglePrivateField(t *testing.T) {
  function TestAssembler_DecodeByteSlice_Bin (line 724) | func TestAssembler_DecodeByteSlice_Bin(t *testing.T) {
  function TestAssembler_DecodeByteSlice_List (line 738) | func TestAssembler_DecodeByteSlice_List(t *testing.T) {

FILE: internal/decoder/jitdec/compiler.go
  type _Op (line 33) | type _Op
    method String (line 185) | func (self _Op) String() string {
  constant _OP_any (line 36) | _OP_any _Op = iota + 1
  constant _OP_dyn (line 37) | _OP_dyn
  constant _OP_str (line 38) | _OP_str
  constant _OP_bin (line 39) | _OP_bin
  constant _OP_bool (line 40) | _OP_bool
  constant _OP_num (line 41) | _OP_num
  constant _OP_i8 (line 42) | _OP_i8
  constant _OP_i16 (line 43) | _OP_i16
  constant _OP_i32 (line 44) | _OP_i32
  constant _OP_i64 (line 45) | _OP_i64
  constant _OP_u8 (line 46) | _OP_u8
  constant _OP_u16 (line 47) | _OP_u16
  constant _OP_u32 (line 48) | _OP_u32
  constant _OP_u64 (line 49) | _OP_u64
  constant _OP_f32 (line 50) | _OP_f32
  constant _OP_f64 (line 51) | _OP_f64
  constant _OP_unquote (line 52) | _OP_unquote
  constant _OP_nil_1 (line 53) | _OP_nil_1
  constant _OP_nil_2 (line 54) | _OP_nil_2
  constant _OP_nil_3 (line 55) | _OP_nil_3
  constant _OP_empty_bytes (line 56) | _OP_empty_bytes
  constant _OP_deref (line 57) | _OP_deref
  constant _OP_index (line 58) | _OP_index
  constant _OP_is_null (line 59) | _OP_is_null
  constant _OP_is_null_quote (line 60) | _OP_is_null_quote
  constant _OP_map_init (line 61) | _OP_map_init
  constant _OP_map_key_i8 (line 62) | _OP_map_key_i8
  constant _OP_map_key_i16 (line 63) | _OP_map_key_i16
  constant _OP_map_key_i32 (line 64) | _OP_map_key_i32
  constant _OP_map_key_i64 (line 65) | _OP_map_key_i64
  constant _OP_map_key_u8 (line 66) | _OP_map_key_u8
  constant _OP_map_key_u16 (line 67) | _OP_map_key_u16
  constant _OP_map_key_u32 (line 68) | _OP_map_key_u32
  constant _OP_map_key_u64 (line 69) | _OP_map_key_u64
  constant _OP_map_key_f32 (line 70) | _OP_map_key_f32
  constant _OP_map_key_f64 (line 71) | _OP_map_key_f64
  constant _OP_map_key_str (line 72) | _OP_map_key_str
  constant _OP_map_key_utext (line 73) | _OP_map_key_utext
  constant _OP_map_key_utext_p (line 74) | _OP_map_key_utext_p
  constant _OP_array_skip (line 75) | _OP_array_skip
  constant _OP_array_clear (line 76) | _OP_array_clear
  constant _OP_array_clear_p (line 77) | _OP_array_clear_p
  constant _OP_slice_init (line 78) | _OP_slice_init
  constant _OP_slice_append (line 79) | _OP_slice_append
  constant _OP_object_next (line 80) | _OP_object_next
  constant _OP_struct_field (line 81) | _OP_struct_field
  constant _OP_unmarshal (line 82) | _OP_unmarshal
  constant _OP_unmarshal_p (line 83) | _OP_unmarshal_p
  constant _OP_unmarshal_text (line 84) | _OP_unmarshal_text
  constant _OP_unmarshal_text_p (line 85) | _OP_unmarshal_text_p
  constant _OP_lspace (line 86) | _OP_lspace
  constant _OP_match_char (line 87) | _OP_match_char
  constant _OP_check_char (line 88) | _OP_check_char
  constant _OP_load (line 89) | _OP_load
  constant _OP_save (line 90) | _OP_save
  constant _OP_drop (line 91) | _OP_drop
  constant _OP_drop_2 (line 92) | _OP_drop_2
  constant _OP_recurse (line 93) | _OP_recurse
  constant _OP_goto (line 94) | _OP_goto
  constant _OP_switch (line 95) | _OP_switch
  constant _OP_check_char_0 (line 96) | _OP_check_char_0
  constant _OP_dismatch_err (line 97) | _OP_dismatch_err
  constant _OP_go_skip (line 98) | _OP_go_skip
  constant _OP_skip_emtpy (line 99) | _OP_skip_emtpy
  constant _OP_add (line 100) | _OP_add
  constant _OP_check_empty (line 101) | _OP_check_empty
  constant _OP_unsupported (line 102) | _OP_unsupported
  constant _OP_debug (line 103) | _OP_debug
  constant _INT_SIZE (line 107) | _INT_SIZE = 32 << (^uint(0) >> 63)
  constant _PTR_SIZE (line 108) | _PTR_SIZE = 32 << (^uintptr(0) >> 63)
  constant _PTR_BYTE (line 109) | _PTR_BYTE = unsafe.Sizeof(uintptr(0))
  constant _MAX_ILBUF (line 113) | _MAX_ILBUF  = 100000
  constant _MAX_FIELDS (line 114) | _MAX_FIELDS = 50
  function _OP_int (line 193) | func _OP_int() _Op {
  function _OP_uint (line 204) | func _OP_uint() _Op {
  function _OP_uintptr (line 215) | func _OP_uintptr() _Op {
  function _OP_map_key_int (line 226) | func _OP_map_key_int() _Op {
  function _OP_map_key_uint (line 237) | func _OP_map_key_uint() _Op {
  function _OP_map_key_uintptr (line 248) | func _OP_map_key_uintptr() _Op {
  type _Instr (line 259) | type _Instr struct
    method op (line 308) | func (self _Instr) op() _Op {
    method vi (line 312) | func (self _Instr) vi() int {
    method vb (line 316) | func (self _Instr) vb() byte {
    method vs (line 320) | func (self _Instr) vs() (v []int) {
    method vf (line 327) | func (self _Instr) vf() *caching.FieldMap {
    method vk (line 331) | func (self _Instr) vk() reflect.Kind {
    method vt (line 335) | func (self _Instr) vt() reflect.Type {
    method i64 (line 339) | func (self _Instr) i64() int64 {
    method vlen (line 343) | func (self _Instr) vlen() int {
    method isBranch (line 347) | func (self _Instr) isBranch() bool {
    method disassemble (line 364) | func (self _Instr) disassemble() string {
    method formatSwitchLabels (line 435) | func (self _Instr) formatSwitchLabels() string {
    method formatStructFields (line 449) | func (self _Instr) formatStructFields() string {
  function packOp (line 264) | func packOp(op _Op) uint64 {
  function newInsOp (line 268) | func newInsOp(op _Op) _Instr {
  function newInsVi (line 272) | func newInsVi(op _Op, vi int) _Instr {
  function newInsVb (line 276) | func newInsVb(op _Op, vb byte) _Instr {
  function newInsVs (line 280) | func newInsVs(op _Op, vs []int) _Instr {
  function newInsVt (line 287) | func newInsVt(op _Op, vt reflect.Type) _Instr {
  function newInsVtI (line 294) | func newInsVtI(op _Op, vt reflect.Type, iv int) _Instr {
  function newInsVf (line 301) | func newInsVf(op _Op, vf *caching.FieldMap) _Instr {
  type _Program (line 482) | type _Program
    method pc (line 485) | func (self _Program) pc() int {
    method tag (line 489) | func (self _Program) tag(n int) {
    method pin (line 495) | func (self _Program) pin(i int) {
    method rel (line 501) | func (self _Program) rel(v []int) {
    method add (line 507) | func (self *_Program) add(op _Op) {
    method int (line 511) | func (self *_Program) int(op _Op, vi int) {
    method chr (line 515) | func (self *_Program) chr(op _Op, vb byte) {
    method tab (line 519) | func (self *_Program) tab(op _Op, vs []int) {
    method rtt (line 523) | func (self *_Program) rtt(op _Op, vt reflect.Type) {
    method rtti (line 527) | func (self *_Program) rtti(op _Op, vt reflect.Type, iv int) {
    method fmv (line 531) | func (self *_Program) fmv(op _Op, vf *caching.FieldMap) {
    method disassemble (line 535) | func (self _Program) disassemble() string {
  type _Compiler (line 571) | type _Compiler struct
    method apply (line 585) | func (self *_Compiler) apply(opts option.CompileOptions) *_Compiler {
    method rescue (line 590) | func (self *_Compiler) rescue(ep *error) {
    method compile (line 600) | func (self *_Compiler) compile(vt reflect.Type) (ret _Program, err err...
    method checkMarshaler (line 610) | func (self *_Compiler) checkMarshaler(p *_Program, vt reflect.Type, fl...
    method compileOne (line 657) | func (self *_Compiler) compileOne(p *_Program, sp int, vt reflect.Type) {
    method compileOps (line 676) | func (self *_Compiler) compileOps(p *_Program, sp int, vt reflect.Type) {
    method compileUnsupportedType (line 725) | func (self *_Compiler) compileUnsupportedType(p *_Program, vt reflect....
    method compileMap (line 732) | func (self *_Compiler) compileMap(p *_Program, sp int, vt reflect.Type) {
    method compileMapUt (line 742) | func (self *_Compiler) compileMapUt(p *_Program, sp int, vt reflect.Ty...
    method compileMapUnsupportedKey (line 777) | func (self *_Compiler) compileMapUnsupportedKey(p *_Program, vt reflec...
    method compileMapOp (line 788) | func (self *_Compiler) compileMapOp(p *_Program, sp int, vt reflect.Ty...
    method compilePtr (line 837) | func (self *_Compiler) compilePtr(p *_Program, sp int, et reflect.Type) {
    method compileArray (line 877) | func (self *_Compiler) compileArray(p *_Program, sp int, vt reflect.Ty...
    method compileSlice (line 920) | func (self *_Compiler) compileSlice(p *_Program, sp int, vt reflect.Ty...
    method compileSliceBin (line 928) | func (self *_Compiler) compileSliceBin(p *_Program, sp int, vt reflect...
    method compileSliceList (line 958) | func (self *_Compiler) compileSliceList(p *_Program, sp int, vt reflec...
    method compileSliceBody (line 972) | func (self *_Compiler) compileSliceBody(p *_Program, sp int, et reflec...
    method compileString (line 995) | func (self *_Compiler) compileString(p *_Program, vt reflect.Type) {
    method compileStringBody (line 1003) | func (self *_Compiler) compileStringBody(vt reflect.Type, p *_Program) {
    method compileStruct (line 1012) | func (self *_Compiler) compileStruct(p *_Program, sp int, vt reflect.T...
    method compileStructBody (line 1023) | func (self *_Compiler) compileStructBody(p *_Program, sp int, vt refle...
    method compileStructFieldStrUnmarshal (line 1108) | func (self *_Compiler) compileStructFieldStrUnmarshal(p *_Program, vt ...
    method compileStructFieldStr (line 1116) | func (self *_Compiler) compileStructFieldStr(p *_Program, sp int, vt r...
    method compileInterface (line 1278) | func (self *_Compiler) compileInterface(p *_Program, vt reflect.Type) {
    method compilePrimitive (line 1297) | func (self *_Compiler) compilePrimitive(_ reflect.Type, p *_Program, o...
    method compileUnmarshalEnd (line 1304) | func (self *_Compiler) compileUnmarshalEnd(p *_Program, vt reflect.Typ...
    method compileUnmarshalJson (line 1321) | func (self *_Compiler) compileUnmarshalJson(p *_Program, vt reflect.Ty...
    method compileUnmarshalText (line 1336) | func (self *_Compiler) compileUnmarshalText(p *_Program, vt reflect.Ty...
    method compileUnmarshalTextPtr (line 1353) | func (self *_Compiler) compileUnmarshalTextPtr(p *_Program, vt reflect...
    method checkIfSkip (line 1361) | func (self *_Compiler) checkIfSkip(p *_Program, vt reflect.Type, c byt...
  function newCompiler (line 577) | func newCompiler() *_Compiler {
  constant checkMarshalerFlags_quoted (line 607) | checkMarshalerFlags_quoted = 1

FILE: internal/decoder/jitdec/compiler_test.go
  function TestCompiler_Compile (line 27) | func TestCompiler_Compile(t *testing.T) {
  function BenchmarkCompiler_Compile (line 33) | func BenchmarkCompiler_Compile(b *testing.B) {

FILE: internal/decoder/jitdec/debug.go
  function println_wrapper (line 42) | func println_wrapper(i int, op1 int, op2 int) {
  function print (line 46) | func print(i int) {
  method force_gc (line 50) | func (self *_Assembler) force_gc() {
  method debug_instr (line 55) | func (self *_Assembler) debug_instr(i int, v *_Instr) {

FILE: internal/decoder/jitdec/decoder.go
  constant _F_allow_control (line 22) | _F_allow_control    = consts.F_allow_control
  constant _F_copy_string (line 23) | _F_copy_string      = consts.F_copy_string
  constant _F_disable_unknown (line 24) | _F_disable_unknown  = consts.F_disable_unknown
  constant _F_disable_urc (line 25) | _F_disable_urc      = consts.F_disable_urc
  constant _F_use_int64 (line 26) | _F_use_int64        = consts.F_use_int64
  constant _F_use_number (line 27) | _F_use_number       = consts.F_use_number
  constant _F_no_validate_json (line 28) | _F_no_validate_json = consts.F_no_validate_json
  constant _F_validate_string (line 29) | _F_validate_string  = consts.F_validate_string
  constant _F_case_sensitive (line 30) | _F_case_sensitive   = consts.F_case_sensitive
  function Decode (line 44) | func Decode(s *string, i *int, f uint64, val interface{}) error {
  function Pretouch (line 90) | func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
  function pretouchType (line 98) | func pretouchType(_vt reflect.Type, opts option.CompileOptions) (map[ref...
  function pretouchRec (line 122) | func pretouchRec(vtm map[reflect.Type]bool, opts option.CompileOptions) ...

FILE: internal/decoder/jitdec/generic_regabi_amd64.go
  constant _VD_args (line 46) | _VD_args   = 8
  constant _VD_fargs (line 47) | _VD_fargs  = 64
  constant _VD_saves (line 48) | _VD_saves  = 48
  constant _VD_locals (line 49) | _VD_locals = 96
  constant _VD_offs (line 53) | _VD_offs = _VD_fargs + _VD_saves + _VD_locals
  constant _VD_size (line 54) | _VD_size = _VD_offs + 8
  type _ValueDecoder (line 75) | type _ValueDecoder struct
    method build (line 86) | func (self *_ValueDecoder) build() uintptr {
    method save (line 93) | func (self *_ValueDecoder) save(r ...obj.Addr) {
    method load (line 103) | func (self *_ValueDecoder) load(r ...obj.Addr) {
    method call (line 113) | func (self *_ValueDecoder) call(fn obj.Addr) {
    method call_go (line 118) | func (self *_ValueDecoder) call_go(fn obj.Addr) {
    method callc (line 124) | func (self *_ValueDecoder) callc(fn obj.Addr) {
    method call_c (line 130) | func (self *_ValueDecoder) call_c(fn obj.Addr) {
    method compile (line 204) | func (self *_ValueDecoder) compile() {
  constant _S_val (line 139) | _S_val = iota + 1
  constant _S_arr (line 140) | _S_arr
  constant _S_arr_0 (line 141) | _S_arr_0
  constant _S_obj (line 142) | _S_obj
  constant _S_obj_0 (line 143) | _S_obj_0
  constant _S_obj_delim (line 144) | _S_obj_delim
  constant _S_obj_sep (line 145) | _S_obj_sep
  constant _S_omask_key (line 149) | _S_omask_key = (1 << _S_obj_0) | (1 << _S_obj_sep)
  constant _S_omask_end (line 150) | _S_omask_end = (1 << _S_obj_0) | (1 << _S_obj)
  constant _S_vmask (line 151) | _S_vmask     = (1 << _S_val) | (1 << _S_arr_0)
  constant _A_init_len (line 155) | _A_init_len = 1
  constant _A_init_cap (line 156) | _A_init_cap = 16
  constant _ST_Sp (line 160) | _ST_Sp = 0
  constant _ST_Vt (line 161) | _ST_Vt = _PtrBytes
  constant _ST_Vp (line 162) | _ST_Vp = _PtrBytes * (types.MAX_RECURSE + 1)
  function invalid_vtype (line 730) | func invalid_vtype(vt types.ValueType) {

FILE: internal/decoder/jitdec/generic_test.go
  function decodeValueStub (line 31) | func decodeValueStub(st *_Stack, sp string, ic int, vp *interface{}, df ...
  function decodeValue (line 33) | func decodeValue(k *_Stack, s string, i int, f uint64) (p int, v interfa...
  function decodeGeneric (line 38) | func decodeGeneric(s string, i int, f uint64) (p int, v interface{}, e t...
  function TestGeneric_DecodeInterface (line 45) | func TestGeneric_DecodeInterface(t *testing.T) {
  function BenchmarkGeneric_DecodeGeneric (line 57) | func BenchmarkGeneric_DecodeGeneric(b *testing.B) {
  function BenchmarkGeneric_Parallel_DecodeGeneric (line 68) | func BenchmarkGeneric_Parallel_DecodeGeneric(b *testing.B) {

FILE: internal/decoder/jitdec/pcsp_test.go
  type _MockDecoder (line 32) | type _MockDecoder struct
    method compile (line 36) | func (self *_MockDecoder) compile() {
    method Load (line 50) | func (self *_MockDecoder) Load() _Decoder {
  type sigctxt (line 56) | type sigctxt struct
    method regs (line 112) | func (c *sigctxt) regs() *sigcontext {
    method rsp (line 116) | func (c *sigctxt) rsp() uint64 { return c.regs().rsp }
    method sigpc (line 119) | func (c *sigctxt) sigpc() uintptr { return uintptr(c.rip()) }
    method rip (line 122) | func (c *sigctxt) rip() uint64    { return c.regs().rip }
    method sigsp (line 123) | func (c *sigctxt) sigsp() uintptr { return uintptr(c.rsp()) }
    method siglr (line 124) | func (c *sigctxt) siglr() uintptr { return 0 }
  type stackt (line 61) | type stackt struct
  type mcontext (line 68) | type mcontext struct
  type sigcontext (line 74) | type sigcontext struct
  type ucontext (line 104) | type ucontext struct
  function traceback1 (line 132) | func traceback1(pc, sp, lr uintptr, gp unsafe.Pointer, flags uint)
  function sonicSigTrap (line 134) | func sonicSigTrap(info unsafe.Pointer, c *sigctxt, gp unsafe.Pointer) bo...
  function TestAssembler_PCSP (line 142) | func TestAssembler_PCSP(t *testing.T) {

FILE: internal/decoder/jitdec/pools.go
  constant _MinSlice (line 29) | _MinSlice      = 2
  constant _MaxStack (line 30) | _MaxStack      = 4096
  constant _MaxStackBytes (line 31) | _MaxStackBytes = _MaxStack * _PtrBytes
  constant _MaxDigitNums (line 32) | _MaxDigitNums  = types.MaxDigitNums
  constant _PtrBytes (line 36) | _PtrBytes   = _PTR_SIZE / 8
  constant _FsmOffset (line 37) | _FsmOffset  = (_MaxStack + 1) * _PtrBytes
  constant _DbufOffset (line 38) | _DbufOffset = _FsmOffset + int64(unsafe.Sizeof(types.StateMachine{})) + ...
  constant _EpOffset (line 39) | _EpOffset   = _DbufOffset + _MaxDigitNums
  constant _StackSize (line 40) | _StackSize  = unsafe.Sizeof(_Stack{})
  type _Stack (line 51) | type _Stack struct
  type _Decoder (line 60) | type _Decoder
  function newStack (line 96) | func newStack() *_Stack {
  function resetStack (line 104) | func resetStack(p *_Stack) {
  function freeStack (line 108) | func freeStack(p *_Stack) {
  function freezeValue (line 113) | func freezeValue(v unsafe.Pointer) uintptr {
  function freezeFields (line 118) | func freezeFields(v *caching.FieldMap) int64 {
  function referenceFields (line 125) | func referenceFields(v *caching.FieldMap) int64 {
  function makeDecoder (line 129) | func makeDecoder(vt *rt.GoType, _ ...interface{}) (interface{}, error) {
  function findOrCompile (line 137) | func findOrCompile(vt *rt.GoType) (_Decoder, error) {

FILE: internal/decoder/jitdec/primitives.go
  function decodeTypedPointer (line 28) | func decodeTypedPointer(s string, i int, vt *rt.GoType, vp unsafe.Pointe...
  function decodeJsonUnmarshaler (line 38) | func decodeJsonUnmarshaler(vv interface{}, s string) error {
  type MismatchQuotedError (line 43) | type MismatchQuotedError struct
    method Error (line 45) | func (*MismatchQuotedError) Error() string {
  function decodeJsonUnmarshalerQuoted (line 49) | func decodeJsonUnmarshalerQuoted(vv interface{}, s string) error {
  function decodeTextUnmarshaler (line 56) | func decodeTextUnmarshaler(vv interface{}, s string) error {

FILE: internal/decoder/jitdec/testdata_test.go
  constant TwitterJson (line 19) | TwitterJson = `{
  type TwitterStruct (line 435) | type TwitterStruct struct
  type Hashtags (line 440) | type Hashtags struct
  type Entities (line 445) | type Entities struct
  type Metadata (line 451) | type Metadata struct
  type Urls (line 456) | type Urls struct
  type URL (line 462) | type URL struct
  type Description (line 466) | type Description struct
  type UserEntities (line 470) | type UserEntities struct
  type User (line 475) | type User struct
  type Statuses (line 517) | type Statuses struct
  type SearchMetadata (line 541) | type SearchMetadata struct

FILE: internal/decoder/jitdec/types.go
  function rtype (line 55) | func rtype(t reflect.Type) (*rt.GoItab, *rt.GoType) {

FILE: internal/decoder/jitdec/utils.go
  function pbool (line 26) | func pbool(v bool) uintptr {
  function ptodec (line 31) | func ptodec(p loader.Function) _Decoder {
  function assert_eq (line 35) | func assert_eq(v int64, exp int64, msg string) {

FILE: internal/decoder/optdec/compile_struct.go
  constant _MAX_FIELDS (line 13) | _MAX_FIELDS = 50
  method compileIntStringOption (line 16) | func (c *compiler) compileIntStringOption(vt reflect.Type) decFunc {
  function isInteger (line 42) | func isInteger(vt reflect.Type) bool {
  method assertStringOptTypes (line 51) | func (c *compiler) assertStringOptTypes(vt reflect.Type) {
  method compileFieldStringOption (line 75) | func (c *compiler) compileFieldStringOption(vt reflect.Type) decFunc {
  method compileStruct (line 127) | func (c *compiler) compileStruct(vt reflect.Type) decFunc {
  method compileStructBody (line 144) | func (c *compiler) compileStructBody(vt reflect.Type) decFunc {

FILE: internal/decoder/optdec/compiler.go
  function findOrCompile (line 16) | func findOrCompile(vt *rt.GoType) (decFunc, error) {
  type compiler (line 30) | type compiler struct
    method apply (line 45) | func (self *compiler) apply(opts option.CompileOptions) *compiler {
    method enter (line 52) | func (c *compiler) enter(vt reflect.Type) {
    method exit (line 61) | func (c *compiler) exit(vt reflect.Type) {
    method compileInt (line 66) | func (c *compiler) compileInt(vt reflect.Type) decFunc {
    method rescue (line 92) | func (c *compiler) rescue(ep *error) {
    method compileType (line 102) | func (c *compiler) compileType(vt reflect.Type) (rt decFunc, err error) {
    method compile (line 108) | func (c *compiler) compile(vt reflect.Type) decFunc {
    method compileBasic (line 123) | func (c *compiler) compileBasic(vt reflect.Type) decFunc {
    method compilePtr (line 177) | func (c *compiler) compilePtr(vt reflect.Type) decFunc {
    method compileArray (line 196) | func (c *compiler) compileArray(vt reflect.Type) decFunc {
    method compileString (line 207) | func (c *compiler) compileString(vt reflect.Type) decFunc {
    method tryCompileSliceUnmarshaler (line 215) | func (c *compiler) tryCompileSliceUnmarshaler(vt reflect.Type) decFunc {
    method compileSlice (line 235) | func (c *compiler) compileSlice(vt reflect.Type) decFunc {
    method compileSliceBytes (line 278) | func (c *compiler) compileSliceBytes(vt reflect.Type) decFunc {
    method compileInterface (line 300) | func (c *compiler) compileInterface(vt reflect.Type) decFunc {
    method compileMap (line 324) | func (c *compiler) compileMap(vt reflect.Type) decFunc {
    method compileMapKey (line 412) | func (c *compiler) compileMapKey(vt reflect.Type) decKey {
    method tryCompilePtrUnmarshaler (line 438) | func (c *compiler) tryCompilePtrUnmarshaler(vt reflect.Type, strOpt bo...
  function newCompiler (line 38) | func newCompiler() *compiler {
  constant _CompileMaxDepth (line 50) | _CompileMaxDepth = 4096
  function tryCompileKeyUnmarshaler (line 395) | func tryCompileKeyUnmarshaler(vt reflect.Type) decKey {
  function panicForInvalidStrType (line 463) | func panicForInvalidStrType(vt reflect.Type) {

FILE: internal/decoder/optdec/const.go
  constant KNull (line 33) | KNull   = 0
  constant KBool (line 34) | KBool   = 2
  constant KNumber (line 35) | KNumber = 3
  constant KString (line 36) | KString = 4
  constant KRaw (line 37) | KRaw    = 5
  constant KObject (line 38) | KObject = 6
  constant KArray (line 39) | KArray  = 7
  constant KFalse (line 42) | KFalse         = (0 << 3) | KBool
  constant KTrue (line 43) | KTrue          = (1 << 3) | KBool
  constant KUint (line 44) | KUint          = (0 << 3) | KNumber
  constant KSint (line 45) | KSint          = (1 << 3) | KNumber
  constant KReal (line 46) | KReal          = (2 << 3) | KNumber
  constant KRawNumber (line 47) | KRawNumber     = (3 << 3) | KNumber
  constant KStringCommon (line 48) | KStringCommon  = KString
  constant KStringEscaped (line 49) | KStringEscaped = (1 << 3) | KString
  constant PosMask (line 53) | PosMask  = math.MaxUint64 << 32
  constant PosBits (line 54) | PosBits  = 32
  constant TypeMask (line 55) | TypeMask = 0xFF
  constant TypeBits (line 56) | TypeBits = 8
  constant ConLenMask (line 58) | ConLenMask = uint64(math.MaxUint32)
  constant ConLenBits (line 59) | ConLenBits = 32

FILE: internal/decoder/optdec/decoder.go
  constant _F_allow_control (line 20) | _F_allow_control   = consts.F_allow_control
  constant _F_copy_string (line 21) | _F_copy_string     = consts.F_copy_string
  constant _F_disable_unknown (line 22) | _F_disable_unknown = consts.F_disable_unknown
  constant _F_disable_urc (line 23) | _F_disable_urc     = consts.F_disable_urc
  constant _F_use_int64 (line 24) | _F_use_int64       = consts.F_use_int64
  constant _F_use_number (line 25) | _F_use_number      = consts.F_use_number
  constant _F_validate_string (line 26) | _F_validate_string = consts.F_validate_string
  constant OptionUseInt64 (line 32) | OptionUseInt64         = consts.OptionUseInt64
  constant OptionUseNumber (line 33) | OptionUseNumber        = consts.OptionUseNumber
  constant OptionUseUnicodeErrors (line 34) | OptionUseUnicodeErrors = consts.OptionUseUnicodeErrors
  constant OptionDisableUnknown (line 35) | OptionDisableUnknown   = consts.OptionDisableUnknown
  constant OptionCopyString (line 36) | OptionCopyString       = consts.OptionCopyString
  constant OptionValidateString (line 37) | OptionValidateString   = consts.OptionValidateString
  function Decode (line 40) | func Decode(s *string, i *int, f uint64, val interface{}) error {
  function fix_error (line 87) | func fix_error(json string, pos int, err error) error {
  function Pretouch (line 112) | func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
  function pretouchType (line 120) | func pretouchType(_vt reflect.Type, opts option.CompileOptions) (map[ref...
  function pretouchRec (line 142) | func pretouchRec(vtm map[reflect.Type]bool, opts option.CompileOptions) ...

FILE: internal/decoder/optdec/errors.go
  function error_type (line 35) | func error_type(vt *rt.GoType) error {
  function error_mismatch (line 39) | func error_mismatch(node Node, ctx *context, typ reflect.Type) error {
  function newUnmatched (line 47) | func newUnmatched(pos int, vt *rt.GoType) error {
  function error_field (line 55) | func error_field(name string) error {
  function error_value (line 59) | func error_value(value string, vtype reflect.Type) error {
  function error_syntax (line 66) | func error_syntax(pos int, src string, msg string) error {
  function error_unsuppoted (line 74) | func error_unsuppoted(typ *rt.GoType) error {

FILE: internal/decoder/optdec/functor.go
  type decFunc (line 12) | type decFunc interface
  type ptrDecoder (line 16) | type ptrDecoder struct
    method FromDom (line 22) | func (d *ptrDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *contex...
  type embeddedFieldPtrDecoder (line 35) | type embeddedFieldPtrDecoder struct
    method FromDom (line 42) | func (d *embeddedFieldPtrDecoder) FromDom(vp unsafe.Pointer, node Node...
  type i8Decoder (line 62) | type i8Decoder struct
    method FromDom (line 64) | func (d *i8Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context...
  type i16Decoder (line 78) | type i16Decoder struct
    method FromDom (line 80) | func (d *i16Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *contex...
  type i32Decoder (line 94) | type i32Decoder struct
    method FromDom (line 96) | func (d *i32Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *contex...
  type i64Decoder (line 110) | type i64Decoder struct
    method FromDom (line 112) | func (d *i64Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *contex...
  type u8Decoder (line 126) | type u8Decoder struct
    method FromDom (line 128) | func (d *u8Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context...
  type u16Decoder (line 143) | type u16Decoder struct
    method FromDom (line 145) | func (d *u16Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *contex...
  type u32Decoder (line 158) | type u32Decoder struct
    method FromDom (line 160) | func (d *u32Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *contex...
  type u64Decoder (line 174) | type u64Decoder struct
    method FromDom (line 176) | func (d *u64Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *contex...
  type f32Decoder (line 190) | type f32Decoder struct
    method FromDom (line 192) | func (d *f32Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *contex...
  type f64Decoder (line 206) | type f64Decoder struct
    method FromDom (line 208) | func (d *f64Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *contex...
  type boolDecoder (line 222) | type boolDecoder struct
    method FromDom (line 225) | func (d *boolDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *conte...
  type stringDecoder (line 239) | type stringDecoder struct
    method FromDom (line 242) | func (d *stringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *con...
  type numberDecoder (line 255) | type numberDecoder struct
    method FromDom (line 258) | func (d *numberDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *con...
  type recuriveDecoder (line 271) | type recuriveDecoder struct
    method FromDom (line 275) | func (d *recuriveDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *c...
  type unsupportedTypeDecoder (line 283) | type unsupportedTypeDecoder struct
    method FromDom (line 287) | func (d *unsupportedTypeDecoder) FromDom(vp unsafe.Pointer, node Node,...

FILE: internal/decoder/optdec/helper.go
  function SkipNumberFast (line 12) | func SkipNumberFast(json string, start int) (int, bool) {
  function ValidNumberFast (line 31) | func ValidNumberFast(raw string) bool {
  function SkipOneFast (line 45) | func SkipOneFast(json string, pos int) (string, error) {
  function ParseI64 (line 54) | func ParseI64(raw string) (int64, error) {
  function ParseBool (line 62) | func ParseBool(raw string) (bool, error) {
  function ParseU64 (line 71) | func ParseU64(raw string) (uint64, error) {
  function ParseF64 (line 79) | func ParseF64(raw string) (float64, error) {
  function Unquote (line 87) | func Unquote(raw string) (string, error) {

FILE: internal/decoder/optdec/interface.go
  type efaceDecoder (line 12) | type efaceDecoder struct
    method FromDom (line 15) | func (d *efaceDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *cont...
  type ifaceDecoder (line 64) | type ifaceDecoder struct
    method FromDom (line 68) | func (d *ifaceDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *cont...
  type unmarshalTextDecoder (line 102) | type unmarshalTextDecoder struct
    method FromDom (line 106) | func (d *unmarshalTextDecoder) FromDom(vp unsafe.Pointer, node Node, c...
  type unmarshalJSONDecoder (line 136) | type unmarshalJSONDecoder struct
    method FromDom (line 141) | func (d *unmarshalJSONDecoder) FromDom(vp unsafe.Pointer, node Node, c...

FILE: internal/decoder/optdec/map.go
  type mapEfaceDecoder (line 15) | type mapEfaceDecoder struct
    method FromDom (line 18) | func (d *mapEfaceDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *c...
  type mapStringDecoder (line 27) | type mapStringDecoder struct
    method FromDom (line 30) | func (d *mapStringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type mapStrKeyDecoder (line 41) | type mapStrKeyDecoder struct
    method FromDom (line 48) | func (d *mapStrKeyDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type mapI32KeyDecoder (line 86) | type mapI32KeyDecoder struct
    method FromDom (line 92) | func (d *mapI32KeyDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type mapI64KeyDecoder (line 139) | type mapI64KeyDecoder struct
    method FromDom (line 145) | func (d *mapI64KeyDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type mapU32KeyDecoder (line 193) | type mapU32KeyDecoder struct
    method FromDom (line 199) | func (d *mapU32KeyDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type mapU64KeyDecoder (line 244) | type mapU64KeyDecoder struct
    method FromDom (line 250) | func (d *mapU64KeyDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type decKey (line 295) | type decKey
  function decodeKeyU8 (line 297) | func decodeKeyU8(dec *mapDecoder, raw string) (interface{}, error) {
  function decodeKeyU16 (line 312) | func decodeKeyU16(dec *mapDecoder, raw string) (interface{}, error) {
  function decodeKeyI8 (line 327) | func decodeKeyI8(dec *mapDecoder, raw string) (interface{}, error) {
  function decodeKeyI16 (line 342) | func decodeKeyI16(dec *mapDecoder, raw string) (interface{}, error) {
  function decodeKeyTextUnmarshaler (line 357) | func decodeKeyTextUnmarshaler(dec *mapDecoder, raw string) (interface{},...
  function decodeFloat32Key (line 383) | func decodeFloat32Key(dec *mapDecoder, raw string) (interface{}, error) {
  function decodeFloat64Key (line 398) | func decodeFloat64Key(dec *mapDecoder, raw string) (interface{}, error) {
  function decodeJsonNumberKey (line 406) | func decodeJsonNumberKey(dec *mapDecoder, raw string) (interface{}, erro...
  type mapDecoder (line 419) | type mapDecoder struct
    method FromDom (line 425) | func (d *mapDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *contex...

FILE: internal/decoder/optdec/native.go
  type ErrorCode (line 16) | type ErrorCode
    method Error (line 54) | func (code ErrorCode) Error() string {
  constant SONIC_OK (line 19) | SONIC_OK                      = 0
  constant SONIC_CONTROL_CHAR (line 20) | SONIC_CONTROL_CHAR            = 1
  constant SONIC_INVALID_ESCAPED (line 21) | SONIC_INVALID_ESCAPED         = 2
  constant SONIC_INVALID_NUM (line 22) | SONIC_INVALID_NUM             = 3
  constant SONIC_FLOAT_INF (line 23) | SONIC_FLOAT_INF               = 4
  constant SONIC_EOF (line 24) | SONIC_EOF                     = 5
  constant SONIC_INVALID_CHAR (line 25) | SONIC_INVALID_CHAR            = 6
  constant SONIC_EXPECT_KEY (line 26) | SONIC_EXPECT_KEY              = 7
  constant SONIC_EXPECT_COLON (line 27) | SONIC_EXPECT_COLON            = 8
  constant SONIC_EXPECT_OBJ_COMMA_OR_END (line 28) | SONIC_EXPECT_OBJ_COMMA_OR_END = 9
  constant SONIC_EXPECT_ARR_COMMA_OR_END (line 29) | SONIC_EXPECT_ARR_COMMA_OR_END = 10
  constant SONIC_VISIT_FAILED (line 30) | SONIC_VISIT_FAILED            = 11
  constant SONIC_INVALID_ESCAPED_UTF (line 31) | SONIC_INVALID_ESCAPED_UTF     = 12
  constant SONIC_INVALID_LITERAL (line 32) | SONIC_INVALID_LITERAL         = 13
  constant SONIC_STACK_OVERFLOW (line 33) | SONIC_STACK_OVERFLOW          = 14
  type node (line 58) | type node struct
  type _nospaceBlock (line 64) | type _nospaceBlock struct
  type nodeBuf (line 70) | type nodeBuf struct
    method init (line 80) | func (self *nodeBuf) init(nodes []node) {
  type Parser (line 88) | type Parser struct
    method Pos (line 162) | func (p *Parser) Pos() int {
    method JsonBytes (line 166) | func (p *Parser) JsonBytes() []byte {
    method parse (line 181) | func (p *Parser) parse() ErrorCode {
    method reset (line 225) | func (p *Parser) reset() {
    method free (line 243) | func (p *Parser) free() {
    method fixError (line 249) | func (p *Parser) fixError(code ErrorCode) error {
  type jsonStat (line 109) | type jsonStat struct
  function newParser (line 137) | func newParser(data string, pos int, opt uint64) *Parser {
  function calMaxNodeCap (line 177) | func calMaxNodeCap(jsonSize int) int {
  function Parse (line 262) | func Parse(data string, opt uint64) error {

FILE: internal/decoder/optdec/native_test.go
  function TestParseNative (line 11) | func TestParseNative(t *testing.T) {
  function TestParseNativeRetryLargeJson (line 21) | func TestParseNativeRetryLargeJson(t *testing.T) {

FILE: internal/decoder/optdec/node.go
  type Context (line 12) | type Context struct
    method Options (line 19) | func (ctx *Context) Options() uint64 {
    method Delete (line 140) | func (ctx *Context) Delete() {
    method Root (line 157) | func (ctx *Context) Root() Node {
  type parentStat (line 25) | type parentStat struct
  type boundedStack (line 29) | type boundedStack struct
    method Pop (line 42) | func (s *boundedStack) Pop() (unsafe.Pointer, int, bool) {
    method Push (line 53) | func (s *boundedStack) Push(p unsafe.Pointer, remain int, isObj bool) {
  function newStack (line 34) | func newStack(size int) boundedStack {
  type efacePool (line 62) | type efacePool struct
    method GetMap (line 86) | func (self *efacePool) GetMap(hint int) unsafe.Pointer {
    method GetSlice (line 91) | func (self *efacePool) GetSlice(hint int) unsafe.Pointer {
    method ConvTSlice (line 95) | func (self *efacePool) ConvTSlice(val rt.GoSlice, typ *rt.GoType, dst ...
    method ConvF64 (line 99) | func (self *efacePool) ConvF64(val float64, dst unsafe.Pointer) {
    method ConvTstring (line 103) | func (self *efacePool) ConvTstring(val string, dst unsafe.Pointer) {
    method ConvTnum (line 107) | func (self *efacePool) ConvTnum(val json.Number, dst unsafe.Pointer) {
  function newEfacePool (line 69) | func newEfacePool(stat *jsonStat, useNumber bool) *efacePool {
  function canUseFastMap (line 113) | func canUseFastMap(opts uint64, root *rt.GoType) bool {
  function NewContext (line 117) | func NewContext(json string, pos int, opts uint64, root *rt.GoType) (Con...
  type Node (line 145) | type Node struct
    method Type (line 181) | func (val Node) Type() uint8 {
    method Next (line 186) | func (val Node) Next() uintptr {
    method next (line 195) | func (val *Node) next() {
    method U64 (line 217) | func (val Node) U64() uint64 {
    method I64 (line 222) | func (val Node) I64() int64 {
    method IsNull (line 227) | func (val Node) IsNull() bool {
    method IsNumber (line 231) | func (val Node) IsNumber() bool {
    method F64 (line 235) | func (val Node) F64() float64 {
    method Bool (line 240) | func (val Node) Bool() bool {
    method AsU64 (line 244) | func (self Node) AsU64(ctx *Context) (uint64, bool) {
    method AsObj (line 258) | func (val *Node) AsObj() (Object, bool) {
    method Obj (line 268) | func (val Node) Obj() Object {
    method Arr (line 272) | func (val Node) Arr() Array {
    method AsArr (line 276) | func (val *Node) AsArr() (Array, bool) {
    method AsI64 (line 286) | func (self Node) AsI64(ctx *Context) (int64, bool) {
    method AsByte (line 303) | func (self Node) AsByte(ctx *Context) (uint8, bool) {
    method ParseI64 (line 316) | func (val Node) ParseI64(ctx *Context) (int64, bool) {
    method ParseBool (line 333) | func (val Node) ParseBool(ctx *Context) (bool, bool) {
    method ParseU64 (line 350) | func (val Node) ParseU64(ctx *Context) (uint64, bool) {
    method ParseF64 (line 367) | func (val Node) ParseF64(ctx *Context) (float64, bool) {
    method ParseString (line 384) | func (val Node) ParseString(ctx *Context) (string, bool) {
    method ParseNumber (line 402) | func (val Node) ParseNumber(ctx *Context) (json.Number, bool) {
    method AsF64 (line 421) | func (val Node) AsF64(ctx *Context) (float64, bool) {
    method AsBool (line 437) | func (val Node) AsBool() (bool, bool) {
    method AsStr (line 448) | func (val Node) AsStr(ctx *Context) (string, bool) {
    method AsStrRef (line 463) | func (val Node) AsStrRef(ctx *Context) (string, bool) {
    method AsStringText (line 477) | func (val Node) AsStringText(ctx *Context) ([]byte, bool) {
    method IsStr (line 487) | func (val Node) IsStr() bool {
    method IsRawNumber (line 491) | func (val Node) IsRawNumber() bool {
    method Number (line 495) | func (val Node) Number(ctx *Context) json.Number {
    method Raw (line 499) | func (val Node) Raw(ctx *Context) string {
    method Position (line 506) | func (val Node) Position() int {
    method AsNumber (line 511) | func (val Node) AsNumber(ctx *Context) (json.Number, bool) {
    method NonstrAsNumber (line 525) | func (val Node) NonstrAsNumber(ctx *Context) (json.Number, bool) {
    method AsRaw (line 544) | func (val Node) AsRaw(ctx *Context) string {
    method StringRef (line 578) | func (val Node) StringRef(ctx *Context) string {
    method StringCopyEsc (line 587) | func (val Node) StringCopyEsc(ctx *Context) string {
    method Object (line 595) | func (val Node) Object() Object {
    method Array (line 599) | func (val Node) Array() Array {
    method Equal (line 611) | func (val *Node) Equal(ctx *Context, lhs string) bool {
    method AsMapEface (line 619) | func (node *Node) AsMapEface(ctx *Context, vp unsafe.Pointer) error {
    method AsMapString (line 660) | func (node *Node) AsMapString(ctx *Context, vp unsafe.Pointer) error {
    method AsSliceEface (line 696) | func (node *Node) AsSliceEface(ctx *Context, vp unsafe.Pointer) error {
    method AsSliceI32 (line 729) | func (node *Node) AsSliceI32(ctx *Context, vp unsafe.Pointer) error {
    method AsSliceI64 (line 758) | func (node *Node) AsSliceI64(ctx *Context, vp unsafe.Pointer) error {
    method AsSliceU32 (line 788) | func (node *Node) AsSliceU32(ctx *Context, vp unsafe.Pointer) error {
    method AsSliceU64 (line 817) | func (node *Node) AsSliceU64(ctx *Context, vp unsafe.Pointer) error {
    method AsSliceString (line 846) | func (node *Node) AsSliceString(ctx *Context, vp unsafe.Pointer) error {
    method AsSliceBytes (line 875) | func (val *Node) AsSliceBytes(ctx *Context) ([]byte, error) {
    method AsEface (line 912) | func (node *Node) AsEface(ctx *Context) (interface{}, error) {
    method AsEfaceFallback (line 1234) | func (node *Node) AsEfaceFallback(ctx *Context) (interface{}, error) {
  function NewNode (line 149) | func NewNode(cptr uintptr) Node {
  type Dom (line 153) | type Dom struct
  type Array (line 162) | type Array struct
    method Len (line 175) | func (arr Array) Len() int {
    method Children (line 603) | func (val *Array) Children() uintptr {
  type Object (line 166) | type Object struct
    method Len (line 170) | func (obj Object) Len() int {
    method Children (line 607) | func (val *Object) Children() uintptr {
  type NodeIter (line 199) | type NodeIter struct
    method Next (line 207) | func (iter *NodeIter) Next() Node {
    method Peek (line 213) | func (iter *NodeIter) Peek() Node {
  function NewNodeIter (line 203) | func NewNodeIter(node Node) NodeIter {
  function ptrCast (line 583) | func ptrCast(p uintptr) *node {
  function parseSingleNode (line 923) | func parseSingleNode(node Node, ctx *Context) interface{} {
  function castU64 (line 954) | func castU64(val float64) uint64 {
  function AsEfaceFast (line 958) | func AsEfaceFast(iter *NodeIter, ctx *Context) interface{} {
  function PtrOffset (line 1326) | func PtrOffset(ptr uintptr, off int64) uintptr {

FILE: internal/decoder/optdec/slice.go
  type sliceDecoder (line 10) | type sliceDecoder struct
    method FromDom (line 20) | func (d *sliceDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *cont...
  type arrayDecoder (line 50) | type arrayDecoder struct
    method FromDom (line 58) | func (d *arrayDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *cont...
  type sliceEfaceDecoder (line 93) | type sliceEfaceDecoder struct
    method FromDom (line 96) | func (d *sliceEfaceDecoder) FromDom(vp unsafe.Pointer, node Node, ctx ...
  type sliceI32Decoder (line 116) | type sliceI32Decoder struct
    method FromDom (line 119) | func (d *sliceI32Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *c...
  type sliceI64Decoder (line 128) | type sliceI64Decoder struct
    method FromDom (line 131) | func (d *sliceI64Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *c...
  type sliceU32Decoder (line 140) | type sliceU32Decoder struct
    method FromDom (line 143) | func (d *sliceU32Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *c...
  type sliceU64Decoder (line 152) | type sliceU64Decoder struct
    method FromDom (line 155) | func (d *sliceU64Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *c...
  type sliceStringDecoder (line 164) | type sliceStringDecoder struct
    method FromDom (line 167) | func (d *sliceStringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx...
  type sliceBytesDecoder (line 176) | type sliceBytesDecoder struct
    method FromDom (line 179) | func (d *sliceBytesDecoder) FromDom(vp unsafe.Pointer, node Node, ctx ...
  type sliceBytesUnmarshalerDecoder (line 190) | type sliceBytesUnmarshalerDecoder struct
    method FromDom (line 196) | func (d *sliceBytesUnmarshalerDecoder) FromDom(vp unsafe.Pointer, node...

FILE: internal/decoder/optdec/stringopts.go
  type ptrStrDecoder (line 11) | type ptrStrDecoder struct
    method FromDom (line 17) | func (d *ptrStrDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *con...
  type boolStringDecoder (line 40) | type boolStringDecoder struct
    method FromDom (line 43) | func (d *boolStringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx ...
  function parseI64 (line 66) | func parseI64(node Node, ctx *context) (int64, error, bool) {
  type i8StringDecoder (line 84) | type i8StringDecoder struct
    method FromDom (line 86) | func (d *i8StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *c...
  type i16StringDecoder (line 104) | type i16StringDecoder struct
    method FromDom (line 106) | func (d *i16StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type i32StringDecoder (line 124) | type i32StringDecoder struct
    method FromDom (line 126) | func (d *i32StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type i64StringDecoder (line 144) | type i64StringDecoder struct
    method FromDom (line 146) | func (d *i64StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  function parseU64 (line 160) | func parseU64(node Node, ctx *context) (uint64, error, bool) {
  type u8StringDecoder (line 178) | type u8StringDecoder struct
    method FromDom (line 180) | func (d *u8StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *c...
  type u16StringDecoder (line 198) | type u16StringDecoder struct
    method FromDom (line 200) | func (d *u16StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type u32StringDecoder (line 218) | type u32StringDecoder struct
    method FromDom (line 220) | func (d *u32StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type u64StringDecoder (line 238) | type u64StringDecoder struct
    method FromDom (line 240) | func (d *u64StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type f32StringDecoder (line 254) | type f32StringDecoder struct
    method FromDom (line 256) | func (d *f32StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type f64StringDecoder (line 279) | type f64StringDecoder struct
    method FromDom (line 281) | func (d *f64StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type strStringDecoder (line 305) | type strStringDecoder struct
    method FromDom (line 307) | func (d *strStringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *...
  type numberStringDecoder (line 330) | type numberStringDecoder struct
    method FromDom (line 332) | func (d *numberStringDecoder) FromDom(vp unsafe.Pointer, node Node, ct...

FILE: internal/decoder/optdec/structs.go
  type fieldEntry (line 12) | type fieldEntry struct
  type structDecoder (line 17) | type structDecoder struct
    method FromDom (line 24) | func (d *structDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *con...

FILE: internal/decoder/optdec/testdata_test.go
  constant TwitterJson (line 19) | TwitterJson = `{
  type TwitterStruct (line 435) | type TwitterStruct struct
  type Hashtags (line 440) | type Hashtags struct
  type Entities (line 445) | type Entities struct
  type Metadata (line 451) | type Metadata struct
  type Urls (line 456) | type Urls struct
  type URL (line 462) | type URL struct
  type Description (line 466) | type Description struct
  type UserEntities (line 470) | type UserEntities struct
  type User (line 475) | type User struct
  type Statuses (line 517) | type Statuses struct
  type SearchMetadata (line 541) | type SearchMetadata struct

FILE: internal/decoder/optdec/types.go
  function rtype (line 57) | func rtype(t reflect.Type) (*rt.GoItab, *rt.GoType) {

FILE: internal/encoder/alg/mapiter.go
  type _MapPair (line 30) | type _MapPair struct
  type MapIterator (line 36) | type MapIterator struct
    method at (line 68) | func (self *MapIterator) at(i int) *_MapPair {
    method add (line 72) | func (self *MapIterator) add() (p *_MapPair) {
    method data (line 78) | func (self *MapIterator) data() (p []_MapPair) {
    method append (line 83) | func (self *MapIterator) append(t *rt.GoType, k unsafe.Pointer, v unsa...
    method appendGeneric (line 106) | func (self *MapIterator) appendGeneric(p *_MapPair, t *rt.GoType, v re...
    method appendConcrete (line 153) | func (self *MapIterator) appendConcrete(p *_MapPair, t *rt.GoType, k u...
    method appendInterface (line 180) | func (self *MapIterator) appendInterface(p *_MapPair, t *rt.GoType, k ...
  function init (line 47) | func init() {
  function newIterator (line 53) | func newIterator() *MapIterator {
  function resetIterator (line 61) | func resetIterator(p *MapIterator) *MapIterator {
  function IteratorStop (line 188) | func IteratorStop(p *MapIterator) {
  function IteratorNext (line 192) | func IteratorNext(p *MapIterator) {
  function IteratorStart (line 215) | func IteratorStart(t *rt.GoMapType, m unsafe.Pointer, fv uint64) (*MapIt...
  function asText (line 250) | func asText(v unsafe.Pointer) (string, error) {
  function IsValidNumber (line 256) | func IsValidNumber(s string) bool {

FILE: internal/encoder/alg/opts.go
  constant BitSortMapKeys (line 20) | BitSortMapKeys = iota
  constant BitEscapeHTML (line 21) | BitEscapeHTML
  constant BitCompactMarshaler (line 22) | BitCompactMarshaler
  constant BitNoQuoteTextMarshaler (line 23) | BitNoQuoteTextMarshaler
  constant BitNoNullSliceOrMap (line 24) | BitNoNullSliceOrMap
  constant BitValidateString (line 25) | BitValidateString
  constant BitNoValidateJSONMarshaler (line 26) | BitNoValidateJSONMarshaler
  constant BitNoEncoderNewline (line 27) | BitNoEncoderNewline
  constant BitEncodeNullForInfOrNan (line 28) | BitEncodeNullForInfOrNan
  constant BitPointerValue (line 30) | BitPointerValue = 63

FILE: internal/encoder/alg/sort.go
  function radixQsort (line 21) | func radixQsort(kvs []_MapPair, d, maxDepth int) {
  function insertRadixSort (line 86) | func insertRadixSort(kvs []_MapPair, d int) {
  function pivot (line 94) | func pivot(kvs []_MapPair, d int) int {
  function medianThree (line 109) | func medianThree(i, j, k int) int {
  function maxThree (line 122) | func maxThree(i, j, k int) int {
  function maxDepth (line 135) | func maxDepth(n int) int {
  function siftDown (line 145) | func siftDown(kvs []_MapPair, lo, hi, first int) {
  function heapSort (line 163) | func heapSort(kvs []_MapPair, a, b int) {
  function swap (line 181) | func swap(kvs []_MapPair, a, b int) {
  function lessFrom (line 187) | func lessFrom(a, b string, d int) bool {
  function byteAt (line 201) | func byteAt(b string, p int) int {

FILE: internal/encoder/alg/sort_test.go
  type encodedKeyValues (line 31) | type encodedKeyValues
    method Len (line 37) | func (sv encodedKeyValues) Len() int           { return len(sv) }
    method Swap (line 38) | func (sv encodedKeyValues) Swap(i, j int)      { sv[i], sv[j] = sv[j],...
    method Less (line 39) | func (sv encodedKeyValues) Less(i, j int) bool { return sv[i].key < sv...
  type encodedKV (line 32) | type encodedKV struct
  function getKvs (line 41) | func getKvs(std bool) interface{} {
  function BenchmarkSort_Sonic (line 62) | func BenchmarkSort_Sonic(b *testing.B) {
  function BenchmarkSort_Std (line 72) | func BenchmarkSort_Std(b *testing.B) {
  function BenchmarkSort_Parallel_Sonic (line 82) | func BenchmarkSort_Parallel_Sonic(b *testing.B) {
  function BenchmarkSort_Parallel_Std (line 94) | func BenchmarkSort_Parallel_Std(b *testing.B) {
  type kvSlice (line 106) | type kvSlice
    method Less (line 109) | func (self kvSlice) Less(i, j int) bool { return self[i].k < self[j].k }
    method Swap (line 110) | func (self kvSlice) Swap(i, j int)      { self[i], self[j] = self[j], ...
    method Len (line 111) | func (self kvSlice) Len() int           { return len(self) }
    method Sort (line 114) | func (self kvSlice) Sort() {
    method String (line 118) | func (self kvSlice) String() string {
  function TestSort_SortRandomKeys (line 129) | func TestSort_SortRandomKeys(t *testing.T) {
  function genKey (line 144) | func genKey(kl int) []byte {
  function getRandKvs (line 154) | func getRandKvs(kn int, kl int) kvSlice {

FILE: internal/encoder/alg/spec.go
  function Valid (line 37) | func Valid(data []byte) (ok bool, start int) {
  function Quote (line 64) | func Quote(buf []byte, val string, double bool) []byte {
  function HtmlEscape (line 124) | func HtmlEscape(dst []byte, src []byte) []byte {
  function F64toa (line 157) | func F64toa(buf []byte, v float64) []byte {
  function F32toa (line 170) | func F32toa(buf []byte, v float32) []byte {
  function I64toa (line 183) | func I64toa(buf []byte, v int64) []byte {
  function U64toa (line 187) | func U64toa(buf []byte, v uint64) []byte {

FILE: internal/encoder/alg/spec_compat.go
  function Valid (line 37) | func Valid(data []byte) (ok bool, start int) {
  function Quote (line 44) | func Quote(e []byte, s string, double bool) []byte {
  function HtmlEscape (line 125) | func HtmlEscape(dst []byte, src []byte) []byte {
  function F64toa (line 131) | func F64toa(buf []byte, v float64) []byte {
  function F32toa (line 137) | func F32toa(buf []byte, v float32) []byte {
  function I64toa (line 143) | func I64toa(buf []byte, v int64) []byte {
  function U64toa (line 147) | func U64toa(buf []byte, v uint64) []byte {

FILE: internal/encoder/alg/spec_test.go
  function BenchmarkU64toa (line 31) | func BenchmarkU64toa(b *testing.B) {
  function BenchmarkI64toa (line 51) | func BenchmarkI64toa(b *testing.B) {
  function BenchmarkF64toa (line 71) | func BenchmarkF64toa(b *testing.B) {
  function BenchmarkF32toa (line 92) | func BenchmarkF32toa(b *testing.B) {
  function BenchmarkQuote (line 113) | func BenchmarkQuote(b *testing.B) {
  function BenchmarkValid (line 141) | func BenchmarkValid(b *testing.B) {
  function BenchmarkEscapeHTML (line 165) | func BenchmarkEscapeHTML(b *testing.B) {
  function TestQuote (line 190) | func TestQuote(t *testing.T) {

FILE: internal/encoder/compiler.go
  function ForceUseVM (line 31) | func ForceUseVM() {
  function makeEncoderVM (line 40) | func makeEncoderVM(vt *rt.GoType, ex ...interface{}) (interface{}, error) {
  function pretouchTypeVM (line 50) | func pretouchTypeVM(_vt reflect.Type, opts option.CompileOptions, v uint...
  function pretouchRec (line 72) | func pretouchRec(vtm map[reflect.Type]uint8, opts option.CompileOptions)...
  type Compiler (line 90) | type Compiler struct
    method apply (line 105) | func (self *Compiler) apply(opts option.CompileOptions) *Compiler {
    method rescue (line 113) | func (self *Compiler) rescue(ep *error) {
    method Compile (line 123) | func (self *Compiler) Compile(vt reflect.Type, pv bool) (ret ir.Progra...
    method compileOne (line 129) | func (self *Compiler) compileOne(p *ir.Program, sp int, vt reflect.Typ...
    method tryCompileMarshaler (line 137) | func (self *Compiler) tryCompileMarshaler(p *ir.Program, vt reflect.Ty...
    method compileRec (line 167) | func (self *Compiler) compileRec(p *ir.Program, sp int, vt reflect.Typ...
    method compileOps (line 184) | func (self *Compiler) compileOps(p *ir.Program, sp int, vt reflect.Typ...
    method compileNil (line 233) | func (self *Compiler) compileNil(p *ir.Program, sp int, vt reflect.Typ...
    method compilePtr (line 244) | func (self *Compiler) compilePtr(p *ir.Program, sp int, vt reflect.Typ...
    method compilePtrBody (line 248) | func (self *Compiler) compilePtrBody(p *ir.Program, sp int, vt reflect...
    method compileMap (line 256) | func (self *Compiler) compileMap(p *ir.Program, sp int, vt reflect.Typ...
    method compileMapBody (line 260) | func (self *Compiler) compileMapBody(p *ir.Program, sp int, vt reflect...
    method compileMapBodyKey (line 296) | func (self *Compiler) compileMapBodyKey(p *ir.Program, vk reflect.Type) {
    method compileMapBodyTextKey (line 310) | func (self *Compiler) compileMapBodyTextKey(p *ir.Program, vk reflect....
    method compileMapBodyUtextKey (line 349) | func (self *Compiler) compileMapBodyUtextKey(p *ir.Program, vk reflect...
    method compileMapBodyUtextPtr (line 357) | func (self *Compiler) compileMapBodyUtextPtr(p *ir.Program, vk reflect...
    method compileSlice (line 368) | func (self *Compiler) compileSlice(p *ir.Program, sp int, vt reflect.T...
    method compileSliceBody (line 372) | func (self *Compiler) compileSliceBody(p *ir.Program, sp int, vt refle...
    method compileSliceArray (line 380) | func (self *Compiler) compileSliceArray(p *ir.Program, sp int, vt refl...
    method compileArray (line 402) | func (self *Compiler) compileArray(p *ir.Program, sp int, vt reflect.T...
    method compileString (line 426) | func (self *Compiler) compileString(p *ir.Program, vt reflect.Type) {
    method compileStruct (line 434) | func (self *Compiler) compileStruct(p *ir.Program, sp int, vt reflect....
    method compileStructBody (line 449) | func (self *Compiler) compileStructBody(p *ir.Program, sp int, vt refl...
    method compileStructFieldStr (line 522) | func (self *Compiler) compileStructFieldStr(p *ir.Program, sp int, vt ...
    method compileStructFieldEmpty (line 603) | func (self *Compiler) compileStructFieldEmpty(p *ir.Program, vt reflec...
    method compileStructFieldOmitNilPtr (line 648) | func (self *Compiler) compileStructFieldOmitNilPtr(p *ir.Program, vt r...
    method compileStructFieldQuoted (line 667) | func (self *Compiler) compileStructFieldQuoted(p *ir.Program, sp int, ...
    method compileInterface (line 673) | func (self *Compiler) compileInterface(p *ir.Program, vt reflect.Type) {
    method compileUnsupportedType (line 692) | func (self *Compiler) compileUnsupportedType(p *ir.Program, vt reflect...
    method compileMarshaler (line 696) | func (self *Compiler) compileMarshaler(p *ir.Program, op ir.Op, vt ref...
  function NewCompiler (line 97) | func NewCompiler() *Compiler {
  function addMarshalerOp (line 717) | func addMarshalerOp(p *ir.Program, op ir.Op, vt reflect.Type, mt reflect...

FILE: internal/encoder/compiler_test.go
  function TestCompiler_Compile (line 29) | func TestCompiler_Compile(t *testing.T) {
  function TestReflectDirect (line 35) | func TestReflectDirect(t *testing.T) {
  function TestPretouchTypeVM (line 53) | func TestPretouchTypeVM(t *testing.T) {

FILE: internal/encoder/encode_norace.go
  function encodeIntoCheckRace (line 22) | func encodeIntoCheckRace(buf *[]byte, val interface{}, opts Options) err...

FILE: internal/encoder/encode_race.go
  function helpDetectDataRace (line 28) | func helpDetectDataRace(val interface{}) {
  function encodeIntoCheckRace (line 40) | func encodeIntoCheckRace(buf *[]byte, val interface{}, opts Options) err...
  function truncate (line 47) | func truncate(json []byte) string {

FILE: internal/encoder/encoder.go
  type Options (line 34) | type Options
  constant SortMapKeys (line 40) | SortMapKeys Options = 1 << alg.BitSortMapKeys
  constant EscapeHTML (line 45) | EscapeHTML Options = 1 << alg.BitEscapeHTML
  constant CompactMarshaler (line 49) | CompactMarshaler Options = 1 << alg.BitCompactMarshaler
  constant NoQuoteTextMarshaler (line 53) | NoQuoteTextMarshaler Options = 1 << alg.BitNoQuoteTextMarshaler
  constant NoNullSliceOrMap (line 58) | NoNullSliceOrMap Options = 1 << alg.BitNoNullSliceOrMap
  constant ValidateString (line 62) | ValidateString Options = 1 << alg.BitValidateString
  constant NoValidateJSONMarshaler (line 66) | NoValidateJSONMarshaler Options = 1 << alg.BitNoValidateJSONMarshaler
  constant NoEncoderNewline (line 69) | NoEncoderNewline Options = 1 << alg.BitNoEncoderNewline
  constant CompatibleWithStd (line 72) | CompatibleWithStd Options = SortMapKeys | EscapeHTML | CompactMarshaler
  constant EncodeNullForInfOrNan (line 75) | EncodeNullForInfOrNan Options = 1 << alg.BitEncodeNullForInfOrNan
  type Encoder (line 79) | type Encoder struct
    method Encode (line 86) | func (self *Encoder) Encode(v interface{}) ([]byte, error) {
    method SortKeys (line 94) | func (self *Encoder) SortKeys() *Encoder {
    method SetEscapeHTML (line 100) | func (self *Encoder) SetEscapeHTML(f bool) {
    method SetValidateString (line 109) | func (self *Encoder) SetValidateString(f bool) {
    method SetNoValidateJSONMarshaler (line 118) | func (self *Encoder) SetNoValidateJSONMarshaler(f bool) {
    method SetNoEncoderNewline (line 127) | func (self *Encoder) SetNoEncoderNewline(f bool) {
    method SetCompactMarshaler (line 136) | func (self *Encoder) SetCompactMarshaler(f bool) {
    method SetNoQuoteTextMarshaler (line 145) | func (self *Encoder) SetNoQuoteTextMarshaler(f bool) {
    method SetIndent (line 156) | func (enc *Encoder) SetIndent(prefix, indent string) {
  function Quote (line 162) | func Quote(s string) string {
  function Encode (line 169) | func Encode(val interface{}, opts Options) ([]byte, error) {
  function EncodeInto (line 199) | func EncodeInto(buf *[]byte, val interface{}, opts Options) error {
  function encodeInto (line 208) | func encodeInto(buf *[]byte, val interface{}, opts Options) error {
  function encodeFinish (line 225) | func encodeFinish(buf []byte, opts Options) []byte {
  function encodeFinishWithPool (line 235) | func encodeFinishWithPool(buf *[]byte, opts Options) {
  function HTMLEscape (line 256) | func HTMLEscape(dst []byte, src []byte) []byte {
  function EncodeIndented (line 263) | func EncodeIndented(val interface{}, prefix string, indent string, opts ...
  function Pretouch (line 307) | func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
  function Valid (line 320) | func Valid(data []byte) (ok bool, start int) {

FILE: internal/encoder/encoder_norace_test.go
  function TestGC (line 30) | func TestGC(t *testing.T) {

FILE: internal/encoder/encoder_test.go
  function TestMain (line 37) | func TestMain(m *testing.M) {
  function TestEncoderMemoryCorruption (line 54) | func TestEncoderMemoryCorruption(t *testing.T) {
  function TestEncoderPanicString (line 75) | func TestEncoderPanicString(t *testing.T) {
  type sample (line 93) | type sample struct
  function TestOptionSliceOrMapNoNull (line 102) | func TestOptionSliceOrMapNoNull(t *testing.T) {
  function BenchmarkOptionSliceOrMapNoNull (line 118) | func BenchmarkOptionSliceOrMapNoNull(b *testing.B) {
  function runEncoderTest (line 143) | func runEncoderTest(t *testing.T, fn func(string) string, exp string, ar...
  function TestEncoder_String (line 147) | func TestEncoder_String(t *testing.T) {
  type StringStruct (line 158) | type StringStruct struct
  function TestEncoder_FieldStringize (line 165) | func TestEncoder_FieldStringize(t *testing.T) {
  function TestEncodeErrorAndScratchBuf (line 173) | func TestEncodeErrorAndScratchBuf(t *testing.T) {
  type MarshalerImpl (line 185) | type MarshalerImpl struct
    method MarshalJSON (line 189) | func (self *MarshalerImpl) MarshalJSON() ([]byte, error) {
  type MarshalerStruct (line 194) | type MarshalerStruct struct
  function TestEncoder_Marshaler (line 198) | func TestEncoder_Marshaler(t *testing.T) {
  type MarshalerErrorStruct (line 215) | type MarshalerErrorStruct struct
    method MarshalJSON (line 219) | func (self *MarshalerErrorStruct) MarshalJSON() ([]byte, error) {
  function TestMarshalerError (line 223) | func TestMarshalerError(t *testing.T) {
  type RawMessageStruct (line 233) | type RawMessageStruct struct
  function TestEncoder_RawMessage (line 237) | func TestEncoder_RawMessage(t *testing.T) {
  type TextMarshalerImpl (line 250) | type TextMarshalerImpl struct
    method MarshalText (line 254) | func (self *TextMarshalerImpl) MarshalText() ([]byte, error) {
  type TextMarshalerImplV (line 258) | type TextMarshalerImplV struct
    method MarshalText (line 262) | func (self TextMarshalerImplV) MarshalText() ([]byte, error) {
  type TextMarshalerStruct (line 266) | type TextMarshalerStruct struct
  function TestEncoder_TextMarshaler (line 270) | func TestEncoder_TextMarshaler(t *testing.T) {
  function TestTextMarshalTextKey_SortKeys (line 287) | func TestTextMarshalTextKey_SortKeys(t *testing.T) {
  function TestEncoder_Marshal_EscapeHTML (line 316) | func TestEncoder_Marshal_EscapeHTML(t *testing.T) {
  function TestEncoder_EscapeHTML (line 338) | func TestEncoder_EscapeHTML(t *testing.T) {
  function TestEncoder_Marshal_EscapeHTML_LargeJson (line 353) | func TestEncoder_Marshal_EscapeHTML_LargeJson(t *testing.T) {
  function init (line 364) | func init() {
  function TestEncoder_Generic (line 369) | func TestEncoder_Generic(t *testing.T) {
  function TestEncoder_Binding (line 377) | func TestEncoder_Binding(t *testing.T) {
  function TestEncoder_MapSortKey (line 385) | func TestEncoder_MapSortKey(t *testing.T) {
  function BenchmarkEncoder_Generic_Sonic (line 399) | func BenchmarkEncoder_Generic_Sonic(b *testing.B) {
  function BenchmarkEncoder_Generic_Sonic_Fast (line 408) | func BenchmarkEncoder_Generic_Sonic_Fast(b *testing.B) {
  function BenchmarkEncoder_Generic_StdLib (line 417) | func BenchmarkEncoder_Generic_StdLib(b *testing.B) {
  function BenchmarkEncoder_Binding_Sonic (line 426) | func BenchmarkEncoder_Binding_Sonic(b *testing.B) {
  function BenchmarkEncoder_Binding_Sonic_Fast (line 435) | func BenchmarkEncoder_Binding_Sonic_Fast(b *testing.B) {
  function BenchmarkEncoder_Binding_StdLib (line 444) | func BenchmarkEncoder_Binding_StdLib(b *testing.B) {
  function BenchmarkEncoder_Parallel_Generic_Sonic (line 453) | func BenchmarkEncoder_Parallel_Generic_Sonic(b *testing.B) {
  function BenchmarkEncoder_Parallel_Generic_Sonic_Fast (line 464) | func BenchmarkEncoder_Parallel_Generic_Sonic_Fast(b *testing.B) {
  function BenchmarkEncoder_Parallel_Generic_StdLib (line 475) | func BenchmarkEncoder_Parallel_Generic_StdLib(b *testing.B) {
  function BenchmarkEncoder_Parallel_Binding_Sonic (line 486) | func BenchmarkEncoder_Parallel_Binding_Sonic(b *testing.B) {
  function BenchmarkEncoder_Parallel_Binding_Sonic_Fast (line 497) | func BenchmarkEncoder_Parallel_Binding_Sonic_Fast(b *testing.B) {
  function BenchmarkEncoder_Parallel_Binding_StdLib (line 508) | func BenchmarkEncoder_Parallel_Binding_StdLib(b *testing.B) {
  function BenchmarkHTMLEscape_Sonic (line 519) | func BenchmarkHTMLEscape_Sonic(b *testing.B) {
  function BenchmarkHTMLEscape_StdLib (line 530) | func BenchmarkHTMLEscape_StdLib(b *testing.B) {
  function BenchmarkValidate_Sonic (line 543) | func BenchmarkValidate_Sonic(b *testing.B) {
  function BenchmarkValidate_Std (line 556) | func BenchmarkValidate_Std(b *testing.B) {
  function BenchmarkCompact_Std (line 568) | func BenchmarkCompact_Std(b *testing.B) {
  type f64Bench (line 582) | type f64Bench struct
  function BenchmarkEncode_Float64 (line 587) | func BenchmarkEncode_Float64(b *testing.B) {
  type f32Bench (line 632) | type f32Bench struct
  function BenchmarkEncode_Float32 (line 637) | func BenchmarkEncode_Float32(b *testing.B) {

FILE: internal/encoder/ir/op.go
  type Op (line 31) | type Op
    method String (line 150) | func (self Op) String() string {
  constant OP_null (line 34) | OP_null Op = iota + 1
  constant OP_empty_arr (line 35) | OP_empty_arr
  constant OP_empty_obj (line 36) | OP_empty_obj
  constant OP_bool (line 37) | OP_bool
  constant OP_i8 (line 38) | OP_i8
  constant OP_i16 (line 39) | OP_i16
  constant OP_i32 (line 40) | OP_i32
  constant OP_i64 (line 41) | OP_i64
  constant OP_u8 (line 42) | OP_u8
  constant OP_u16 (line 43) | OP_u16
  constant OP_u32 (line 44) | OP_u32
  constant OP_u64 (line 45) | OP_u64
  constant OP_f32 (line 46) | OP_f32
  constant OP_f64 (line 47) | OP_f64
  constant OP_str (line 48) | OP_str
  constant OP_bin (line 49) | OP_bin
  constant OP_quote (line 50) | OP_quote
  constant OP_number (line 51) | OP_number
  constant OP_eface (line 52) | OP_eface
  constant OP_iface (line 53) | OP_iface
  constant OP_byte (line 54) | OP_byte
  constant OP_text (line 55) | OP_text
  constant OP_deref (line 56) | OP_deref
  constant OP_index (line 57) | OP_index
  constant OP_load (line 58) | OP_load
  constant OP_save (line 59) | OP_save
  constant OP_drop (line 60) | OP_drop
  constant OP_drop_2 (line 61) | OP_drop_2
  constant OP_recurse (line 62) | OP_recurse
  constant OP_is_nil (line 63) | OP_is_nil
  constant OP_is_nil_p1 (line 64) | OP_is_nil_p1
  constant OP_is_zero_1 (line 65) | OP_is_zero_1
  constant OP_is_zero_2 (line 66) | OP_is_zero_2
  constant OP_is_zero_4 (line 67) | OP_is_zero_4
  constant OP_is_zero_8 (line 68) | OP_is_zero_8
  constant OP_is_zero_map (line 69) | OP_is_zero_map
  constant OP_goto (line 70) | OP_goto
  constant OP_map_iter (line 71) | OP_map_iter
  constant OP_map_stop (line 72) | OP_map_stop
  constant OP_map_check_key (line 73) | OP_map_check_key
  constant OP_map_write_key (line 74) | OP_map_write_key
  constant OP_map_value_next (line 75) | OP_map_value_next
  constant OP_slice_len (line 76) | OP_slice_len
  constant OP_slice_next (line 77) | OP_slice_next
  constant OP_marshal (line 78) | OP_marshal
  constant OP_marshal_p (line 79) | OP_marshal_p
  constant OP_marshal_text (line 80) | OP_marshal_text
  constant OP_marshal_text_p (line 81) | OP_marshal_text_p
  constant OP_cond_set (line 82) | OP_cond_set
  constant OP_cond_testc (line 83) | OP_cond_testc
  constant OP_unsupported (line 84) | OP_unsupported
  constant OP_is_zero (line 85) | OP_is_zero
  constant _INT_SIZE (line 89) | _INT_SIZE = 32 << (^uint(0) >> 63)
  constant _PTR_SIZE (line 90) | _PTR_SIZE = 32 << (^uintptr(0) >> 63)
  constant _PTR_BYTE (line 91) | _PTR_BYTE = unsafe.Sizeof(uintptr(0))
  constant OpSize (line 94) | OpSize = unsafe.Sizeof(NewInsOp(0))
  function OP_int (line 158) | func OP_int() Op {
  function OP_uint (line 169) | func OP_uint() Op {
  function OP_uintptr (line 180) | func OP_uintptr() Op {
  function OP_is_zero_ints (line 191) | func OP_is_zero_ints() Op {
  type Instr (line 202) | type Instr struct
    method Op (line 270) | func (self Instr) Op() Op {
    method Vi (line 274) | func (self Instr) Vi() int {
    method Vf (line 278) | func (self Instr) Vf() uint8 {
    method VField (line 282) | func (self Instr) VField() *resolver.FieldMeta {
    method Vs (line 286) | func (self Instr) Vs() (v string) {
    method Vk (line 292) | func (self Instr) Vk() reflect.Kind {
    method GoType (line 296) | func (self Instr) GoType() *rt.GoType {
    method Vt (line 300) | func (self Instr) Vt() reflect.Type {
    method Vr (line 304) | func (self Instr) Vr() *rt.GoType {
    method Vp (line 308) | func (self Instr) Vp() (vt reflect.Type, pv bool) {
    method Vtab (line 312) | func (self Instr) Vtab() (vt *rt.GoType, itab *rt.GoItab) {
    method Vp2 (line 317) | func (self Instr) Vp2() (vt *rt.GoType, pv bool) {
    method I64 (line 321) | func (self Instr) I64() int64 {
    method Byte (line 325) | func (self Instr) Byte() byte {
    method Vlen (line 329) | func (self Instr) Vlen() int {
    method isBranch (line 333) | func (self Instr) isBranch() bool {
    method Disassemble (line 362) | func (self Instr) Disassemble() string {
  function NewInsOp (line 208) | func NewInsOp(op Op) Instr {
  function NewInsVi (line 212) | func NewInsVi(op Op, vi int) Instr {
  function NewInsVs (line 216) | func NewInsVs(op Op, vs string) Instr {
  function NewInsVt (line 224) | func NewInsVt(op Op, vt reflect.Type) Instr {
  type typAndTab (line 231) | type typAndTab struct
  type typAndField (line 236) | type typAndField struct
  function NewInsVtab (line 241) | func NewInsVtab(op Op, vt reflect.Type, itab *rt.GoItab) Instr {
  function NewInsField (line 251) | func NewInsField(op Op, fv *resolver.FieldMeta) Instr {
  function NewInsVp (line 258) | func NewInsVp(op Op, vt reflect.Type, pv bool) Instr {
  type Program (line 413) | type Program
    method PC (line 416) | func (self Program) PC() int {
    method Tag (line 420) | func (self Program) Tag(n int) {
    method Pin (line 426) | func (self Program) Pin(i int) {
    method Rel (line 431) | func (self Program) Rel(v []int) {
    method Add (line 437) | func (self *Program) Add(op Op) {
    method Key (line 441) | func (self *Program) Key(op Op) {
    method Int (line 449) | func (self *Program) Int(op Op, vi int) {
    method Str (line 453) | func (self *Program) Str(op Op, vs string) {
    method Rtt (line 457) | func (self *Program) Rtt(op Op, vt reflect.Type) {
    method Vp (line 461) | func (self *Program) Vp(op Op, vt reflect.Type, pv bool) {
    method Vtab (line 465) | func (self *Program) Vtab(op Op, vt reflect.Type, itab *rt.GoItab) {
    method VField (line 469) | func (self *Program) VField(op Op, fv *resolver.FieldMeta) {
    method Disassemble (line 473) | func (self Program) Disassemble() string {

FILE: internal/encoder/omitzero_test.go
  type NonZeroStruct (line 29) | type NonZeroStruct struct
    method IsZero (line 31) | func (nzs NonZeroStruct) IsZero() bool {
  type NoPanicStruct (line 35) | type NoPanicStruct struct
    method IsZero (line 39) | func (nps *NoPanicStruct) IsZero() bool {
  type isZeroer (line 43) | type isZeroer interface
  type OptionalsZero (line 47) | type OptionalsZero struct
  function TestOmitZero (line 90) | func TestOmitZero(t *testing.T) {
  function TestOmitZeroMap (line 133) | func TestOmitZeroMap(t *testing.T) {
  type OptionalsEmptyZero (line 159) | type OptionalsEmptyZero struct
  function TestOmitEmptyZero (line 189) | func TestOmitEmptyZero(t *testing.T) {
  function indentNewlines (line 215) | func indentNewlines(s string) string {

FILE: internal/encoder/pools_amd64.go
  function ForceUseJit (line 29) | func ForceUseJit() {
  function init (line 36) | func init() {
  function makeEncoderX86 (line 53) | func makeEncoderX86(vt *rt.GoType, ex ...interface{}) (interface{}, erro...
  function pretouchTypeX86 (line 63) | func pretouchTypeX86(_vt reflect.Type, opts option.CompileOptions, v uin...

FILE: internal/encoder/pools_amd64_test.go
  function TestPretouchTypeX86 (line 14) | func TestPretouchTypeX86(t *testing.T) {

FILE: internal/encoder/pools_compt.go
  function init (line 22) | func init() {

FILE: internal/encoder/prim/primitives.go
  function Compact (line 31) | func Compact(p *[]byte, v []byte) error {
  function EncodeNil (line 49) | func EncodeNil(rb *[]byte) error {
  function EncodeJsonMarshaler (line 70) | func EncodeJsonMarshaler(buf *[]byte, val json.Marshaler, opt uint64) er...
  function EncodeTextMarshaler (line 87) | func EncodeTextMarsha
Copy disabled (too large) Download .json
Condensed preview — 710 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (18,920K chars).
[
  {
    "path": ".codespellrc",
    "chars": 248,
    "preview": "[codespell]\n# ignore test files, go project names, binary files via `skip` and special var/regex via `ignore-words`\nskip"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 655,
    "preview": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the b"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "chars": 599,
    "preview": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your fea"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "chars": 2046,
    "preview": "#### What type of PR is this?\n<!--\nAdd one of the following kinds:\n\nbuild: Changes that affect the build system or exter"
  },
  {
    "path": ".github/workflows/.ignore_words",
    "chars": 41,
    "preview": "socio-economic\nnd\nregArgs\noders\nure\nalse\n"
  },
  {
    "path": ".github/workflows/benchmark.yml",
    "chars": 2238,
    "preview": "name: Benchmark\n\non: pull_request\n\njobs:\n  build:\n    strategy:\n      matrix:\n        os: [ubuntu-latest, ubuntu-24.04-a"
  },
  {
    "path": ".github/workflows/compatibility_test-windows.yml",
    "chars": 849,
    "preview": "name: Compatibility Test Windows-X64\n\non: pull_request\n\njobs:\n  build:\n    strategy:\n      matrix:\n        go-version: ["
  },
  {
    "path": ".github/workflows/compatibility_test.yml",
    "chars": 1209,
    "preview": "name: Compatibility Test Linux-X64|ARM & macOS-ARM\n\non: pull_request\n\njobs:\n  build:\n    strategy:\n      matrix:\n       "
  },
  {
    "path": ".github/workflows/fuzzing.yml",
    "chars": 829,
    "preview": "name: Fuzz Test Linux-X64\n\non: pull_request\n\njobs:\n  build:\n    strategy:\n        max-parallel: 2\n        matrix:\n      "
  },
  {
    "path": ".github/workflows/lint.yml",
    "chars": 418,
    "preview": "name: Lint\n\non: pull_request\n\njobs:\n  misc:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n    "
  },
  {
    "path": ".github/workflows/test-arm64.yml",
    "chars": 1429,
    "preview": "\nname: Unit Test\n\non: pull_request\n\njobs:\n  build:\n    permissions:\n      contents: read\n      id-token: write\n\n    stra"
  },
  {
    "path": ".github/workflows/test-x86.yml",
    "chars": 2079,
    "preview": "\nname: Unit Test\n\non: pull_request\n\njobs:\n  build:\n    permissions:\n      contents: read\n      id-token: write\n\n    stra"
  },
  {
    "path": ".gitignore",
    "chars": 538,
    "preview": "*.o\n*.swp\n*.swm\n*.swn\n*.a\n*.so\n_obj\n_test\n*.[568vq]\n[568vq].out\n*.cgo1.go\n*.cgo2.c\n_cgo_defun.c\n_cgo_gotypes.go\n_cgo_exp"
  },
  {
    "path": ".gitmodules",
    "chars": 307,
    "preview": "[submodule \"cloudwego\"]\n\tpath = tools/asm2asm\n\turl = https://github.com/cloudwego/asm2asm.git\n[submodule \"tools/simde\"]\n"
  },
  {
    "path": ".licenserc.yaml",
    "chars": 999,
    "preview": "header:\n  license:\n    spdx-id: Apache-2.0\n    copyright-owner: ByteDance Inc.\n\n  paths:\n    - '**/*.go'\n    - '**/*.s'\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 5227,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 3680,
    "preview": "# How to Contribute\n\n## Your First Pull Request\nWe use GitHub for our codebase. You can start by reading [How To Pull Re"
  },
  {
    "path": "CREDITS",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "README.md",
    "chars": 26007,
    "preview": "# Sonic\n\nEnglish | [中文](README_ZH_CN.md)\n\nA blazingly fast JSON serializing &amp; deserializing library, accelerated by "
  },
  {
    "path": "README_ZH_CN.md",
    "chars": 20236,
    "preview": "# Sonic\n\n[English](README.md) | 中文\n\n一个速度奇快的 JSON 序列化/反序列化库,由 JIT (即时编译)和 SIMD (单指令流多数据流)加速。\n\n## 依赖\n\n- Go: 1.18~1.25\n  - "
  },
  {
    "path": "api.go",
    "chars": 9577,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "api_test.go",
    "chars": 1407,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/api.go",
    "chars": 2533,
    "preview": "//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)\n// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1"
  },
  {
    "path": "ast/api_compat.go",
    "chars": 2337,
    "preview": "//go:build (!amd64 && !arm64) || go1.27 || !go1.17 || (arm64 && !go1.20)\n// +build !amd64,!arm64 go1.27 !go1.17 arm64,!g"
  },
  {
    "path": "ast/api_native_test.go",
    "chars": 5654,
    "preview": "//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)\n// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1"
  },
  {
    "path": "ast/asm.s",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "ast/buffer.go",
    "chars": 9066,
    "preview": "/**\n * Copyright 2023 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may no"
  },
  {
    "path": "ast/buffer_test.go",
    "chars": 4732,
    "preview": "/**\n * Copyright 2023 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may no"
  },
  {
    "path": "ast/decode.go",
    "chars": 12137,
    "preview": "/*\n * Copyright 2022 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/decode_test.go",
    "chars": 2255,
    "preview": "/*\n * Copyright 2022 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/encode.go",
    "chars": 5674,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/encode_test.go",
    "chars": 10249,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/error.go",
    "chars": 2281,
    "preview": "package ast\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"unsafe\"\n\n\t\"github.com/bytedance/sonic/internal/native/types\"\n)\n\nfunc newError("
  },
  {
    "path": "ast/iterator.go",
    "chars": 4693,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/iterator_test.go",
    "chars": 6632,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/node.go",
    "chars": 45097,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/node_test.go",
    "chars": 51202,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/parser.go",
    "chars": 16056,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/parser_test.go",
    "chars": 11920,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/search.go",
    "chars": 4279,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/search_test.go",
    "chars": 12884,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/stubs.go",
    "chars": 778,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/testdata_test.go",
    "chars": 19320,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/visitor.go",
    "chars": 8843,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "ast/visitor_test.go",
    "chars": 19041,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "compat.go",
    "chars": 3880,
    "preview": "//go:build (!amd64 && !arm64) || go1.27 || !go1.17 || (arm64 && !go1.20)\n// +build !amd64,!arm64 go1.27 !go1.17 arm64,!g"
  },
  {
    "path": "compat_test.go",
    "chars": 6293,
    "preview": "/*\n * Copyright 2022 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "decode_test.go",
    "chars": 78381,
    "preview": "//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)\n// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1"
  },
  {
    "path": "decoder/decoder_compat.go",
    "chars": 5717,
    "preview": "//go:build (!amd64 && !arm64) || go1.27 || !go1.17 || (arm64 && !go1.20)\n// +build !amd64,!arm64 go1.27 !go1.17 arm64,!g"
  },
  {
    "path": "decoder/decoder_native.go",
    "chars": 2498,
    "preview": "//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)\n// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1"
  },
  {
    "path": "decoder/decoder_native_test.go",
    "chars": 9973,
    "preview": "//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)\n// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1"
  },
  {
    "path": "decoder/decoder_test.go",
    "chars": 9863,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "decoder/testdata_test.go",
    "chars": 19010,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "docs/INTRODUCTION.md",
    "chars": 7161,
    "preview": "# Introduction to Sonic\n\nEnglish | [中文](INTRODUCTION_ZH_CN.md)\n\n## Background\nAccording to the overall profiling of prod"
  },
  {
    "path": "docs/INTRODUCTION_ZH_CN.md",
    "chars": 2856,
    "preview": "# Sonic 简介\n\n[English](INTRODUCTION.md) | 中文\n\n## 背景\n\n根据字节跳动生产服务的整体分析,我们发现 JSON 序列化和反序列化的开销意外地很高:CPU 使用率接近 10%,其中极端情况下超过 4"
  },
  {
    "path": "encode_test.go",
    "chars": 29810,
    "preview": "//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)\n// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1"
  },
  {
    "path": "encoder/encoder_compat.go",
    "chars": 7833,
    "preview": "//go:build (!amd64 && !arm64) || go1.27 || !go1.17 || (arm64 && !go1.20)\n// +build !amd64,!arm64 go1.27 !go1.17 arm64,!g"
  },
  {
    "path": "encoder/encoder_native.go",
    "chars": 4705,
    "preview": "//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)\n// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1"
  },
  {
    "path": "encoder/encoder_native_test.go",
    "chars": 5332,
    "preview": "//go:build (amd64 && go1.17 && !go1.27) || (arm64 && go1.20 && !go1.27)\n// +build amd64,go1.17,!go1.27 arm64,go1.20,!go1"
  },
  {
    "path": "encoder/encoder_test.go",
    "chars": 13041,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "encoder/testdata_test.go",
    "chars": 19010,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "examples/example_stream_test.go",
    "chars": 736,
    "preview": "// +build !go1.24\n\npackage example\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"strings\"\n\t\"github.com/bytedance/sonic\"\n)\n\n// This example"
  },
  {
    "path": "external_jsonlib_test/benchmark_test/ast_set_benchmark_test.go",
    "chars": 577,
    "preview": "package benchmark_test\n\nimport (\n\t\"strconv\"\n\t\"testing\"\n\n\tsimplejson \"github.com/bitly/go-simplejson\"\n\t\"github.com/byteda"
  },
  {
    "path": "external_jsonlib_test/benchmark_test/decoder_stream_test.go",
    "chars": 2894,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "external_jsonlib_test/benchmark_test/decoder_test.go",
    "chars": 4795,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "external_jsonlib_test/benchmark_test/encoder_stream_test.go",
    "chars": 2083,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "external_jsonlib_test/benchmark_test/encoder_test.go",
    "chars": 3605,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "external_jsonlib_test/benchmark_test/msgpack_test.go",
    "chars": 5056,
    "preview": "/*\n * Copyright 2025 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "external_jsonlib_test/benchmark_test/parser_test.go",
    "chars": 11657,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "external_jsonlib_test/benchmark_test/search_test.go",
    "chars": 6916,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "external_jsonlib_test/benchmark_test/testdata_test.go",
    "chars": 19143,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "external_jsonlib_test/go.mod",
    "chars": 1280,
    "preview": "module github.com/bytedance/sonic/external_jsonlib_test\n\ngo 1.18\n\nrequire (\n\tgithub.com/bitly/go-simplejson v0.5.1\n\tgith"
  },
  {
    "path": "external_jsonlib_test/go.sum",
    "chars": 5460,
    "preview": "github.com/bitly/go-simplejson v0.5.1 h1:xgwPbetQScXt1gh9BmoJ6j9JMr3TElvuIyjR8pgdoow=\ngithub.com/bitly/go-simplejson v0."
  },
  {
    "path": "external_jsonlib_test/unit_test/api_test.go",
    "chars": 4347,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "external_jsonlib_test/unit_test/ast_compat_test.go",
    "chars": 1825,
    "preview": "/*\n * Copyright 2022 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "external_jsonlib_test/unit_test/decoder_stream_test.go",
    "chars": 6270,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "fuzz/ast_fuzz_test.go",
    "chars": 1991,
    "preview": "// +build go1.18\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License"
  },
  {
    "path": "fuzz/corpus/htmescape3.json",
    "chars": 352,
    "preview": "\"&&&&&&&&&&&&&&&&&&&&&&&\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2\\xe2"
  },
  {
    "path": "fuzz/corpus/htmlescap2.json",
    "chars": 191,
    "preview": "\"{\\\"\\\"\\u2028\\x94\\xe2\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\u2028\\x80\\u2028\\x80\\u2028\\xe2\\u2028\\x8a\\u2028⑀\\xa8\\x8a\\xa8\\xe2\\u202"
  },
  {
    "path": "fuzz/corpus/htmlescape.json",
    "chars": 17,
    "preview": "\"&<>\\u2028\\u2029\""
  },
  {
    "path": "fuzz/corpus/stringnumber.json",
    "chars": 5,
    "preview": "\"123\""
  },
  {
    "path": "fuzz/corpus/stringnumber2.json",
    "chars": 10,
    "preview": "\"-1.23e+1\""
  },
  {
    "path": "fuzz/corpus/struct.json",
    "chars": 817,
    "preview": "{\n    \"A\": -8111819689795174000,\n    \"B\": \"fQhhLProOY hello \\\\\\\" 你好 😊\",\n    \"C\": 3.577476171476308e+307,\n    \"D\": true,\n"
  },
  {
    "path": "fuzz/corpus/twitter.json",
    "chars": 567916,
    "preview": "{\n  \"statuses\": [\n    {\n      \"metadata\": {\n        \"result_type\": \"recent\",\n        \"iso_language_code\": \"ja\"\n      },\n"
  },
  {
    "path": "fuzz/corpus/twitterescaped.json",
    "chars": 562408,
    "preview": "{\"statuses\":[{\"metadata\":{\"result_type\":\"recent\",\"iso_language_code\":\"ja\"},\"created_at\":\"Sun Aug 31 00:29:15 +0000 2014\""
  },
  {
    "path": "fuzz/corpus.go",
    "chars": 1872,
    "preview": "// +build go1.18\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License"
  },
  {
    "path": "fuzz/fuzz_test.go",
    "chars": 11016,
    "preview": "// +build go1.18\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License"
  },
  {
    "path": "fuzz/go.mod",
    "chars": 671,
    "preview": "module github.com/bytedance/sonic/fuzz\n\ngo 1.18\n\nrequire (\n\tgithub.com/bytedance/gopkg v0.1.3\n\tgithub.com/bytedance/soni"
  },
  {
    "path": "fuzz/go.sum",
    "chars": 2246,
    "preview": "github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=\ngithub.com/bytedance/sonic/loader v0.5"
  },
  {
    "path": "fuzz/other_fuzz_test.go",
    "chars": 2170,
    "preview": "// +build go1.18\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License"
  },
  {
    "path": "fuzz/struct_fuzz_test.go",
    "chars": 5372,
    "preview": "//go:build go1.18\n// +build go1.18\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version"
  },
  {
    "path": "generic_test/benchmark_test.go",
    "chars": 9068,
    "preview": "// +build go1.18\n\n/*\n * Copyright 2022 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License"
  },
  {
    "path": "generic_test/go.mod",
    "chars": 804,
    "preview": "module github.com/bytedance/sonic/generic_test\n\ngo 1.18\n\nrequire (\n\tgithub.com/bytedance/sonic v1.11.5-alpha3\n\tgithub.co"
  },
  {
    "path": "generic_test/go.sum",
    "chars": 3675,
    "preview": "github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=\ngithub.com/bytedance/gopkg v0.1.3/go.m"
  },
  {
    "path": "generic_test/sonic_test.go",
    "chars": 3536,
    "preview": "// +build go1.18\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License"
  },
  {
    "path": "generic_test/testdata_test.go",
    "chars": 31607,
    "preview": "// +build go1.18\n\n/*\n * Copyright 2020 The Go Authors. All rights reserved.\n * Modifications Copyright 2022 ByteDance In"
  },
  {
    "path": "go.mod",
    "chars": 577,
    "preview": "module github.com/bytedance/sonic\n\ngo 1.18\n\n// replace github.com/bytedance/sonic/loader => ./loader\n\nrequire (\n\tgithub."
  },
  {
    "path": "go.sum",
    "chars": 2962,
    "preview": "github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=\ngithub.com/bytedance/gopkg v0.1.3/go.m"
  },
  {
    "path": "go.work",
    "chars": 93,
    "preview": "go 1.18\n\nuse (\n\t.\n\t./external_jsonlib_test\n\t./fuzz\n\t./generic_test\n\t./issue_test\n\t./loader\n)\n"
  },
  {
    "path": "go.work.sum",
    "chars": 853,
    "preview": "github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=\ngithub.com/bytedance/son"
  },
  {
    "path": "internal/caching/asm.s",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "internal/caching/fcache.go",
    "chars": 2661,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/caching/hashing.go",
    "chars": 902,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/caching/hashing_test.go",
    "chars": 1552,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/caching/pcache.go",
    "chars": 3618,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/caching/pcache_test.go",
    "chars": 1305,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/compat/warn.go",
    "chars": 328,
    "preview": "// +build !amd64,!arm64 go1.27 !go1.17 arm64,!go1.20\n\npackage compat\n\nimport (\n    \"fmt\"\n    \"os\"\n)\n\nfunc Warn(prefix st"
  },
  {
    "path": "internal/cpu/features.go",
    "chars": 1112,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/api/decoder.go",
    "chars": 5291,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/api/decoder_amd64.go",
    "chars": 1004,
    "preview": "//go:build go1.17 && !go1.27\n// +build go1.17,!go1.27\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apac"
  },
  {
    "path": "internal/decoder/api/decoder_arm64.go",
    "chars": 955,
    "preview": "//go:build go1.17 && !go1.27\n// +build go1.17,!go1.27\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apac"
  },
  {
    "path": "internal/decoder/api/norace_test.go",
    "chars": 2161,
    "preview": "//go:build !race\n// +build !race\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2"
  },
  {
    "path": "internal/decoder/api/stream.go",
    "chars": 5656,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/api/stream_test.go",
    "chars": 9927,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/api/testdata_test.go",
    "chars": 18877,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/consts/option.go",
    "chars": 882,
    "preview": "package consts\n\nimport (\n\t\"github.com/bytedance/sonic/internal/native/types\"\n)\n\nconst (\n\tF_use_int64       = 0\n\tF_disabl"
  },
  {
    "path": "internal/decoder/errors/errors.go",
    "chars": 4127,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/errors/errors_test.go",
    "chars": 1908,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/errors/fuzz_test.go",
    "chars": 1463,
    "preview": "//go:build go1.18\n// +build go1.18\n\n/**\n * Copyright 2023 ByteDance Inc.\n *\n * Licensed under the Apache License, Versio"
  },
  {
    "path": "internal/decoder/jitdec/asm.s",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "internal/decoder/jitdec/asm_stubs_amd64_go117.go",
    "chars": 3645,
    "preview": "//go:build go1.17 && !go1.21\n// +build go1.17,!go1.21\n\n// Copyright 2023 CloudWeGo Authors\n//\n// Licensed under the Apac"
  },
  {
    "path": "internal/decoder/jitdec/asm_stubs_amd64_go121.go",
    "chars": 3722,
    "preview": "//go:build go1.21 && !go1.27\n// +build go1.21,!go1.27\n\n// Copyright 2023 CloudWeGo Authors\n//\n// Licensed under the Apac"
  },
  {
    "path": "internal/decoder/jitdec/assembler_regabi_amd64.go",
    "chars": 85033,
    "preview": "//go:build go1.17 && !go1.27\n// +build go1.17,!go1.27\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apac"
  },
  {
    "path": "internal/decoder/jitdec/assembler_test.go",
    "chars": 20497,
    "preview": "/*\n* Copyright 2021 ByteDance Inc.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use"
  },
  {
    "path": "internal/decoder/jitdec/compiler.go",
    "chars": 28862,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/jitdec/compiler_test.go",
    "chars": 1186,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/jitdec/debug.go",
    "chars": 1592,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/jitdec/decoder.go",
    "chars": 3632,
    "preview": "package jitdec\n\nimport (\n\t\"encoding/json\"\n\t\"reflect\"\n\t\"runtime\"\n\t\"unsafe\"\n\n\t\"github.com/bytedance/sonic/internal/decoder"
  },
  {
    "path": "internal/decoder/jitdec/generic_regabi_amd64.go",
    "chars": 34119,
    "preview": "//go:build go1.17 && !go1.27\n// +build go1.17,!go1.27\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apac"
  },
  {
    "path": "internal/decoder/jitdec/generic_regabi_amd64_test.s",
    "chars": 1045,
    "preview": "// +build go1.17\n\n//\n// Copyright 2021 ByteDance Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License"
  },
  {
    "path": "internal/decoder/jitdec/generic_test.go",
    "chars": 2185,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/jitdec/pcsp_test.go",
    "chars": 4010,
    "preview": "//go:build !race && amd64 && !go1.23\n// +build !race,amd64,!go1.23\n\n/*\n* Copyright 2025 ByteDance Inc.\n*\n* Licensed unde"
  },
  {
    "path": "internal/decoder/jitdec/pools.go",
    "chars": 3372,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/jitdec/primitives.go",
    "chars": 1765,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/jitdec/testdata_test.go",
    "chars": 18880,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/jitdec/types.go",
    "chars": 2034,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/jitdec/utils.go",
    "chars": 941,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/optdec/compile_struct.go",
    "chars": 3790,
    "preview": "package optdec\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\tcaching \"github.com/bytedance/sonic/internal/optcaching\"\n\t\"github.com/byted"
  },
  {
    "path": "internal/decoder/optdec/compiler.go",
    "chars": 9856,
    "preview": "package optdec\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\n\t\"github.com/bytedance/sonic/internal/caching\"\n\t\"github.com/bytedance/sonic/"
  },
  {
    "path": "internal/decoder/optdec/const.go",
    "chars": 1436,
    "preview": "package optdec\n\nimport \"math\"\n\n/*\nCopied from sonic-rs\n// JSON Value Type\nconst NULL: u64 = 0;\nconst BOOL: u64 = 2;\ncons"
  },
  {
    "path": "internal/decoder/optdec/context.go",
    "chars": 39,
    "preview": "package optdec\n\ntype context = Context\n"
  },
  {
    "path": "internal/decoder/optdec/decoder.go",
    "chars": 3749,
    "preview": "package optdec\n\nimport (\n\t\"reflect\"\n\t\"unsafe\"\n\n\t\"encoding/json\"\n\t\"github.com/bytedance/sonic/internal/decoder/consts\"\n\t\""
  },
  {
    "path": "internal/decoder/optdec/errors.go",
    "chars": 1716,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/optdec/functor.go",
    "chars": 5706,
    "preview": "package optdec\n\nimport (\n\t\"encoding/json\"\n\t\"math\"\n\t\"unsafe\"\n\n\t\"github.com/bytedance/sonic/internal/resolver\"\n\t\"github.co"
  },
  {
    "path": "internal/decoder/optdec/helper.go",
    "chars": 1886,
    "preview": "package optdec\n\nimport (\n\t\"encoding/json\"\n\t\"strconv\"\n\n\t\"github.com/bytedance/sonic/internal/native\"\n\t\"github.com/bytedan"
  },
  {
    "path": "internal/decoder/optdec/interface.go",
    "chars": 3334,
    "preview": "package optdec\n\nimport (\n\t\"encoding\"\n\t\"encoding/json\"\n\t\"reflect\"\n\t\"unsafe\"\n\n\t\"github.com/bytedance/sonic/internal/rt\"\n)\n"
  },
  {
    "path": "internal/decoder/optdec/map.go",
    "chars": 10080,
    "preview": "package optdec\n\nimport (\n\t\"encoding\"\n\t\"encoding/json\"\n\t\"math\"\n\t\"reflect\"\n\t\"unsafe\"\n\n\t\"github.com/bytedance/sonic/interna"
  },
  {
    "path": "internal/decoder/optdec/native.go",
    "chars": 6625,
    "preview": "package optdec\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"unsafe\"\n\n\t\"sync\"\n\n\t\"github.com/bytedance/sonic/internal/native\"\n\t\"github.co"
  },
  {
    "path": "internal/decoder/optdec/native_test.go",
    "chars": 2291,
    "preview": "package optdec\n\nimport (\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/davecgh/go-spew/spew\"\n\t\"github.com/stretchr/testify/assert\""
  },
  {
    "path": "internal/decoder/optdec/node.go",
    "chars": 28006,
    "preview": "package optdec\n\nimport (\n\t\"encoding/json\"\n\t\"math\"\n\t\"unsafe\"\n\n\t\"github.com/bytedance/sonic/internal/envs\"\n\t\"github.com/by"
  },
  {
    "path": "internal/decoder/optdec/slice.go",
    "chars": 4654,
    "preview": "package optdec\n\nimport (\n\t\"reflect\"\n\t\"unsafe\"\n\n\t\"github.com/bytedance/sonic/internal/rt\"\n)\n\ntype sliceDecoder struct {\n\t"
  },
  {
    "path": "internal/decoder/optdec/stringopts.go",
    "chars": 6268,
    "preview": "package optdec\n\nimport (\n\t\"encoding/json\"\n\t\"math\"\n\t\"unsafe\"\n\n\t\"github.com/bytedance/sonic/internal/rt\"\n)\n\ntype ptrStrDec"
  },
  {
    "path": "internal/decoder/optdec/structs.go",
    "chars": 1288,
    "preview": "package optdec\n\nimport (\n\t\"reflect\"\n\t\"unsafe\"\n\n\t\"github.com/bytedance/sonic/internal/decoder/consts\"\n\tcaching \"github.co"
  },
  {
    "path": "internal/decoder/optdec/testdata_test.go",
    "chars": 18880,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/decoder/optdec/types.go",
    "chars": 2174,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/alg/mapiter.go",
    "chars": 7239,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/alg/opts.go",
    "chars": 845,
    "preview": "/**\n * Copyright 2024 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may no"
  },
  {
    "path": "internal/encoder/alg/sort.go",
    "chars": 4907,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/alg/sort_test.go",
    "chars": 3740,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/alg/spec.go",
    "chars": 4233,
    "preview": "//go:build (amd64 && go1.16 && !go1.27) || (arm64 && go1.20 && !go1.27)\n// +build amd64,go1.16,!go1.27 arm64,go1.20,!go1"
  },
  {
    "path": "internal/encoder/alg/spec_compat.go",
    "chars": 3382,
    "preview": "//go:build (!amd64 && !arm64) || go1.27 || !go1.16 || (arm64 && !go1.20)\n// +build !amd64,!arm64 go1.27 !go1.16 arm64,!g"
  },
  {
    "path": "internal/encoder/alg/spec_test.go",
    "chars": 5195,
    "preview": "/**\n * Copyright 2025 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may no"
  },
  {
    "path": "internal/encoder/compiler.go",
    "chars": 16848,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/compiler_test.go",
    "chars": 1745,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/encode_norace.go",
    "chars": 764,
    "preview": "//go:build !race\n// +build !race\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2"
  },
  {
    "path": "internal/encoder/encode_race.go",
    "chars": 1356,
    "preview": "//go:build race\n// +build race\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0"
  },
  {
    "path": "internal/encoder/encoder.go",
    "chars": 9424,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/encoder_norace_test.go",
    "chars": 1216,
    "preview": "//go:build !race\n// +build !race\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2"
  },
  {
    "path": "internal/encoder/encoder_test.go",
    "chars": 16981,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/ir/op.go",
    "chars": 9744,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/omitzero_test.go",
    "chars": 5320,
    "preview": "//go:build go1.24\n// +build go1.24\n\n/**\n * Copyright 2025 ByteDance Inc.\n *\n * Licensed under the Apache License, Versio"
  },
  {
    "path": "internal/encoder/pools_amd64.go",
    "chars": 2122,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/pools_amd64_test.go",
    "chars": 636,
    "preview": "//go:build amd64\n// +build amd64\n\npackage encoder\n\nimport (\n\t\"reflect\"\n\t\"testing\"\n\n\t\"github.com/bytedance/sonic/option\"\n"
  },
  {
    "path": "internal/encoder/pools_compt.go",
    "chars": 682,
    "preview": "//go:build !amd64\n// +build !amd64\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version"
  },
  {
    "path": "internal/encoder/prim/primitives.go",
    "chars": 2806,
    "preview": "/**\n * Copyright 2024 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may no"
  },
  {
    "path": "internal/encoder/stream.go",
    "chars": 2109,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/stream_test.go",
    "chars": 3265,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/testdata_test.go",
    "chars": 16254,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/vars/cache.go",
    "chars": 1340,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/vars/const.go",
    "chars": 1142,
    "preview": "/**\n * Copyright 2024 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may no"
  },
  {
    "path": "internal/encoder/vars/errors.go",
    "chars": 2457,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/vars/stack.go",
    "chars": 2999,
    "preview": "/**\n * Copyright 2024 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may no"
  },
  {
    "path": "internal/encoder/vars/types.go",
    "chars": 1410,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/vm/stbus.go",
    "chars": 1488,
    "preview": "/**\n * Copyright 2024 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may no"
  },
  {
    "path": "internal/encoder/vm/vm.go",
    "chars": 9102,
    "preview": "// Copyright 2024 CloudWeGo Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not"
  },
  {
    "path": "internal/encoder/vm/vm_test.go",
    "chars": 1756,
    "preview": "// Copyright 2024 CloudWeGo Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not"
  },
  {
    "path": "internal/encoder/x86/asm_stubs_amd64_go117.go",
    "chars": 1716,
    "preview": "//go:build go1.17 && !go1.21\n// +build go1.17,!go1.21\n\n// Copyright 2023 CloudWeGo Authors\n//\n// Licensed under the Apac"
  },
  {
    "path": "internal/encoder/x86/asm_stubs_amd64_go121.go",
    "chars": 1653,
    "preview": "//go:build go1.21 && !go1.27\n// +build go1.21,!go1.27\n\n// Copyright 2023 CloudWeGo Authors\n//\n// Licensed under the Apac"
  },
  {
    "path": "internal/encoder/x86/assembler_regabi_amd64.go",
    "chars": 44337,
    "preview": "//go:build go1.17 && !go1.27\n// +build go1.17,!go1.27\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apac"
  },
  {
    "path": "internal/encoder/x86/assembler_test.go",
    "chars": 8908,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/encoder/x86/debug_go116.go",
    "chars": 1577,
    "preview": "//go:build go1.16 && !go1.17\n// +build go1.16,!go1.17\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apac"
  },
  {
    "path": "internal/encoder/x86/debug_go117.go",
    "chars": 4283,
    "preview": "//go:build go1.17 && !go1.27\n// +build go1.17,!go1.27\n\n/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apac"
  },
  {
    "path": "internal/encoder/x86/stbus.go",
    "chars": 1588,
    "preview": "/**\n * Copyright 2024 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may no"
  },
  {
    "path": "internal/envs/decode.go",
    "chars": 320,
    "preview": "package envs\n\nimport (\n\t\"os\"\n)\n\nvar UseOptDec = os.Getenv(\"SONIC_USE_OPTDEC\") == \"1\"\nvar UseFastMap = os.Getenv(\"SONIC_U"
  },
  {
    "path": "internal/jit/arch_amd64.go",
    "chars": 1617,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/jit/asm.s",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "internal/jit/assembler_amd64.go",
    "chars": 6737,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/jit/backend.go",
    "chars": 5293,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  },
  {
    "path": "internal/jit/backend_test.go",
    "chars": 973,
    "preview": "/*\n * Copyright 2021 ByteDance Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not"
  }
]

// ... and 510 more files (download for full content)

About this extraction

This page contains the full source code of the bytedance/sonic GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 710 files (16.9 MB), approximately 4.5M tokens, and a symbol index with 5438 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!