datadog-ruby_core_source 3.4.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/id.h +357 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/id_table.h +15 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/array.h +2 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/basic_operators.h +66 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/bignum.h +256 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/bits.h +647 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/box.h +83 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/class.h +806 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/cmdlineopt.h +3 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/concurrent_set.h +21 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/cont.h +34 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/encoding.h +2 -1
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/error.h +7 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/eval.h +43 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/gc.h +360 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/hash.h +1 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/imemo.h +87 -22
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/inits.h +4 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/io.h +25 -5
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/load.h +2 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/numeric.h +323 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/object.h +1 -1
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/re.h +5 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/sanitizers.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/set_table.h +70 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/signal.h +1 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/st.h +1 -1
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/string.h +4 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/struct.h +41 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/symbol.h +4 -5
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/thread.h +112 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/time.h +34 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/variable.h +13 -9
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/internal/vm.h +138 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal.h +0 -3
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/iseq.h +359 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/method.h +276 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/prism/ast.h +8254 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/diagnostic.h +7 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/extension.h +1 -1
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/prism/options.h +488 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/parser.h +3 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/prism/prism.h +408 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/regexp.h +2 -2
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_buffer.h +8 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_integer.h +4 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_list.h +6 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_string.h +12 -2
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/version.h +2 -2
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism_compile.h +1 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ractor_core.h +63 -114
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/ruby_atomic.h +73 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/rubyparser.h +1393 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/shape.h +464 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/thread_pthread.h +177 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/vm_core.h +2406 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-p0/vm_debug.h +124 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/ccan/build_assert/build_assert.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/ccan/check_type/check_type.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/ccan/container_of/container_of.h +142 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/ccan/list/list.h +791 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/ccan/str/str.h +17 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/id.h +7 -5
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/id_table.h +54 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/array.h +154 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/internal/bignum.h +1 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/box.h +81 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/class.h +805 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/cmdlineopt.h +64 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/compar.h +29 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/compile.h +34 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/compilers.h +107 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/complex.h +29 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/concurrent_set.h +21 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/dir.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/enc.h +19 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/encoding.h +39 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/enum.h +18 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/enumerator.h +21 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/error.h +251 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/internal/eval.h +8 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/file.h +38 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/fixnum.h +185 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/internal/gc.h +25 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/hash.h +194 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/imemo.h +322 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/inits.h +51 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/io.h +163 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/load.h +20 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/loadpath.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/math.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/missing.h +19 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/internal/numeric.h +1 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/object.h +63 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/parse.h +131 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/proc.h +30 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/process.h +124 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/ractor.h +10 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/random.h +17 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/range.h +40 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/rational.h +71 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/re.h +33 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/ruby_parser.h +102 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/sanitizers.h +346 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/serial.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/set_table.h +70 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/signal.h +25 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/st.h +11 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/static_assert.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/string.h +203 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/struct.h +160 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/symbol.h +46 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/internal/thread.h +14 -10
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/transcode.h +23 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/util.h +27 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/variable.h +74 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/internal/vm.h +3 -4
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal/warnings.h +16 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/internal.h +105 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/iseq.h +7 -1
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/method.h +14 -1
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/node.h +122 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/parser_st.h +162 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/parser_value.h +106 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/prism/ast.h +322 -53
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/defines.h +260 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/diagnostic.h +458 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/encoding.h +283 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/extension.h +19 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/node.h +129 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/prism/options.h +46 -3
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/pack.h +163 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/parser.h +936 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/prettyprint.h +34 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/prism/prism.h +39 -14
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/regexp.h +43 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/static_literals.h +121 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_buffer.h +236 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_char.h +204 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_constant_pool.h +218 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_integer.h +130 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_list.h +103 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_memchr.h +29 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_newline_list.h +113 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_string.h +200 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_strncasecmp.h +32 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/util/pm_strpbrk.h +46 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism/version.h +29 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/prism_compile.h +106 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/ractor_core.h +306 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/ruby_assert.h +14 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/ruby_atomic.h +66 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/rubyparser.h +15 -1
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/shape.h +444 -0
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/thread_none.h +21 -0
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/thread_pthread.h +10 -2
- data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/vm_core.h +160 -45
- data/lib/datadog/ruby_core_source/ruby-4.0.0-preview2/vm_opts.h +67 -0
- data/lib/datadog/ruby_core_source/version.rb +1 -1
- data/lib/datadog/ruby_core_source.rb +1 -1
- metadata +214 -106
- data/CHANGELOG.datadog.md +0 -19
- data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/internal/class.h +0 -283
- data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/ruby_atomic.h +0 -23
- data/lib/datadog/ruby_core_source/ruby-3.5.0-preview1/shape.h +0 -234
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ccan/build_assert/build_assert.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ccan/check_type/check_type.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ccan/container_of/container_of.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ccan/list/list.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ccan/str/str.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/compar.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/compile.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/compilers.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/complex.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/dir.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/enc.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/enum.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/enumerator.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/file.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/fixnum.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/loadpath.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/math.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/missing.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/parse.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/proc.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/process.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/ractor.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/random.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/range.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/rational.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/ruby_parser.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/serial.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/static_assert.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/transcode.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/util.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/internal/warnings.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/node.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/parser_st.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/parser_value.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/defines.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/encoding.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/node.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/pack.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/prettyprint.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/static_literals.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_char.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_constant_pool.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_memchr.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_newline_list.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_strncasecmp.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/prism/util/pm_strpbrk.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/ruby_assert.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/thread_none.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-p0}/vm_opts.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/internal/basic_operators.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/internal/bits.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/internal/cont.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/internal/time.h +0 -0
- /data/lib/datadog/ruby_core_source/{ruby-3.5.0-preview1 → ruby-4.0.0-preview2}/vm_debug.h +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file pm_char.h
|
|
3
|
+
*
|
|
4
|
+
* Functions for working with characters and strings.
|
|
5
|
+
*/
|
|
6
|
+
#ifndef PRISM_CHAR_H
|
|
7
|
+
#define PRISM_CHAR_H
|
|
8
|
+
|
|
9
|
+
#include "prism/defines.h"
|
|
10
|
+
#include "prism/util/pm_newline_list.h"
|
|
11
|
+
|
|
12
|
+
#include <stdbool.h>
|
|
13
|
+
#include <stddef.h>
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Returns the number of characters at the start of the string that are
|
|
17
|
+
* whitespace. Disallows searching past the given maximum number of characters.
|
|
18
|
+
*
|
|
19
|
+
* @param string The string to search.
|
|
20
|
+
* @param length The maximum number of characters to search.
|
|
21
|
+
* @return The number of characters at the start of the string that are
|
|
22
|
+
* whitespace.
|
|
23
|
+
*/
|
|
24
|
+
size_t pm_strspn_whitespace(const uint8_t *string, ptrdiff_t length);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Returns the number of characters at the start of the string that are
|
|
28
|
+
* whitespace while also tracking the location of each newline. Disallows
|
|
29
|
+
* searching past the given maximum number of characters.
|
|
30
|
+
*
|
|
31
|
+
* @param string The string to search.
|
|
32
|
+
* @param length The maximum number of characters to search.
|
|
33
|
+
* @param newline_list The list of newlines to populate.
|
|
34
|
+
* @return The number of characters at the start of the string that are
|
|
35
|
+
* whitespace.
|
|
36
|
+
*/
|
|
37
|
+
size_t pm_strspn_whitespace_newlines(const uint8_t *string, ptrdiff_t length, pm_newline_list_t *newline_list);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Returns the number of characters at the start of the string that are inline
|
|
41
|
+
* whitespace. Disallows searching past the given maximum number of characters.
|
|
42
|
+
*
|
|
43
|
+
* @param string The string to search.
|
|
44
|
+
* @param length The maximum number of characters to search.
|
|
45
|
+
* @return The number of characters at the start of the string that are inline
|
|
46
|
+
* whitespace.
|
|
47
|
+
*/
|
|
48
|
+
size_t pm_strspn_inline_whitespace(const uint8_t *string, ptrdiff_t length);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Returns the number of characters at the start of the string that are decimal
|
|
52
|
+
* digits. Disallows searching past the given maximum number of characters.
|
|
53
|
+
*
|
|
54
|
+
* @param string The string to search.
|
|
55
|
+
* @param length The maximum number of characters to search.
|
|
56
|
+
* @return The number of characters at the start of the string that are decimal
|
|
57
|
+
* digits.
|
|
58
|
+
*/
|
|
59
|
+
size_t pm_strspn_decimal_digit(const uint8_t *string, ptrdiff_t length);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Returns the number of characters at the start of the string that are
|
|
63
|
+
* hexadecimal digits. Disallows searching past the given maximum number of
|
|
64
|
+
* characters.
|
|
65
|
+
*
|
|
66
|
+
* @param string The string to search.
|
|
67
|
+
* @param length The maximum number of characters to search.
|
|
68
|
+
* @return The number of characters at the start of the string that are
|
|
69
|
+
* hexadecimal digits.
|
|
70
|
+
*/
|
|
71
|
+
size_t pm_strspn_hexadecimal_digit(const uint8_t *string, ptrdiff_t length);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Returns the number of characters at the start of the string that are octal
|
|
75
|
+
* digits or underscores. Disallows searching past the given maximum number of
|
|
76
|
+
* characters.
|
|
77
|
+
*
|
|
78
|
+
* If multiple underscores are found in a row or if an underscore is
|
|
79
|
+
* found at the end of the number, then the invalid pointer is set to the index
|
|
80
|
+
* of the first invalid underscore.
|
|
81
|
+
*
|
|
82
|
+
* @param string The string to search.
|
|
83
|
+
* @param length The maximum number of characters to search.
|
|
84
|
+
* @param invalid The pointer to set to the index of the first invalid
|
|
85
|
+
* underscore.
|
|
86
|
+
* @return The number of characters at the start of the string that are octal
|
|
87
|
+
* digits or underscores.
|
|
88
|
+
*/
|
|
89
|
+
size_t pm_strspn_octal_number(const uint8_t *string, ptrdiff_t length, const uint8_t **invalid);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Returns the number of characters at the start of the string that are decimal
|
|
93
|
+
* digits or underscores. Disallows searching past the given maximum number of
|
|
94
|
+
* characters.
|
|
95
|
+
*
|
|
96
|
+
* If multiple underscores are found in a row or if an underscore is
|
|
97
|
+
* found at the end of the number, then the invalid pointer is set to the index
|
|
98
|
+
* of the first invalid underscore.
|
|
99
|
+
*
|
|
100
|
+
* @param string The string to search.
|
|
101
|
+
* @param length The maximum number of characters to search.
|
|
102
|
+
* @param invalid The pointer to set to the index of the first invalid
|
|
103
|
+
* underscore.
|
|
104
|
+
* @return The number of characters at the start of the string that are decimal
|
|
105
|
+
* digits or underscores.
|
|
106
|
+
*/
|
|
107
|
+
size_t pm_strspn_decimal_number(const uint8_t *string, ptrdiff_t length, const uint8_t **invalid);
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns the number of characters at the start of the string that are
|
|
111
|
+
* hexadecimal digits or underscores. Disallows searching past the given maximum
|
|
112
|
+
* number of characters.
|
|
113
|
+
*
|
|
114
|
+
* If multiple underscores are found in a row or if an underscore is
|
|
115
|
+
* found at the end of the number, then the invalid pointer is set to the index
|
|
116
|
+
* of the first invalid underscore.
|
|
117
|
+
*
|
|
118
|
+
* @param string The string to search.
|
|
119
|
+
* @param length The maximum number of characters to search.
|
|
120
|
+
* @param invalid The pointer to set to the index of the first invalid
|
|
121
|
+
* underscore.
|
|
122
|
+
* @return The number of characters at the start of the string that are
|
|
123
|
+
* hexadecimal digits or underscores.
|
|
124
|
+
*/
|
|
125
|
+
size_t pm_strspn_hexadecimal_number(const uint8_t *string, ptrdiff_t length, const uint8_t **invalid);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Returns the number of characters at the start of the string that are regexp
|
|
129
|
+
* options. Disallows searching past the given maximum number of characters.
|
|
130
|
+
*
|
|
131
|
+
* @param string The string to search.
|
|
132
|
+
* @param length The maximum number of characters to search.
|
|
133
|
+
* @return The number of characters at the start of the string that are regexp
|
|
134
|
+
* options.
|
|
135
|
+
*/
|
|
136
|
+
size_t pm_strspn_regexp_option(const uint8_t *string, ptrdiff_t length);
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Returns the number of characters at the start of the string that are binary
|
|
140
|
+
* digits or underscores. Disallows searching past the given maximum number of
|
|
141
|
+
* characters.
|
|
142
|
+
*
|
|
143
|
+
* If multiple underscores are found in a row or if an underscore is
|
|
144
|
+
* found at the end of the number, then the invalid pointer is set to the index
|
|
145
|
+
* of the first invalid underscore.
|
|
146
|
+
*
|
|
147
|
+
* @param string The string to search.
|
|
148
|
+
* @param length The maximum number of characters to search.
|
|
149
|
+
* @param invalid The pointer to set to the index of the first invalid
|
|
150
|
+
* underscore.
|
|
151
|
+
* @return The number of characters at the start of the string that are binary
|
|
152
|
+
* digits or underscores.
|
|
153
|
+
*/
|
|
154
|
+
size_t pm_strspn_binary_number(const uint8_t *string, ptrdiff_t length, const uint8_t **invalid);
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Returns true if the given character is a whitespace character.
|
|
158
|
+
*
|
|
159
|
+
* @param b The character to check.
|
|
160
|
+
* @return True if the given character is a whitespace character.
|
|
161
|
+
*/
|
|
162
|
+
bool pm_char_is_whitespace(const uint8_t b);
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Returns true if the given character is an inline whitespace character.
|
|
166
|
+
*
|
|
167
|
+
* @param b The character to check.
|
|
168
|
+
* @return True if the given character is an inline whitespace character.
|
|
169
|
+
*/
|
|
170
|
+
bool pm_char_is_inline_whitespace(const uint8_t b);
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Returns true if the given character is a binary digit.
|
|
174
|
+
*
|
|
175
|
+
* @param b The character to check.
|
|
176
|
+
* @return True if the given character is a binary digit.
|
|
177
|
+
*/
|
|
178
|
+
bool pm_char_is_binary_digit(const uint8_t b);
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Returns true if the given character is an octal digit.
|
|
182
|
+
*
|
|
183
|
+
* @param b The character to check.
|
|
184
|
+
* @return True if the given character is an octal digit.
|
|
185
|
+
*/
|
|
186
|
+
bool pm_char_is_octal_digit(const uint8_t b);
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Returns true if the given character is a decimal digit.
|
|
190
|
+
*
|
|
191
|
+
* @param b The character to check.
|
|
192
|
+
* @return True if the given character is a decimal digit.
|
|
193
|
+
*/
|
|
194
|
+
bool pm_char_is_decimal_digit(const uint8_t b);
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Returns true if the given character is a hexadecimal digit.
|
|
198
|
+
*
|
|
199
|
+
* @param b The character to check.
|
|
200
|
+
* @return True if the given character is a hexadecimal digit.
|
|
201
|
+
*/
|
|
202
|
+
bool pm_char_is_hexadecimal_digit(const uint8_t b);
|
|
203
|
+
|
|
204
|
+
#endif
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file pm_constant_pool.h
|
|
3
|
+
*
|
|
4
|
+
* A data structure that stores a set of strings.
|
|
5
|
+
*
|
|
6
|
+
* Each string is assigned a unique id, which can be used to compare strings for
|
|
7
|
+
* equality. This comparison ends up being much faster than strcmp, since it
|
|
8
|
+
* only requires a single integer comparison.
|
|
9
|
+
*/
|
|
10
|
+
#ifndef PRISM_CONSTANT_POOL_H
|
|
11
|
+
#define PRISM_CONSTANT_POOL_H
|
|
12
|
+
|
|
13
|
+
#include "prism/defines.h"
|
|
14
|
+
|
|
15
|
+
#include <assert.h>
|
|
16
|
+
#include <stdbool.h>
|
|
17
|
+
#include <stdint.h>
|
|
18
|
+
#include <stdlib.h>
|
|
19
|
+
#include <string.h>
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* When we allocate constants into the pool, we reserve 0 to mean that the slot
|
|
23
|
+
* is not yet filled. This constant is reused in other places to indicate the
|
|
24
|
+
* lack of a constant id.
|
|
25
|
+
*/
|
|
26
|
+
#define PM_CONSTANT_ID_UNSET 0
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A constant id is a unique identifier for a constant in the constant pool.
|
|
30
|
+
*/
|
|
31
|
+
typedef uint32_t pm_constant_id_t;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A list of constant IDs. Usually used to represent a set of locals.
|
|
35
|
+
*/
|
|
36
|
+
typedef struct {
|
|
37
|
+
/** The number of constant ids in the list. */
|
|
38
|
+
size_t size;
|
|
39
|
+
|
|
40
|
+
/** The number of constant ids that have been allocated in the list. */
|
|
41
|
+
size_t capacity;
|
|
42
|
+
|
|
43
|
+
/** The constant ids in the list. */
|
|
44
|
+
pm_constant_id_t *ids;
|
|
45
|
+
} pm_constant_id_list_t;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Initialize a list of constant ids.
|
|
49
|
+
*
|
|
50
|
+
* @param list The list to initialize.
|
|
51
|
+
*/
|
|
52
|
+
void pm_constant_id_list_init(pm_constant_id_list_t *list);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Initialize a list of constant ids with a given capacity.
|
|
56
|
+
*
|
|
57
|
+
* @param list The list to initialize.
|
|
58
|
+
* @param capacity The initial capacity of the list.
|
|
59
|
+
*/
|
|
60
|
+
void pm_constant_id_list_init_capacity(pm_constant_id_list_t *list, size_t capacity);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Append a constant id to a list of constant ids. Returns false if any
|
|
64
|
+
* potential reallocations fail.
|
|
65
|
+
*
|
|
66
|
+
* @param list The list to append to.
|
|
67
|
+
* @param id The id to append.
|
|
68
|
+
* @return Whether the append succeeded.
|
|
69
|
+
*/
|
|
70
|
+
bool pm_constant_id_list_append(pm_constant_id_list_t *list, pm_constant_id_t id);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Insert a constant id into a list of constant ids at the specified index.
|
|
74
|
+
*
|
|
75
|
+
* @param list The list to insert into.
|
|
76
|
+
* @param index The index at which to insert.
|
|
77
|
+
* @param id The id to insert.
|
|
78
|
+
*/
|
|
79
|
+
void pm_constant_id_list_insert(pm_constant_id_list_t *list, size_t index, pm_constant_id_t id);
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Checks if the current constant id list includes the given constant id.
|
|
83
|
+
*
|
|
84
|
+
* @param list The list to check.
|
|
85
|
+
* @param id The id to check for.
|
|
86
|
+
* @return Whether the list includes the given id.
|
|
87
|
+
*/
|
|
88
|
+
bool pm_constant_id_list_includes(pm_constant_id_list_t *list, pm_constant_id_t id);
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Free the memory associated with a list of constant ids.
|
|
92
|
+
*
|
|
93
|
+
* @param list The list to free.
|
|
94
|
+
*/
|
|
95
|
+
void pm_constant_id_list_free(pm_constant_id_list_t *list);
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The type of bucket in the constant pool hash map. This determines how the
|
|
99
|
+
* bucket should be freed.
|
|
100
|
+
*/
|
|
101
|
+
typedef unsigned int pm_constant_pool_bucket_type_t;
|
|
102
|
+
|
|
103
|
+
/** By default, each constant is a slice of the source. */
|
|
104
|
+
static const pm_constant_pool_bucket_type_t PM_CONSTANT_POOL_BUCKET_DEFAULT = 0;
|
|
105
|
+
|
|
106
|
+
/** An owned constant is one for which memory has been allocated. */
|
|
107
|
+
static const pm_constant_pool_bucket_type_t PM_CONSTANT_POOL_BUCKET_OWNED = 1;
|
|
108
|
+
|
|
109
|
+
/** A constant constant is known at compile time. */
|
|
110
|
+
static const pm_constant_pool_bucket_type_t PM_CONSTANT_POOL_BUCKET_CONSTANT = 2;
|
|
111
|
+
|
|
112
|
+
/** A bucket in the hash map. */
|
|
113
|
+
typedef struct {
|
|
114
|
+
/** The incremental ID used for indexing back into the pool. */
|
|
115
|
+
unsigned int id: 30;
|
|
116
|
+
|
|
117
|
+
/** The type of the bucket, which determines how to free it. */
|
|
118
|
+
pm_constant_pool_bucket_type_t type: 2;
|
|
119
|
+
|
|
120
|
+
/** The hash of the bucket. */
|
|
121
|
+
uint32_t hash;
|
|
122
|
+
} pm_constant_pool_bucket_t;
|
|
123
|
+
|
|
124
|
+
/** A constant in the pool which effectively stores a string. */
|
|
125
|
+
typedef struct {
|
|
126
|
+
/** A pointer to the start of the string. */
|
|
127
|
+
const uint8_t *start;
|
|
128
|
+
|
|
129
|
+
/** The length of the string. */
|
|
130
|
+
size_t length;
|
|
131
|
+
} pm_constant_t;
|
|
132
|
+
|
|
133
|
+
/** The overall constant pool, which stores constants found while parsing. */
|
|
134
|
+
typedef struct {
|
|
135
|
+
/** The buckets in the hash map. */
|
|
136
|
+
pm_constant_pool_bucket_t *buckets;
|
|
137
|
+
|
|
138
|
+
/** The constants that are stored in the buckets. */
|
|
139
|
+
pm_constant_t *constants;
|
|
140
|
+
|
|
141
|
+
/** The number of buckets in the hash map. */
|
|
142
|
+
uint32_t size;
|
|
143
|
+
|
|
144
|
+
/** The number of buckets that have been allocated in the hash map. */
|
|
145
|
+
uint32_t capacity;
|
|
146
|
+
} pm_constant_pool_t;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Initialize a new constant pool with a given capacity.
|
|
150
|
+
*
|
|
151
|
+
* @param pool The pool to initialize.
|
|
152
|
+
* @param capacity The initial capacity of the pool.
|
|
153
|
+
* @return Whether the initialization succeeded.
|
|
154
|
+
*/
|
|
155
|
+
bool pm_constant_pool_init(pm_constant_pool_t *pool, uint32_t capacity);
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Return a pointer to the constant indicated by the given constant id.
|
|
159
|
+
*
|
|
160
|
+
* @param pool The pool to get the constant from.
|
|
161
|
+
* @param constant_id The id of the constant to get.
|
|
162
|
+
* @return A pointer to the constant.
|
|
163
|
+
*/
|
|
164
|
+
pm_constant_t * pm_constant_pool_id_to_constant(const pm_constant_pool_t *pool, pm_constant_id_t constant_id);
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Find a constant in a constant pool. Returns the id of the constant, or 0 if
|
|
168
|
+
* the constant is not found.
|
|
169
|
+
*
|
|
170
|
+
* @param pool The pool to find the constant in.
|
|
171
|
+
* @param start A pointer to the start of the constant.
|
|
172
|
+
* @param length The length of the constant.
|
|
173
|
+
* @return The id of the constant.
|
|
174
|
+
*/
|
|
175
|
+
pm_constant_id_t pm_constant_pool_find(const pm_constant_pool_t *pool, const uint8_t *start, size_t length);
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Insert a constant into a constant pool that is a slice of a source string.
|
|
179
|
+
* Returns the id of the constant, or 0 if any potential calls to resize fail.
|
|
180
|
+
*
|
|
181
|
+
* @param pool The pool to insert the constant into.
|
|
182
|
+
* @param start A pointer to the start of the constant.
|
|
183
|
+
* @param length The length of the constant.
|
|
184
|
+
* @return The id of the constant.
|
|
185
|
+
*/
|
|
186
|
+
pm_constant_id_t pm_constant_pool_insert_shared(pm_constant_pool_t *pool, const uint8_t *start, size_t length);
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Insert a constant into a constant pool from memory that is now owned by the
|
|
190
|
+
* constant pool. Returns the id of the constant, or 0 if any potential calls to
|
|
191
|
+
* resize fail.
|
|
192
|
+
*
|
|
193
|
+
* @param pool The pool to insert the constant into.
|
|
194
|
+
* @param start A pointer to the start of the constant.
|
|
195
|
+
* @param length The length of the constant.
|
|
196
|
+
* @return The id of the constant.
|
|
197
|
+
*/
|
|
198
|
+
pm_constant_id_t pm_constant_pool_insert_owned(pm_constant_pool_t *pool, uint8_t *start, size_t length);
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Insert a constant into a constant pool from memory that is constant. Returns
|
|
202
|
+
* the id of the constant, or 0 if any potential calls to resize fail.
|
|
203
|
+
*
|
|
204
|
+
* @param pool The pool to insert the constant into.
|
|
205
|
+
* @param start A pointer to the start of the constant.
|
|
206
|
+
* @param length The length of the constant.
|
|
207
|
+
* @return The id of the constant.
|
|
208
|
+
*/
|
|
209
|
+
pm_constant_id_t pm_constant_pool_insert_constant(pm_constant_pool_t *pool, const uint8_t *start, size_t length);
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Free the memory associated with a constant pool.
|
|
213
|
+
*
|
|
214
|
+
* @param pool The pool to free.
|
|
215
|
+
*/
|
|
216
|
+
void pm_constant_pool_free(pm_constant_pool_t *pool);
|
|
217
|
+
|
|
218
|
+
#endif
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file pm_integer.h
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions for working with arbitrary-sized integers.
|
|
5
|
+
*/
|
|
6
|
+
#ifndef PRISM_NUMBER_H
|
|
7
|
+
#define PRISM_NUMBER_H
|
|
8
|
+
|
|
9
|
+
#include "prism/defines.h"
|
|
10
|
+
#include "prism/util/pm_buffer.h"
|
|
11
|
+
|
|
12
|
+
#include <assert.h>
|
|
13
|
+
#include <stdbool.h>
|
|
14
|
+
#include <stdint.h>
|
|
15
|
+
#include <stdlib.h>
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A structure represents an arbitrary-sized integer.
|
|
19
|
+
*/
|
|
20
|
+
typedef struct {
|
|
21
|
+
/**
|
|
22
|
+
* The number of allocated values. length is set to 0 if the integer fits
|
|
23
|
+
* into uint32_t.
|
|
24
|
+
*/
|
|
25
|
+
size_t length;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* List of 32-bit integers. Set to NULL if the integer fits into uint32_t.
|
|
29
|
+
*/
|
|
30
|
+
uint32_t *values;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Embedded value for small integer. This value is set to 0 if the value
|
|
34
|
+
* does not fit into uint32_t.
|
|
35
|
+
*/
|
|
36
|
+
uint32_t value;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Whether or not the integer is negative. It is stored this way so that a
|
|
40
|
+
* zeroed pm_integer_t is always positive zero.
|
|
41
|
+
*/
|
|
42
|
+
bool negative;
|
|
43
|
+
} pm_integer_t;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* An enum controlling the base of an integer. It is expected that the base is
|
|
47
|
+
* already known before parsing the integer, even though it could be derived
|
|
48
|
+
* from the string itself.
|
|
49
|
+
*/
|
|
50
|
+
typedef enum {
|
|
51
|
+
/** The default decimal base, with no prefix. Leading 0s will be ignored. */
|
|
52
|
+
PM_INTEGER_BASE_DEFAULT,
|
|
53
|
+
|
|
54
|
+
/** The binary base, indicated by a 0b or 0B prefix. */
|
|
55
|
+
PM_INTEGER_BASE_BINARY,
|
|
56
|
+
|
|
57
|
+
/** The octal base, indicated by a 0, 0o, or 0O prefix. */
|
|
58
|
+
PM_INTEGER_BASE_OCTAL,
|
|
59
|
+
|
|
60
|
+
/** The decimal base, indicated by a 0d, 0D, or empty prefix. */
|
|
61
|
+
PM_INTEGER_BASE_DECIMAL,
|
|
62
|
+
|
|
63
|
+
/** The hexadecimal base, indicated by a 0x or 0X prefix. */
|
|
64
|
+
PM_INTEGER_BASE_HEXADECIMAL,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* An unknown base, in which case pm_integer_parse will derive it based on
|
|
68
|
+
* the content of the string. This is less efficient and does more
|
|
69
|
+
* comparisons, so if callers know the base ahead of time, they should use
|
|
70
|
+
* that instead.
|
|
71
|
+
*/
|
|
72
|
+
PM_INTEGER_BASE_UNKNOWN
|
|
73
|
+
} pm_integer_base_t;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Parse an integer from a string. This assumes that the format of the integer
|
|
77
|
+
* has already been validated, as internal validation checks are not performed
|
|
78
|
+
* here.
|
|
79
|
+
*
|
|
80
|
+
* @param integer The integer to parse into.
|
|
81
|
+
* @param base The base of the integer.
|
|
82
|
+
* @param start The start of the string.
|
|
83
|
+
* @param end The end of the string.
|
|
84
|
+
*/
|
|
85
|
+
void pm_integer_parse(pm_integer_t *integer, pm_integer_base_t base, const uint8_t *start, const uint8_t *end);
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Compare two integers. This function returns -1 if the left integer is less
|
|
89
|
+
* than the right integer, 0 if they are equal, and 1 if the left integer is
|
|
90
|
+
* greater than the right integer.
|
|
91
|
+
*
|
|
92
|
+
* @param left The left integer to compare.
|
|
93
|
+
* @param right The right integer to compare.
|
|
94
|
+
* @return The result of the comparison.
|
|
95
|
+
*/
|
|
96
|
+
int pm_integer_compare(const pm_integer_t *left, const pm_integer_t *right);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Reduce a ratio of integers to its simplest form.
|
|
100
|
+
*
|
|
101
|
+
* If either the numerator or denominator do not fit into a 32-bit integer, then
|
|
102
|
+
* this function is a no-op. In the future, we may consider reducing even the
|
|
103
|
+
* larger numbers, but for now we're going to keep it simple.
|
|
104
|
+
*
|
|
105
|
+
* @param numerator The numerator of the ratio.
|
|
106
|
+
* @param denominator The denominator of the ratio.
|
|
107
|
+
*/
|
|
108
|
+
void pm_integers_reduce(pm_integer_t *numerator, pm_integer_t *denominator);
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Convert an integer to a decimal string.
|
|
112
|
+
*
|
|
113
|
+
* @param buffer The buffer to append the string to.
|
|
114
|
+
* @param integer The integer to convert to a string.
|
|
115
|
+
*
|
|
116
|
+
* \public \memberof pm_integer_t
|
|
117
|
+
*/
|
|
118
|
+
PRISM_EXPORTED_FUNCTION void pm_integer_string(pm_buffer_t *buffer, const pm_integer_t *integer);
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Free the internal memory of an integer. This memory will only be allocated if
|
|
122
|
+
* the integer exceeds the size of a single node in the linked list.
|
|
123
|
+
*
|
|
124
|
+
* @param integer The integer to free.
|
|
125
|
+
*
|
|
126
|
+
* \public \memberof pm_integer_t
|
|
127
|
+
*/
|
|
128
|
+
PRISM_EXPORTED_FUNCTION void pm_integer_free(pm_integer_t *integer);
|
|
129
|
+
|
|
130
|
+
#endif
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file pm_list.h
|
|
3
|
+
*
|
|
4
|
+
* An abstract linked list.
|
|
5
|
+
*/
|
|
6
|
+
#ifndef PRISM_LIST_H
|
|
7
|
+
#define PRISM_LIST_H
|
|
8
|
+
|
|
9
|
+
#include "prism/defines.h"
|
|
10
|
+
|
|
11
|
+
#include <stdbool.h>
|
|
12
|
+
#include <stddef.h>
|
|
13
|
+
#include <stdint.h>
|
|
14
|
+
#include <stdlib.h>
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This struct represents an abstract linked list that provides common
|
|
18
|
+
* functionality. It is meant to be used any time a linked list is necessary to
|
|
19
|
+
* store data.
|
|
20
|
+
*
|
|
21
|
+
* The linked list itself operates off a set of pointers. Because the pointers
|
|
22
|
+
* are not necessarily sequential, they can be of any size. We use this fact to
|
|
23
|
+
* allow the consumer of this linked list to extend the node struct to include
|
|
24
|
+
* any data they want. This is done by using the pm_list_node_t as the first
|
|
25
|
+
* member of the struct.
|
|
26
|
+
*
|
|
27
|
+
* For example, if we want to store a list of integers, we can do the following:
|
|
28
|
+
*
|
|
29
|
+
* ```c
|
|
30
|
+
* typedef struct {
|
|
31
|
+
* pm_list_node_t node;
|
|
32
|
+
* int value;
|
|
33
|
+
* } pm_int_node_t;
|
|
34
|
+
*
|
|
35
|
+
* pm_list_t list = { 0 };
|
|
36
|
+
* pm_int_node_t *node = xmalloc(sizeof(pm_int_node_t));
|
|
37
|
+
* node->value = 5;
|
|
38
|
+
*
|
|
39
|
+
* pm_list_append(&list, &node->node);
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* The pm_list_t struct is used to represent the overall linked list. It
|
|
43
|
+
* contains a pointer to the head and tail of the list. This allows for easy
|
|
44
|
+
* iteration and appending of new nodes.
|
|
45
|
+
*/
|
|
46
|
+
typedef struct pm_list_node {
|
|
47
|
+
/** A pointer to the next node in the list. */
|
|
48
|
+
struct pm_list_node *next;
|
|
49
|
+
} pm_list_node_t;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* This represents the overall linked list. It keeps a pointer to the head and
|
|
53
|
+
* tail so that iteration is easy and pushing new nodes is easy.
|
|
54
|
+
*/
|
|
55
|
+
typedef struct {
|
|
56
|
+
/** The size of the list. */
|
|
57
|
+
size_t size;
|
|
58
|
+
|
|
59
|
+
/** A pointer to the head of the list. */
|
|
60
|
+
pm_list_node_t *head;
|
|
61
|
+
|
|
62
|
+
/** A pointer to the tail of the list. */
|
|
63
|
+
pm_list_node_t *tail;
|
|
64
|
+
} pm_list_t;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns true if the given list is empty.
|
|
68
|
+
*
|
|
69
|
+
* @param list The list to check.
|
|
70
|
+
* @return True if the given list is empty, otherwise false.
|
|
71
|
+
*
|
|
72
|
+
* \public \memberof pm_list_t
|
|
73
|
+
*/
|
|
74
|
+
PRISM_EXPORTED_FUNCTION bool pm_list_empty_p(pm_list_t *list);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns the size of the list.
|
|
78
|
+
*
|
|
79
|
+
* @param list The list to check.
|
|
80
|
+
* @return The size of the list.
|
|
81
|
+
*
|
|
82
|
+
* \public \memberof pm_list_t
|
|
83
|
+
*/
|
|
84
|
+
PRISM_EXPORTED_FUNCTION size_t pm_list_size(pm_list_t *list);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Append a node to the given list.
|
|
88
|
+
*
|
|
89
|
+
* @param list The list to append to.
|
|
90
|
+
* @param node The node to append.
|
|
91
|
+
*/
|
|
92
|
+
void pm_list_append(pm_list_t *list, pm_list_node_t *node);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Deallocate the internal state of the given list.
|
|
96
|
+
*
|
|
97
|
+
* @param list The list to free.
|
|
98
|
+
*
|
|
99
|
+
* \public \memberof pm_list_t
|
|
100
|
+
*/
|
|
101
|
+
PRISM_EXPORTED_FUNCTION void pm_list_free(pm_list_t *list);
|
|
102
|
+
|
|
103
|
+
#endif
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file pm_memchr.h
|
|
3
|
+
*
|
|
4
|
+
* A custom memchr implementation.
|
|
5
|
+
*/
|
|
6
|
+
#ifndef PRISM_MEMCHR_H
|
|
7
|
+
#define PRISM_MEMCHR_H
|
|
8
|
+
|
|
9
|
+
#include "prism/defines.h"
|
|
10
|
+
#include "prism/encoding.h"
|
|
11
|
+
|
|
12
|
+
#include <stddef.h>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* We need to roll our own memchr to handle cases where the encoding changes and
|
|
16
|
+
* we need to search for a character in a buffer that could be the trailing byte
|
|
17
|
+
* of a multibyte character.
|
|
18
|
+
*
|
|
19
|
+
* @param source The source string.
|
|
20
|
+
* @param character The character to search for.
|
|
21
|
+
* @param number The maximum number of bytes to search.
|
|
22
|
+
* @param encoding_changed Whether the encoding changed.
|
|
23
|
+
* @param encoding A pointer to the encoding.
|
|
24
|
+
* @return A pointer to the first occurrence of the character in the source
|
|
25
|
+
* string, or NULL if no such character exists.
|
|
26
|
+
*/
|
|
27
|
+
void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding);
|
|
28
|
+
|
|
29
|
+
#endif
|