debase-ruby_core_source 4.0.1 → 4.1.0.preview1
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/CHANGELOG.md +4 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/addr2line.h +22 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/builtin.h +127 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/build_assert/build_assert.h +40 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/check_type/check_type.h +63 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/container_of/container_of.h +142 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/list/list.h +791 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/str/str.h +17 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/constant.h +53 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/darray.h +295 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/debug_counter.h +428 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/dln.h +33 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/encindex.h +70 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/eval_intern.h +356 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/hrtime.h +237 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/id.h +365 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/id_table.h +74 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/insns.inc +315 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/insns_info.inc +11637 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/array.h +158 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/basic_operators.h +67 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/bignum.h +249 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/bits.h +647 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/box.h +103 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/class.h +797 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/cmdlineopt.h +64 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/compar.h +30 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/compile.h +34 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/compilers.h +104 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/complex.h +29 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/concurrent_set.h +21 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/cont.h +33 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/coverage.h +51 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/dir.h +16 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/enc.h +19 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/encoding.h +40 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/enum.h +18 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/enumerator.h +21 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/error.h +287 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/eval.h +43 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/file.h +40 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/fixnum.h +185 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/gc.h +411 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/hash.h +220 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/imemo.h +302 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/inits.h +54 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/io.h +167 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/io_buffer.h +36 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/jit.h +23 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/load.h +20 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/loadpath.h +16 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/marshal.h +17 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/math.h +23 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/missing.h +19 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/numeric.h +326 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/object.h +88 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/objspace.h +24 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/parse.h +131 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/proc.h +34 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/process.h +124 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/ractor.h +9 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/random.h +17 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/range.h +46 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/rational.h +92 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/re.h +87 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/ruby_parser.h +109 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/sanitizers.h +346 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/scheduler.h +7 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/serial.h +23 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/set.h +20 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/set_table.h +77 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/signal.h +25 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/simd.h +18 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/st.h +32 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/static_assert.h +16 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/string.h +240 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/struct.h +120 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/symbol.h +46 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/thread.h +108 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/time.h +34 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/transcode.h +23 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/util.h +27 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/variable.h +81 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/vm.h +144 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/vm_map.h +95 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/warnings.h +16 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal.h +106 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/iseq.h +439 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/known_errors.inc +1419 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/method.h +279 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/node.h +122 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/node_name.inc +224 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/optinsn.inc +128 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/optunifs.inc +41 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parse.h +246 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_bits.h +647 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_node.h +32 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_st.h +161 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_value.h +116 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/arena.h +37 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/ast.h +10371 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/buffer.h +52 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/comments.h +43 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/accel.h +19 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/align.h +36 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/assume.h +25 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/exported.h +24 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/fallthrough.h +22 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/filesystem.h +32 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/flex_array.h +19 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/force_inline.h +21 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/format.h +25 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/inline.h +17 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/nodiscard.h +22 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/nonnull.h +18 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/unused.h +18 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/constant_pool.h +81 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/diagnostic.h +93 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/errors_format.h +53 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/excludes.h +29 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/extension.h +19 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/integer.h +41 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/allocator.h +68 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/allocator_debug.h +88 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/arena.h +108 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/bit.h +42 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/buffer.h +91 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/char.h +139 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/comments.h +20 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/constant_pool.h +152 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/diagnostic.h +389 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/encoding.h +242 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/integer.h +68 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/isinf.h +16 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/line_offset_list.h +34 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/list.h +62 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/magic_comments.h +23 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/memchr.h +15 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/node.h +32 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/options.h +224 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/parser.h +971 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/regexp.h +42 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/serialize.h +39 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/source.h +72 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/static_literals.h +100 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/stringy.h +35 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/strncasecmp.h +18 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/strpbrk.h +33 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/tokens.h +11 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/json.h +32 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/line_offset_list.h +61 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/magic_comments.h +35 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/node.h +94 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/options.h +335 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/parser.h +348 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/prettyprint.h +31 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/prism.h +131 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/serialize.h +115 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/source.h +155 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/stream.h +28 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/string_query.h +63 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/stringy.h +72 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/version.h +38 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism_compile.h +204 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism_xallocator.h +6 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/probes_helper.h +42 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ractor_core.h +421 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/regenc.h +261 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/regint.h +983 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/regparse.h +371 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/revision.h +5 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ruby_assert.h +14 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ruby_atomic.h +115 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/rubyparser.h +1389 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/shape.h +733 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/siphash.h +48 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/symbol.h +116 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_none.h +25 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_pthread.h +63 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_sched.h +271 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_win32.h +48 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/timev.h +58 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/transcode_data.h +138 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/variable.h +26 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/version.h +69 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm.inc +6457 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_call_iseq_optimized.inc +244 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_callinfo.h +688 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_core.h +2509 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_debug.h +124 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_exec.h +202 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_insnhelper.h +280 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_opts.h +65 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_sync.h +160 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vmtc.inc +302 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/yjit.h +87 -0
- data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/zjit.h +221 -0
- data/lib/debase/ruby_core_source/version.rb +1 -1
- metadata +2930 -2724
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
#ifndef PRISM_INTERNAL_ENCODING_H
|
|
2
|
+
#define PRISM_INTERNAL_ENCODING_H
|
|
3
|
+
|
|
4
|
+
#include <stdbool.h>
|
|
5
|
+
#include <stddef.h>
|
|
6
|
+
#include <stdint.h>
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* This struct defines the functions necessary to implement the encoding
|
|
10
|
+
* interface so we can determine how many bytes the subsequent character takes.
|
|
11
|
+
* Each callback should return the number of bytes, or 0 if the next bytes are
|
|
12
|
+
* invalid for the encoding and type.
|
|
13
|
+
*/
|
|
14
|
+
typedef struct {
|
|
15
|
+
/*
|
|
16
|
+
* Return the number of bytes that the next character takes if it is valid
|
|
17
|
+
* in the encoding. Does not read more than n bytes. It is assumed that n is
|
|
18
|
+
* at least 1.
|
|
19
|
+
*/
|
|
20
|
+
size_t (*char_width)(const uint8_t *b, ptrdiff_t n);
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* Return the number of bytes that the next character takes if it is valid
|
|
24
|
+
* in the encoding and is alphabetical. Does not read more than n bytes. It
|
|
25
|
+
* is assumed that n is at least 1.
|
|
26
|
+
*/
|
|
27
|
+
size_t (*alpha_char)(const uint8_t *b, ptrdiff_t n);
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* Return the number of bytes that the next character takes if it is valid
|
|
31
|
+
* in the encoding and is alphanumeric. Does not read more than n bytes. It
|
|
32
|
+
* is assumed that n is at least 1.
|
|
33
|
+
*/
|
|
34
|
+
size_t (*alnum_char)(const uint8_t *b, ptrdiff_t n);
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* Return true if the next character is valid in the encoding and is an
|
|
38
|
+
* uppercase character. Does not read more than n bytes. It is assumed that
|
|
39
|
+
* n is at least 1.
|
|
40
|
+
*/
|
|
41
|
+
bool (*isupper_char)(const uint8_t *b, ptrdiff_t n);
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* The name of the encoding. This should correspond to a value that can be
|
|
45
|
+
* passed to Encoding.find in Ruby.
|
|
46
|
+
*/
|
|
47
|
+
const char *name;
|
|
48
|
+
|
|
49
|
+
/* Return true if the encoding is a multibyte encoding. */
|
|
50
|
+
bool multibyte;
|
|
51
|
+
} pm_encoding_t;
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
* All of the lookup tables use the first bit of each embedded byte to indicate
|
|
55
|
+
* whether the codepoint is alphabetical.
|
|
56
|
+
*/
|
|
57
|
+
#define PRISM_ENCODING_ALPHABETIC_BIT 1 << 0
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* All of the lookup tables use the second bit of each embedded byte to indicate
|
|
61
|
+
* whether the codepoint is alphanumeric.
|
|
62
|
+
*/
|
|
63
|
+
#define PRISM_ENCODING_ALPHANUMERIC_BIT 1 << 1
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* All of the lookup tables use the third bit of each embedded byte to indicate
|
|
67
|
+
* whether the codepoint is uppercase.
|
|
68
|
+
*/
|
|
69
|
+
#define PRISM_ENCODING_UPPERCASE_BIT 1 << 2
|
|
70
|
+
|
|
71
|
+
/* Return the size of the next character in the UTF-8 encoding. */
|
|
72
|
+
size_t pm_encoding_utf_8_char_width(const uint8_t *b, ptrdiff_t n);
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Return the size of the next character in the UTF-8 encoding if it is an
|
|
76
|
+
* alphabetical character.
|
|
77
|
+
*/
|
|
78
|
+
size_t pm_encoding_utf_8_alpha_char(const uint8_t *b, ptrdiff_t n);
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
* Return the size of the next character in the UTF-8 encoding if it is an
|
|
82
|
+
* alphanumeric character.
|
|
83
|
+
*/
|
|
84
|
+
size_t pm_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n);
|
|
85
|
+
|
|
86
|
+
/*
|
|
87
|
+
* Return true if the next character in the UTF-8 encoding if it is an uppercase
|
|
88
|
+
* character.
|
|
89
|
+
*/
|
|
90
|
+
bool pm_encoding_utf_8_isupper_char(const uint8_t *b, ptrdiff_t n);
|
|
91
|
+
|
|
92
|
+
/*
|
|
93
|
+
* This lookup table is referenced in both the UTF-8 encoding file and the
|
|
94
|
+
* parser directly in order to speed up the default encoding processing. It is
|
|
95
|
+
* used to indicate whether a character is alphabetical, alphanumeric, or
|
|
96
|
+
* uppercase in unicode mappings.
|
|
97
|
+
*/
|
|
98
|
+
extern const uint8_t pm_encoding_unicode_table[256];
|
|
99
|
+
|
|
100
|
+
/* These are all of the encodings that prism supports. */
|
|
101
|
+
typedef enum {
|
|
102
|
+
PM_ENCODING_UTF_8 = 0,
|
|
103
|
+
PM_ENCODING_US_ASCII,
|
|
104
|
+
PM_ENCODING_ASCII_8BIT,
|
|
105
|
+
PM_ENCODING_EUC_JP,
|
|
106
|
+
PM_ENCODING_WINDOWS_31J,
|
|
107
|
+
|
|
108
|
+
/* We optionally support excluding the full set of encodings to only support the
|
|
109
|
+
* minimum necessary to process Ruby code without encoding comments. */
|
|
110
|
+
#ifndef PRISM_ENCODING_EXCLUDE_FULL
|
|
111
|
+
PM_ENCODING_BIG5,
|
|
112
|
+
PM_ENCODING_BIG5_HKSCS,
|
|
113
|
+
PM_ENCODING_BIG5_UAO,
|
|
114
|
+
PM_ENCODING_CESU_8,
|
|
115
|
+
PM_ENCODING_CP51932,
|
|
116
|
+
PM_ENCODING_CP850,
|
|
117
|
+
PM_ENCODING_CP852,
|
|
118
|
+
PM_ENCODING_CP855,
|
|
119
|
+
PM_ENCODING_CP949,
|
|
120
|
+
PM_ENCODING_CP950,
|
|
121
|
+
PM_ENCODING_CP951,
|
|
122
|
+
PM_ENCODING_EMACS_MULE,
|
|
123
|
+
PM_ENCODING_EUC_JP_MS,
|
|
124
|
+
PM_ENCODING_EUC_JIS_2004,
|
|
125
|
+
PM_ENCODING_EUC_KR,
|
|
126
|
+
PM_ENCODING_EUC_TW,
|
|
127
|
+
PM_ENCODING_GB12345,
|
|
128
|
+
PM_ENCODING_GB18030,
|
|
129
|
+
PM_ENCODING_GB1988,
|
|
130
|
+
PM_ENCODING_GB2312,
|
|
131
|
+
PM_ENCODING_GBK,
|
|
132
|
+
PM_ENCODING_IBM437,
|
|
133
|
+
PM_ENCODING_IBM720,
|
|
134
|
+
PM_ENCODING_IBM737,
|
|
135
|
+
PM_ENCODING_IBM775,
|
|
136
|
+
PM_ENCODING_IBM852,
|
|
137
|
+
PM_ENCODING_IBM855,
|
|
138
|
+
PM_ENCODING_IBM857,
|
|
139
|
+
PM_ENCODING_IBM860,
|
|
140
|
+
PM_ENCODING_IBM861,
|
|
141
|
+
PM_ENCODING_IBM862,
|
|
142
|
+
PM_ENCODING_IBM863,
|
|
143
|
+
PM_ENCODING_IBM864,
|
|
144
|
+
PM_ENCODING_IBM865,
|
|
145
|
+
PM_ENCODING_IBM866,
|
|
146
|
+
PM_ENCODING_IBM869,
|
|
147
|
+
PM_ENCODING_ISO_8859_1,
|
|
148
|
+
PM_ENCODING_ISO_8859_2,
|
|
149
|
+
PM_ENCODING_ISO_8859_3,
|
|
150
|
+
PM_ENCODING_ISO_8859_4,
|
|
151
|
+
PM_ENCODING_ISO_8859_5,
|
|
152
|
+
PM_ENCODING_ISO_8859_6,
|
|
153
|
+
PM_ENCODING_ISO_8859_7,
|
|
154
|
+
PM_ENCODING_ISO_8859_8,
|
|
155
|
+
PM_ENCODING_ISO_8859_9,
|
|
156
|
+
PM_ENCODING_ISO_8859_10,
|
|
157
|
+
PM_ENCODING_ISO_8859_11,
|
|
158
|
+
PM_ENCODING_ISO_8859_13,
|
|
159
|
+
PM_ENCODING_ISO_8859_14,
|
|
160
|
+
PM_ENCODING_ISO_8859_15,
|
|
161
|
+
PM_ENCODING_ISO_8859_16,
|
|
162
|
+
PM_ENCODING_KOI8_R,
|
|
163
|
+
PM_ENCODING_KOI8_U,
|
|
164
|
+
PM_ENCODING_MAC_CENT_EURO,
|
|
165
|
+
PM_ENCODING_MAC_CROATIAN,
|
|
166
|
+
PM_ENCODING_MAC_CYRILLIC,
|
|
167
|
+
PM_ENCODING_MAC_GREEK,
|
|
168
|
+
PM_ENCODING_MAC_ICELAND,
|
|
169
|
+
PM_ENCODING_MAC_JAPANESE,
|
|
170
|
+
PM_ENCODING_MAC_ROMAN,
|
|
171
|
+
PM_ENCODING_MAC_ROMANIA,
|
|
172
|
+
PM_ENCODING_MAC_THAI,
|
|
173
|
+
PM_ENCODING_MAC_TURKISH,
|
|
174
|
+
PM_ENCODING_MAC_UKRAINE,
|
|
175
|
+
PM_ENCODING_SHIFT_JIS,
|
|
176
|
+
PM_ENCODING_SJIS_DOCOMO,
|
|
177
|
+
PM_ENCODING_SJIS_KDDI,
|
|
178
|
+
PM_ENCODING_SJIS_SOFTBANK,
|
|
179
|
+
PM_ENCODING_STATELESS_ISO_2022_JP,
|
|
180
|
+
PM_ENCODING_STATELESS_ISO_2022_JP_KDDI,
|
|
181
|
+
PM_ENCODING_TIS_620,
|
|
182
|
+
PM_ENCODING_UTF8_MAC,
|
|
183
|
+
PM_ENCODING_UTF8_DOCOMO,
|
|
184
|
+
PM_ENCODING_UTF8_KDDI,
|
|
185
|
+
PM_ENCODING_UTF8_SOFTBANK,
|
|
186
|
+
PM_ENCODING_WINDOWS_1250,
|
|
187
|
+
PM_ENCODING_WINDOWS_1251,
|
|
188
|
+
PM_ENCODING_WINDOWS_1252,
|
|
189
|
+
PM_ENCODING_WINDOWS_1253,
|
|
190
|
+
PM_ENCODING_WINDOWS_1254,
|
|
191
|
+
PM_ENCODING_WINDOWS_1255,
|
|
192
|
+
PM_ENCODING_WINDOWS_1256,
|
|
193
|
+
PM_ENCODING_WINDOWS_1257,
|
|
194
|
+
PM_ENCODING_WINDOWS_1258,
|
|
195
|
+
PM_ENCODING_WINDOWS_874,
|
|
196
|
+
#endif
|
|
197
|
+
|
|
198
|
+
PM_ENCODING_MAXIMUM
|
|
199
|
+
} pm_encoding_type_t;
|
|
200
|
+
|
|
201
|
+
/* This is the table of all of the encodings that prism supports. */
|
|
202
|
+
extern const pm_encoding_t pm_encodings[PM_ENCODING_MAXIMUM];
|
|
203
|
+
|
|
204
|
+
/*
|
|
205
|
+
* This is the default UTF-8 encoding. We need a reference to it to quickly
|
|
206
|
+
* create parsers.
|
|
207
|
+
*/
|
|
208
|
+
#define PM_ENCODING_UTF_8_ENTRY (&pm_encodings[PM_ENCODING_UTF_8])
|
|
209
|
+
|
|
210
|
+
/*
|
|
211
|
+
* This is the US-ASCII encoding. We need a reference to it to be able to
|
|
212
|
+
* compare against it when a string is being created because it could possibly
|
|
213
|
+
* need to fall back to ASCII-8BIT.
|
|
214
|
+
*/
|
|
215
|
+
#define PM_ENCODING_US_ASCII_ENTRY (&pm_encodings[PM_ENCODING_US_ASCII])
|
|
216
|
+
|
|
217
|
+
/*
|
|
218
|
+
* This is the ASCII-8BIT encoding. We need a reference to it so that pm_strpbrk
|
|
219
|
+
* can compare against it because invalid multibyte characters are not a thing
|
|
220
|
+
* in this encoding. It is also needed for handling Regexp encoding flags.
|
|
221
|
+
*/
|
|
222
|
+
#define PM_ENCODING_ASCII_8BIT_ENTRY (&pm_encodings[PM_ENCODING_ASCII_8BIT])
|
|
223
|
+
|
|
224
|
+
/*
|
|
225
|
+
* This is the EUC-JP encoding. We need a reference to it to quickly process
|
|
226
|
+
* regular expression modifiers.
|
|
227
|
+
*/
|
|
228
|
+
#define PM_ENCODING_EUC_JP_ENTRY (&pm_encodings[PM_ENCODING_EUC_JP])
|
|
229
|
+
|
|
230
|
+
/*
|
|
231
|
+
* This is the Windows-31J encoding. We need a reference to it to quickly
|
|
232
|
+
* process regular expression modifiers.
|
|
233
|
+
*/
|
|
234
|
+
#define PM_ENCODING_WINDOWS_31J_ENTRY (&pm_encodings[PM_ENCODING_WINDOWS_31J])
|
|
235
|
+
|
|
236
|
+
/*
|
|
237
|
+
* Parse the given name of an encoding and return a pointer to the corresponding
|
|
238
|
+
* encoding struct if one can be found, otherwise return NULL.
|
|
239
|
+
*/
|
|
240
|
+
const pm_encoding_t * pm_encoding_find(const uint8_t *start, const uint8_t *end);
|
|
241
|
+
|
|
242
|
+
#endif
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This module provides functions for working with arbitrary-sized integers.
|
|
3
|
+
*/
|
|
4
|
+
#ifndef PRISM_INTERNAL_INTEGER_H
|
|
5
|
+
#define PRISM_INTERNAL_INTEGER_H
|
|
6
|
+
|
|
7
|
+
#include "prism/buffer.h"
|
|
8
|
+
#include "prism/integer.h"
|
|
9
|
+
|
|
10
|
+
#include <stdint.h>
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* An enum controlling the base of an integer. It is expected that the base is
|
|
14
|
+
* already known before parsing the integer, even though it could be derived
|
|
15
|
+
* from the string itself.
|
|
16
|
+
*/
|
|
17
|
+
typedef enum {
|
|
18
|
+
/* The default decimal base, with no prefix. Leading 0s will be ignored. */
|
|
19
|
+
PM_INTEGER_BASE_DEFAULT,
|
|
20
|
+
|
|
21
|
+
/* The binary base, indicated by a 0b or 0B prefix. */
|
|
22
|
+
PM_INTEGER_BASE_BINARY,
|
|
23
|
+
|
|
24
|
+
/* The octal base, indicated by a 0, 0o, or 0O prefix. */
|
|
25
|
+
PM_INTEGER_BASE_OCTAL,
|
|
26
|
+
|
|
27
|
+
/* The decimal base, indicated by a 0d, 0D, or empty prefix. */
|
|
28
|
+
PM_INTEGER_BASE_DECIMAL,
|
|
29
|
+
|
|
30
|
+
/* The hexadecimal base, indicated by a 0x or 0X prefix. */
|
|
31
|
+
PM_INTEGER_BASE_HEXADECIMAL,
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* An unknown base, in which case pm_integer_parse will derive it based on
|
|
35
|
+
* the content of the string. This is less efficient and does more
|
|
36
|
+
* comparisons, so if callers know the base ahead of time, they should use
|
|
37
|
+
* that instead.
|
|
38
|
+
*/
|
|
39
|
+
PM_INTEGER_BASE_UNKNOWN
|
|
40
|
+
} pm_integer_base_t;
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* Parse an integer from a string. This assumes that the format of the integer
|
|
44
|
+
* has already been validated, as internal validation checks are not performed
|
|
45
|
+
* here.
|
|
46
|
+
*/
|
|
47
|
+
void pm_integer_parse(pm_integer_t *integer, pm_integer_base_t base, const uint8_t *start, const uint8_t *end);
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
* Compare two integers. This function returns -1 if the left integer is less
|
|
51
|
+
* than the right integer, 0 if they are equal, and 1 if the left integer is
|
|
52
|
+
* greater than the right integer.
|
|
53
|
+
*/
|
|
54
|
+
int pm_integer_compare(const pm_integer_t *left, const pm_integer_t *right);
|
|
55
|
+
|
|
56
|
+
/*
|
|
57
|
+
* Reduce a ratio of integers to its simplest form.
|
|
58
|
+
*
|
|
59
|
+
* If either the numerator or denominator do not fit into a 32-bit integer, then
|
|
60
|
+
* this function is a no-op. In the future, we may consider reducing even the
|
|
61
|
+
* larger numbers, but for now we're going to keep it simple.
|
|
62
|
+
*/
|
|
63
|
+
void pm_integers_reduce(pm_integer_t *numerator, pm_integer_t *denominator);
|
|
64
|
+
|
|
65
|
+
/* Convert an integer to a decimal string. */
|
|
66
|
+
void pm_integer_string(pm_buffer_t *buffer, const pm_integer_t *integer);
|
|
67
|
+
|
|
68
|
+
#endif
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef PRISM_INTERNAL_ISINF_H
|
|
2
|
+
#define PRISM_INTERNAL_ISINF_H
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* isinf on POSIX systems accepts a float, a double, or a long double. But mingw
|
|
6
|
+
* didn't provide an isinf macro, only an isinf function that only accepts
|
|
7
|
+
* floats, so we need to use _finite instead.
|
|
8
|
+
*/
|
|
9
|
+
#ifdef __MINGW64__
|
|
10
|
+
#include <float.h>
|
|
11
|
+
#define PRISM_ISINF(x) (!_finite(x))
|
|
12
|
+
#else
|
|
13
|
+
#define PRISM_ISINF(x) isinf(x)
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
#endif
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#ifndef PRISM_INTERNAL_LINE_OFFSET_LIST_H
|
|
2
|
+
#define PRISM_INTERNAL_LINE_OFFSET_LIST_H
|
|
3
|
+
|
|
4
|
+
#include "prism/compiler/force_inline.h"
|
|
5
|
+
|
|
6
|
+
#include "prism/arena.h"
|
|
7
|
+
#include "prism/line_offset_list.h"
|
|
8
|
+
|
|
9
|
+
/* Initialize a new line offset list with the given capacity. */
|
|
10
|
+
void pm_line_offset_list_init(pm_arena_t *arena, pm_line_offset_list_t *list, size_t capacity);
|
|
11
|
+
|
|
12
|
+
/* Clear out the offsets that have been appended to the list. */
|
|
13
|
+
void pm_line_offset_list_clear(pm_line_offset_list_t *list);
|
|
14
|
+
|
|
15
|
+
/* Append a new offset to the list (slow path with resize). */
|
|
16
|
+
void pm_line_offset_list_append_slow(pm_arena_t *arena, pm_line_offset_list_t *list, uint32_t cursor);
|
|
17
|
+
|
|
18
|
+
/* Append a new offset to the list. */
|
|
19
|
+
static PRISM_FORCE_INLINE void
|
|
20
|
+
pm_line_offset_list_append(pm_arena_t *arena, pm_line_offset_list_t *list, uint32_t cursor) {
|
|
21
|
+
if (list->size < list->capacity) {
|
|
22
|
+
list->offsets[list->size++] = cursor;
|
|
23
|
+
} else {
|
|
24
|
+
pm_line_offset_list_append_slow(arena, list, cursor);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* Returns the line of the given offset. If the offset is not in the list, the
|
|
30
|
+
* line of the closest offset less than the given offset is returned.
|
|
31
|
+
*/
|
|
32
|
+
int32_t pm_line_offset_list_line(const pm_line_offset_list_t *list, uint32_t cursor, int32_t start_line);
|
|
33
|
+
|
|
34
|
+
#endif
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#ifndef PRISM_INTERNAL_LIST_H
|
|
2
|
+
#define PRISM_INTERNAL_LIST_H
|
|
3
|
+
|
|
4
|
+
#include <stddef.h>
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* This struct represents an abstract linked list that provides common
|
|
8
|
+
* functionality. It is meant to be used any time a linked list is necessary to
|
|
9
|
+
* store data.
|
|
10
|
+
*
|
|
11
|
+
* The linked list itself operates off a set of pointers. Because the pointers
|
|
12
|
+
* are not necessarily sequential, they can be of any size. We use this fact to
|
|
13
|
+
* allow the consumer of this linked list to extend the node struct to include
|
|
14
|
+
* any data they want. This is done by using the pm_list_node_t as the first
|
|
15
|
+
* member of the struct.
|
|
16
|
+
*
|
|
17
|
+
* For example, if we want to store a list of integers, we can do the following:
|
|
18
|
+
*
|
|
19
|
+
* ```c
|
|
20
|
+
* typedef struct {
|
|
21
|
+
* pm_list_node_t node;
|
|
22
|
+
* int value;
|
|
23
|
+
* } pm_int_node_t;
|
|
24
|
+
*
|
|
25
|
+
* pm_list_t list = { 0 };
|
|
26
|
+
* pm_int_node_t *node = xmalloc(sizeof(pm_int_node_t));
|
|
27
|
+
* node->value = 5;
|
|
28
|
+
*
|
|
29
|
+
* pm_list_append(&list, &node->node);
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* The pm_list_t struct is used to represent the overall linked list. It
|
|
33
|
+
* contains a pointer to the head and tail of the list. This allows for easy
|
|
34
|
+
* iteration and appending of new nodes.
|
|
35
|
+
*/
|
|
36
|
+
typedef struct pm_list_node {
|
|
37
|
+
/* A pointer to the next node in the list. */
|
|
38
|
+
struct pm_list_node *next;
|
|
39
|
+
} pm_list_node_t;
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* This represents the overall linked list. It keeps a pointer to the head and
|
|
43
|
+
* tail so that iteration is easy and pushing new nodes is easy.
|
|
44
|
+
*/
|
|
45
|
+
typedef struct {
|
|
46
|
+
/* The size of the list. */
|
|
47
|
+
size_t size;
|
|
48
|
+
|
|
49
|
+
/* A pointer to the head of the list. */
|
|
50
|
+
pm_list_node_t *head;
|
|
51
|
+
|
|
52
|
+
/* A pointer to the tail of the list. */
|
|
53
|
+
pm_list_node_t *tail;
|
|
54
|
+
} pm_list_t;
|
|
55
|
+
|
|
56
|
+
/* Returns the size of the list. */
|
|
57
|
+
size_t pm_list_size(pm_list_t *list);
|
|
58
|
+
|
|
59
|
+
/* Append a node to the given list. */
|
|
60
|
+
void pm_list_append(pm_list_t *list, pm_list_node_t *node);
|
|
61
|
+
|
|
62
|
+
#endif
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#ifndef PRISM_INTERNAL_MAGIC_COMMENTS_H
|
|
2
|
+
#define PRISM_INTERNAL_MAGIC_COMMENTS_H
|
|
3
|
+
|
|
4
|
+
#include "prism/magic_comments.h"
|
|
5
|
+
|
|
6
|
+
#include "prism/internal/list.h"
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* This is a node in the linked list of magic comments that we've found while
|
|
10
|
+
* parsing.
|
|
11
|
+
*/
|
|
12
|
+
struct pm_magic_comment_t {
|
|
13
|
+
/* The embedded base node. */
|
|
14
|
+
pm_list_node_t node;
|
|
15
|
+
|
|
16
|
+
/* The key of the magic comment. */
|
|
17
|
+
pm_location_t key;
|
|
18
|
+
|
|
19
|
+
/* The value of the magic comment. */
|
|
20
|
+
pm_location_t value;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
#endif
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#ifndef PRISM_INTERNAL_MEMCHR_H
|
|
2
|
+
#define PRISM_INTERNAL_MEMCHR_H
|
|
3
|
+
|
|
4
|
+
#include "prism/internal/encoding.h"
|
|
5
|
+
|
|
6
|
+
#include <stddef.h>
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* We need to roll our own memchr to handle cases where the encoding changes and
|
|
10
|
+
* we need to search for a character in a buffer that could be the trailing byte
|
|
11
|
+
* of a multibyte character.
|
|
12
|
+
*/
|
|
13
|
+
const void * pm_memchr(const void *source, int character, size_t number, bool encoding_changed, const pm_encoding_t *encoding);
|
|
14
|
+
|
|
15
|
+
#endif
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#ifndef PRISM_INTERNAL_NODE_H
|
|
2
|
+
#define PRISM_INTERNAL_NODE_H
|
|
3
|
+
|
|
4
|
+
#include "prism/node.h"
|
|
5
|
+
|
|
6
|
+
#include "prism/compiler/force_inline.h"
|
|
7
|
+
|
|
8
|
+
#include "prism/arena.h"
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Slow path for pm_node_list_append: grow the list and append the node.
|
|
12
|
+
* Do not call directly — use pm_node_list_append instead.
|
|
13
|
+
*/
|
|
14
|
+
void pm_node_list_append_slow(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node);
|
|
15
|
+
|
|
16
|
+
/* Append a new node onto the end of the node list. */
|
|
17
|
+
static PRISM_FORCE_INLINE void
|
|
18
|
+
pm_node_list_append(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node) {
|
|
19
|
+
if (list->size < list->capacity) {
|
|
20
|
+
list->nodes[list->size++] = node;
|
|
21
|
+
} else {
|
|
22
|
+
pm_node_list_append_slow(arena, list, node);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Prepend a new node onto the beginning of the node list. */
|
|
27
|
+
void pm_node_list_prepend(pm_arena_t *arena, pm_node_list_t *list, pm_node_t *node);
|
|
28
|
+
|
|
29
|
+
/* Concatenate the given node list onto the end of the other node list. */
|
|
30
|
+
void pm_node_list_concat(pm_arena_t *arena, pm_node_list_t *list, pm_node_list_t *other);
|
|
31
|
+
|
|
32
|
+
#endif
|