debase-ruby_core_source 3.3.5 → 3.4.1

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.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/.idea/vcs.xml +28 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +14 -0
  6. data/Rakefile +3 -1
  7. data/debase-ruby_core_source.gemspec +1 -0
  8. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/builtin.h +7 -1
  9. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/darray.h +22 -6
  10. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/debug_counter.h +1 -1
  11. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/dln.h +0 -2
  12. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/id.h +9 -0
  13. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/insns.inc +10 -2
  14. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/insns_info.inc +819 -312
  15. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/array.h +1 -0
  16. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/basic_operators.h +2 -0
  17. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/bits.h +82 -0
  18. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/class.h +1 -1
  19. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/encoding.h +2 -0
  20. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/error.h +28 -0
  21. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/fixnum.h +1 -0
  22. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/gc.h +24 -28
  23. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/hash.h +1 -0
  24. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/imemo.h +7 -1
  25. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/io.h +4 -1
  26. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/parse.h +16 -3
  27. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/proc.h +1 -0
  28. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/ractor.h +4 -0
  29. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/sanitizers.h +60 -39
  30. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/string.h +34 -18
  31. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/thread.h +29 -0
  32. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/vm.h +3 -3
  33. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/known_errors.inc +103 -103
  34. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/method.h +1 -0
  35. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/optunifs.inc +1 -1
  36. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/parse.h +5 -4
  37. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/ast.h +2156 -453
  38. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/defines.h +44 -7
  39. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/diagnostic.h +24 -6
  40. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/extension.h +2 -2
  41. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/node.h +0 -21
  42. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/options.h +94 -3
  43. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/parser.h +82 -40
  44. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/prism.h +47 -11
  45. data/lib/debase/ruby_core_source/ruby-3.4.0-p-1/prism/regexp.h +43 -0
  46. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/static_literals.h +3 -2
  47. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_char.h +1 -2
  48. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_constant_pool.h +0 -8
  49. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_integer.h +22 -15
  50. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_newline_list.h +11 -0
  51. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_string.h +28 -12
  52. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/version.h +3 -3
  53. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism_compile.h +23 -12
  54. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ractor_core.h +9 -20
  55. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/regint.h +0 -4
  56. data/lib/debase/ruby_core_source/ruby-3.4.0-p-1/revision.h +5 -0
  57. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/rubyparser.h +171 -250
  58. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/shape.h +2 -1
  59. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/symbol.h +6 -1
  60. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/thread_pthread.h +26 -25
  61. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/version.h +1 -1
  62. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm.inc +467 -207
  63. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_callinfo.h +24 -2
  64. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_core.h +62 -48
  65. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_insnhelper.h +7 -2
  66. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_sync.h +3 -3
  67. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vmtc.inc +10 -2
  68. data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/yjit.h +1 -0
  69. data/lib/debase/ruby_core_source/version.rb +1 -1
  70. data/lib/debase/ruby_core_source.rb +4 -2
  71. data/test/deduce_source_dir_test.rb +31 -0
  72. metadata +163 -150
  73. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/regexp.h +0 -33
  74. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/prism/util/pm_string_list.h +0 -44
  75. data/lib/debase/ruby_core_source/ruby-3.4.0-preview1/revision.h +0 -5
  76. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/addr2line.h +0 -0
  77. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ccan/build_assert/build_assert.h +0 -0
  78. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ccan/check_type/check_type.h +0 -0
  79. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ccan/container_of/container_of.h +0 -0
  80. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ccan/list/list.h +0 -0
  81. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ccan/str/str.h +0 -0
  82. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/constant.h +0 -0
  83. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/encindex.h +0 -0
  84. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/eval_intern.h +0 -0
  85. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/hrtime.h +0 -0
  86. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/id_table.h +0 -0
  87. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/bignum.h +0 -0
  88. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/cmdlineopt.h +0 -0
  89. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/compar.h +0 -0
  90. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/compile.h +0 -0
  91. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/compilers.h +0 -0
  92. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/complex.h +0 -0
  93. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/cont.h +0 -0
  94. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/dir.h +0 -0
  95. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/enc.h +0 -0
  96. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/enum.h +0 -0
  97. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/enumerator.h +0 -0
  98. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/eval.h +0 -0
  99. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/file.h +0 -0
  100. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/inits.h +0 -0
  101. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/load.h +0 -0
  102. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/loadpath.h +0 -0
  103. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/math.h +0 -0
  104. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/missing.h +0 -0
  105. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/numeric.h +0 -0
  106. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/object.h +0 -0
  107. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/process.h +0 -0
  108. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/random.h +0 -0
  109. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/range.h +0 -0
  110. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/rational.h +0 -0
  111. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/re.h +0 -0
  112. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/ruby_parser.h +0 -0
  113. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/serial.h +0 -0
  114. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/signal.h +0 -0
  115. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/st.h +0 -0
  116. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/static_assert.h +0 -0
  117. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/struct.h +0 -0
  118. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/symbol.h +0 -0
  119. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/time.h +0 -0
  120. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/transcode.h +0 -0
  121. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/util.h +0 -0
  122. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/variable.h +0 -0
  123. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal/warnings.h +0 -0
  124. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/internal.h +0 -0
  125. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/iseq.h +0 -0
  126. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/node.h +0 -0
  127. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/node_name.inc +0 -0
  128. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/optinsn.inc +0 -0
  129. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/parser_bits.h +0 -0
  130. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/parser_node.h +0 -0
  131. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/parser_st.h +0 -0
  132. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/parser_value.h +0 -0
  133. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/encoding.h +0 -0
  134. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/pack.h +0 -0
  135. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/prettyprint.h +0 -0
  136. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_buffer.h +0 -0
  137. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_list.h +0 -0
  138. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_memchr.h +0 -0
  139. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_strncasecmp.h +0 -0
  140. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/prism/util/pm_strpbrk.h +0 -0
  141. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/probes_helper.h +0 -0
  142. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/regenc.h +0 -0
  143. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/regparse.h +0 -0
  144. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/rjit.h +0 -0
  145. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/rjit_c.h +0 -0
  146. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ruby_assert.h +0 -0
  147. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/ruby_atomic.h +0 -0
  148. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/siphash.h +0 -0
  149. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/thread_none.h +0 -0
  150. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/thread_win32.h +0 -0
  151. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/timev.h +0 -0
  152. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/transcode_data.h +0 -0
  153. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/variable.h +0 -0
  154. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_call_iseq_optimized.inc +0 -0
  155. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_debug.h +0 -0
  156. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_exec.h +0 -0
  157. /data/lib/debase/ruby_core_source/{ruby-3.4.0-preview1 → ruby-3.4.0-p-1}/vm_opts.h +0 -0
@@ -219,17 +219,6 @@ PRISM_EXPORTED_FUNCTION const char * pm_token_type_name(pm_token_type_t token_ty
219
219
  */
220
220
  const char * pm_token_type_human(pm_token_type_t token_type);
221
221
 
222
- /**
223
- * Format the errors on the parser into the given buffer.
224
- *
225
- * @param parser The parser to format the errors for.
226
- * @param error_list The list of errors to format.
227
- * @param buffer The buffer to format the errors into.
228
- * @param colorize Whether or not to colorize the errors with ANSI escape sequences.
229
- * @param inline_messages Whether or not to inline the messages with the source.
230
- */
231
- PRISM_EXPORTED_FUNCTION void pm_parser_errors_format(const pm_parser_t *parser, const pm_list_t *error_list, pm_buffer_t *buffer, bool colorize, bool inline_messages);
232
-
233
222
  // We optionally support dumping to JSON. For systems that don't want or need
234
223
  // this functionality, it can be turned off with the PRISM_EXCLUDE_JSON define.
235
224
  #ifndef PRISM_EXCLUDE_JSON
@@ -245,6 +234,53 @@ PRISM_EXPORTED_FUNCTION void pm_dump_json(pm_buffer_t *buffer, const pm_parser_t
245
234
 
246
235
  #endif
247
236
 
237
+ /**
238
+ * Represents the results of a slice query.
239
+ */
240
+ typedef enum {
241
+ /** Returned if the encoding given to a slice query was invalid. */
242
+ PM_STRING_QUERY_ERROR = -1,
243
+
244
+ /** Returned if the result of the slice query is false. */
245
+ PM_STRING_QUERY_FALSE,
246
+
247
+ /** Returned if the result of the slice query is true. */
248
+ PM_STRING_QUERY_TRUE
249
+ } pm_string_query_t;
250
+
251
+ /**
252
+ * Check that the slice is a valid local variable name.
253
+ *
254
+ * @param source The source to check.
255
+ * @param length The length of the source.
256
+ * @param encoding_name The name of the encoding of the source.
257
+ * @return PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if
258
+ * the query is false, and PM_STRING_QUERY_ERROR if the encoding was invalid.
259
+ */
260
+ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_local(const uint8_t *source, size_t length, const char *encoding_name);
261
+
262
+ /**
263
+ * Check that the slice is a valid constant name.
264
+ *
265
+ * @param source The source to check.
266
+ * @param length The length of the source.
267
+ * @param encoding_name The name of the encoding of the source.
268
+ * @return PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if
269
+ * the query is false, and PM_STRING_QUERY_ERROR if the encoding was invalid.
270
+ */
271
+ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_constant(const uint8_t *source, size_t length, const char *encoding_name);
272
+
273
+ /**
274
+ * Check that the slice is a valid method name.
275
+ *
276
+ * @param source The source to check.
277
+ * @param length The length of the source.
278
+ * @param encoding_name The name of the encoding of the source.
279
+ * @return PM_STRING_QUERY_TRUE if the query is true, PM_STRING_QUERY_FALSE if
280
+ * the query is false, and PM_STRING_QUERY_ERROR if the encoding was invalid.
281
+ */
282
+ PRISM_EXPORTED_FUNCTION pm_string_query_t pm_string_query_method_name(const uint8_t *source, size_t length, const char *encoding_name);
283
+
248
284
  /**
249
285
  * @mainpage
250
286
  *
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @file regexp.h
3
+ *
4
+ * A regular expression parser.
5
+ */
6
+ #ifndef PRISM_REGEXP_H
7
+ #define PRISM_REGEXP_H
8
+
9
+ #include "prism/defines.h"
10
+ #include "prism/parser.h"
11
+ #include "prism/encoding.h"
12
+ #include "prism/util/pm_memchr.h"
13
+ #include "prism/util/pm_string.h"
14
+
15
+ #include <stdbool.h>
16
+ #include <stddef.h>
17
+ #include <string.h>
18
+
19
+ /**
20
+ * This callback is called when a named capture group is found.
21
+ */
22
+ typedef void (*pm_regexp_name_callback_t)(const pm_string_t *name, void *data);
23
+
24
+ /**
25
+ * This callback is called when a parse error is found.
26
+ */
27
+ typedef void (*pm_regexp_error_callback_t)(const uint8_t *start, const uint8_t *end, const char *message, void *data);
28
+
29
+ /**
30
+ * Parse a regular expression.
31
+ *
32
+ * @param parser The parser that is currently being used.
33
+ * @param source The source code to parse.
34
+ * @param size The size of the source code.
35
+ * @param extended_mode Whether to parse the regular expression in extended mode.
36
+ * @param name_callback The optional callback to call when a named capture group is found.
37
+ * @param name_data The optional data to pass to the name callback.
38
+ * @param error_callback The callback to call when a parse error is found.
39
+ * @param error_data The data to pass to the error callback.
40
+ */
41
+ PRISM_EXPORTED_FUNCTION void pm_regexp_parse(pm_parser_t *parser, const uint8_t *source, size_t size, bool extended_mode, pm_regexp_name_callback_t name_callback, void *name_data, pm_regexp_error_callback_t error_callback, void *error_data);
42
+
43
+ #endif
@@ -95,9 +95,10 @@ typedef struct {
95
95
  * @param start_line The line number that the parser starts on.
96
96
  * @param literals The set of static literals to add the node to.
97
97
  * @param node The node to add to the set.
98
+ * @param replace Whether to replace the previous node if one already exists.
98
99
  * @return A pointer to the node that is being overwritten, if there is one.
99
100
  */
100
- pm_node_t * pm_static_literals_add(const pm_newline_list_t *newline_list, int32_t start_line, pm_static_literals_t *literals, pm_node_t *node);
101
+ pm_node_t * pm_static_literals_add(const pm_newline_list_t *newline_list, int32_t start_line, pm_static_literals_t *literals, pm_node_t *node, bool replace);
101
102
 
102
103
  /**
103
104
  * Free the internal memory associated with the given static literals set.
@@ -115,6 +116,6 @@ void pm_static_literals_free(pm_static_literals_t *literals);
115
116
  * @param encoding_name The name of the encoding of the source being parsed.
116
117
  * @param node The node to create a string representation of.
117
118
  */
118
- PRISM_EXPORTED_FUNCTION void pm_static_literal_inspect(pm_buffer_t *buffer, const pm_newline_list_t *newline_list, int32_t start_line, const char *encoding_name, const pm_node_t *node);
119
+ void pm_static_literal_inspect(pm_buffer_t *buffer, const pm_newline_list_t *newline_list, int32_t start_line, const char *encoding_name, const pm_node_t *node);
119
120
 
120
121
  #endif
@@ -34,8 +34,7 @@ size_t pm_strspn_whitespace(const uint8_t *string, ptrdiff_t length);
34
34
  * @return The number of characters at the start of the string that are
35
35
  * whitespace.
36
36
  */
37
- size_t
38
- pm_strspn_whitespace_newlines(const uint8_t *string, ptrdiff_t length, pm_newline_list_t *newline_list);
37
+ size_t pm_strspn_whitespace_newlines(const uint8_t *string, ptrdiff_t length, pm_newline_list_t *newline_list);
39
38
 
40
39
  /**
41
40
  * Returns the number of characters at the start of the string that are inline
@@ -87,14 +87,6 @@ void pm_constant_id_list_insert(pm_constant_id_list_t *list, size_t index, pm_co
87
87
  */
88
88
  bool pm_constant_id_list_includes(pm_constant_id_list_t *list, pm_constant_id_t id);
89
89
 
90
- /**
91
- * Get the memory size of a list of constant ids.
92
- *
93
- * @param list The list to get the memory size of.
94
- * @return The memory size of the list.
95
- */
96
- size_t pm_constant_id_list_memsize(pm_constant_id_list_t *list);
97
-
98
90
  /**
99
91
  * Free the memory associated with a list of constant ids.
100
92
  *
@@ -18,12 +18,6 @@
18
18
  * A structure represents an arbitrary-sized integer.
19
19
  */
20
20
  typedef struct {
21
- /**
22
- * Embedded value for small integer. This value is set to 0 if the value
23
- * does not fit into uint32_t.
24
- */
25
- uint32_t value;
26
-
27
21
  /**
28
22
  * The number of allocated values. length is set to 0 if the integer fits
29
23
  * into uint32_t.
@@ -35,6 +29,12 @@ typedef struct {
35
29
  */
36
30
  uint32_t *values;
37
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
38
  /**
39
39
  * Whether or not the integer is negative. It is stored this way so that a
40
40
  * zeroed pm_integer_t is always positive zero.
@@ -48,6 +48,9 @@ typedef struct {
48
48
  * from the string itself.
49
49
  */
50
50
  typedef enum {
51
+ /** The default decimal base, with no prefix. Leading 0s will be ignored. */
52
+ PM_INTEGER_BASE_DEFAULT,
53
+
51
54
  /** The binary base, indicated by a 0b or 0B prefix. */
52
55
  PM_INTEGER_BASE_BINARY,
53
56
 
@@ -79,15 +82,7 @@ typedef enum {
79
82
  * @param start The start of the string.
80
83
  * @param end The end of the string.
81
84
  */
82
- PRISM_EXPORTED_FUNCTION void pm_integer_parse(pm_integer_t *integer, pm_integer_base_t base, const uint8_t *start, const uint8_t *end);
83
-
84
- /**
85
- * Return the memory size of the integer.
86
- *
87
- * @param integer The integer to get the memory size of.
88
- * @return The size of the memory associated with the integer.
89
- */
90
- size_t pm_integer_memsize(const pm_integer_t *integer);
85
+ void pm_integer_parse(pm_integer_t *integer, pm_integer_base_t base, const uint8_t *start, const uint8_t *end);
91
86
 
92
87
  /**
93
88
  * Compare two integers. This function returns -1 if the left integer is less
@@ -100,6 +95,18 @@ size_t pm_integer_memsize(const pm_integer_t *integer);
100
95
  */
101
96
  int pm_integer_compare(const pm_integer_t *left, const pm_integer_t *right);
102
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
+
103
110
  /**
104
111
  * Convert an integer to a decimal string.
105
112
  *
@@ -80,6 +80,17 @@ pm_newline_list_clear(pm_newline_list_t *list);
80
80
  */
81
81
  bool pm_newline_list_append(pm_newline_list_t *list, const uint8_t *cursor);
82
82
 
83
+ /**
84
+ * Returns the line of the given offset. If the offset is not in the list, the
85
+ * line of the closest offset less than the given offset is returned.
86
+ *
87
+ * @param list The list to search.
88
+ * @param cursor A pointer to the offset to search for.
89
+ * @param start_line The line to start counting from.
90
+ * @return The line of the given offset.
91
+ */
92
+ int32_t pm_newline_list_line(const pm_newline_list_t *list, const uint8_t *cursor, int32_t start_line);
93
+
83
94
  /**
84
95
  * Returns the line and column of the given offset. If the offset is not in the
85
96
  * list, the line and column of the closest offset less than the given offset
@@ -9,6 +9,7 @@
9
9
  #include "prism/defines.h"
10
10
 
11
11
  #include <assert.h>
12
+ #include <errno.h>
12
13
  #include <stdbool.h>
13
14
  #include <stddef.h>
14
15
  #include <stdlib.h>
@@ -21,6 +22,9 @@
21
22
  #include <fcntl.h>
22
23
  #include <sys/mman.h>
23
24
  #include <sys/stat.h>
25
+ #elif defined(PRISM_HAS_FILESYSTEM)
26
+ #include <fcntl.h>
27
+ #include <sys/stat.h>
24
28
  #endif
25
29
 
26
30
  /**
@@ -92,6 +96,26 @@ void pm_string_owned_init(pm_string_t *string, uint8_t *source, size_t length);
92
96
  */
93
97
  void pm_string_constant_init(pm_string_t *string, const char *source, size_t length);
94
98
 
99
+ /**
100
+ * Represents the result of calling pm_string_mapped_init or
101
+ * pm_string_file_init. We need this additional information because there is
102
+ * not a platform-agnostic way to indicate that the file that was attempted to
103
+ * be opened was a directory.
104
+ */
105
+ typedef enum {
106
+ /** Indicates that the string was successfully initialized. */
107
+ PM_STRING_INIT_SUCCESS = 0,
108
+ /**
109
+ * Indicates a generic error from a string_*_init function, where the type
110
+ * of error should be read from `errno` or `GetLastError()`.
111
+ */
112
+ PM_STRING_INIT_ERROR_GENERIC = 1,
113
+ /**
114
+ * Indicates that the file that was attempted to be opened was a directory.
115
+ */
116
+ PM_STRING_INIT_ERROR_DIRECTORY = 2
117
+ } pm_string_init_result_t;
118
+
95
119
  /**
96
120
  * Read the file indicated by the filepath parameter into source and load its
97
121
  * contents and size into the given `pm_string_t`. The given `pm_string_t`
@@ -105,9 +129,9 @@ void pm_string_constant_init(pm_string_t *string, const char *source, size_t len
105
129
  *
106
130
  * @param string The string to initialize.
107
131
  * @param filepath The filepath to read.
108
- * @return Whether or not the file was successfully mapped.
132
+ * @return The success of the read, indicated by the value of the enum.
109
133
  */
110
- PRISM_EXPORTED_FUNCTION bool pm_string_mapped_init(pm_string_t *string, const char *filepath);
134
+ PRISM_EXPORTED_FUNCTION pm_string_init_result_t pm_string_mapped_init(pm_string_t *string, const char *filepath);
111
135
 
112
136
  /**
113
137
  * Read the file indicated by the filepath parameter into source and load its
@@ -116,17 +140,9 @@ PRISM_EXPORTED_FUNCTION bool pm_string_mapped_init(pm_string_t *string, const ch
116
140
  *
117
141
  * @param string The string to initialize.
118
142
  * @param filepath The filepath to read.
119
- * @return Whether or not the file was successfully read.
120
- */
121
- PRISM_EXPORTED_FUNCTION bool pm_string_file_init(pm_string_t *string, const char *filepath);
122
-
123
- /**
124
- * Returns the memory size associated with the string.
125
- *
126
- * @param string The string to get the memory size of.
127
- * @return The size of the memory associated with the string.
143
+ * @return The success of the read, indicated by the value of the enum.
128
144
  */
129
- size_t pm_string_memsize(const pm_string_t *string);
145
+ PRISM_EXPORTED_FUNCTION pm_string_init_result_t pm_string_file_init(pm_string_t *string, const char *filepath);
130
146
 
131
147
  /**
132
148
  * Ensure the string is owned. If it is not, then reinitialize it as owned and
@@ -9,12 +9,12 @@
9
9
  /**
10
10
  * The major version of the Prism library as an int.
11
11
  */
12
- #define PRISM_VERSION_MAJOR 0
12
+ #define PRISM_VERSION_MAJOR 1
13
13
 
14
14
  /**
15
15
  * The minor version of the Prism library as an int.
16
16
  */
17
- #define PRISM_VERSION_MINOR 29
17
+ #define PRISM_VERSION_MINOR 2
18
18
 
19
19
  /**
20
20
  * The patch version of the Prism library as an int.
@@ -24,6 +24,6 @@
24
24
  /**
25
25
  * The version of the Prism library as a constant string.
26
26
  */
27
- #define PRISM_VERSION "0.29.0"
27
+ #define PRISM_VERSION "1.2.0"
28
28
 
29
29
  #endif
@@ -29,6 +29,16 @@ typedef struct pm_scope_node {
29
29
  const pm_parser_t *parser;
30
30
  rb_encoding *encoding;
31
31
 
32
+ /**
33
+ * This is a pointer to the list of script lines for the ISEQs that will be
34
+ * associated with this scope node. It is only set if
35
+ * RubyVM.keep_script_lines is true. If it is set, it will be set to a
36
+ * pointer to an array that is always stack allocated (so no GC marking is
37
+ * needed by this struct). If it is not set, it will be NULL. It is
38
+ * inherited by all child scopes.
39
+ */
40
+ VALUE *script_lines;
41
+
32
42
  /**
33
43
  * This is the encoding of the actual filepath object that will be used when
34
44
  * a __FILE__ node is compiled or when the path has to be set on a syntax
@@ -36,14 +46,16 @@ typedef struct pm_scope_node {
36
46
  */
37
47
  rb_encoding *filepath_encoding;
38
48
 
39
- // The size of the local table
40
- // on the iseq which includes
41
- // locals and hidden variables
49
+ // The size of the local table on the iseq which includes locals and hidden
50
+ // variables.
42
51
  int local_table_for_iseq_size;
43
52
 
44
53
  ID *constants;
45
54
  st_table *index_lookup_table;
46
55
 
56
+ // The current coverage setting, passed down through the various scopes.
57
+ int coverage_enabled;
58
+
47
59
  /**
48
60
  * This will only be set on the top-level scope node. It will contain all of
49
61
  * the instructions pertaining to BEGIN{} nodes.
@@ -53,7 +65,6 @@ typedef struct pm_scope_node {
53
65
 
54
66
  void pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_t *previous);
55
67
  void pm_scope_node_destroy(pm_scope_node_t *scope_node);
56
- bool *rb_ruby_prism_ptr(void);
57
68
 
58
69
  typedef struct {
59
70
  /** The parser that will do the actual parsing. */
@@ -73,16 +84,16 @@ typedef struct {
73
84
  } pm_parse_result_t;
74
85
 
75
86
  VALUE pm_load_file(pm_parse_result_t *result, VALUE filepath, bool load_error);
76
- VALUE pm_parse_file(pm_parse_result_t *result, VALUE filepath);
77
- VALUE pm_load_parse_file(pm_parse_result_t *result, VALUE filepath);
78
- VALUE pm_parse_string(pm_parse_result_t *result, VALUE source, VALUE filepath);
87
+ VALUE pm_parse_file(pm_parse_result_t *result, VALUE filepath, VALUE *script_lines);
88
+ VALUE pm_load_parse_file(pm_parse_result_t *result, VALUE filepath, VALUE *script_lines);
89
+ VALUE pm_parse_string(pm_parse_result_t *result, VALUE source, VALUE filepath, VALUE *script_lines);
79
90
  VALUE pm_parse_stdin(pm_parse_result_t *result);
80
91
  void pm_parse_result_free(pm_parse_result_t *result);
81
92
 
82
- rb_iseq_t *pm_iseq_new(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum rb_iseq_type);
83
- rb_iseq_t *pm_iseq_new_top(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent);
84
- rb_iseq_t *pm_iseq_new_main(pm_scope_node_t *node, VALUE path, VALUE realpath, const rb_iseq_t *parent, int opt);
85
- rb_iseq_t *pm_iseq_new_eval(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath, int first_lineno, const rb_iseq_t *parent, int isolated_depth);
86
- rb_iseq_t *pm_iseq_new_with_opt(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath, int first_lineno, const rb_iseq_t *parent, int isolated_depth, enum rb_iseq_type, const rb_compile_option_t*);
93
+ rb_iseq_t *pm_iseq_new(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, enum rb_iseq_type, int *error_state);
94
+ rb_iseq_t *pm_iseq_new_top(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, int *error_state);
95
+ rb_iseq_t *pm_iseq_new_main(pm_scope_node_t *node, VALUE path, VALUE realpath, const rb_iseq_t *parent, int opt, int *error_state);
96
+ rb_iseq_t *pm_iseq_new_eval(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath, int first_lineno, const rb_iseq_t *parent, int isolated_depth, int *error_state);
97
+ rb_iseq_t *pm_iseq_new_with_opt(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath, int first_lineno, const rb_iseq_t *parent, int isolated_depth, enum rb_iseq_type, const rb_compile_option_t *option, int *error_state);
87
98
 
88
99
  VALUE pm_iseq_compile_node(rb_iseq_t *iseq, pm_scope_node_t *node);
@@ -180,6 +180,7 @@ struct rb_ractor_struct {
180
180
 
181
181
  st_table *local_storage;
182
182
  struct rb_id_table *idkey_local_storage;
183
+ VALUE local_storage_store_lock;
183
184
 
184
185
  VALUE r_stdin;
185
186
  VALUE r_stdout;
@@ -187,13 +188,7 @@ struct rb_ractor_struct {
187
188
  VALUE verbose;
188
189
  VALUE debug;
189
190
 
190
- rb_ractor_newobj_cache_t newobj_cache;
191
-
192
- // gc.c rb_objspace_reachable_objects_from
193
- struct gc_mark_func_data_struct {
194
- void *data;
195
- void (*mark_func)(VALUE v, void *data);
196
- } *mfd;
191
+ void *newobj_cache;
197
192
  }; // rb_ractor_t is defined in vm_core.h
198
193
 
199
194
 
@@ -227,12 +222,15 @@ void rb_ractor_vm_barrier_interrupt_running_thread(rb_ractor_t *r);
227
222
  void rb_ractor_terminate_interrupt_main_thread(rb_ractor_t *r);
228
223
  void rb_ractor_terminate_all(void);
229
224
  bool rb_ractor_main_p_(void);
230
- void rb_ractor_finish_marking(void);
231
225
  void rb_ractor_atfork(rb_vm_t *vm, rb_thread_t *th);
226
+ VALUE rb_ractor_require(VALUE feature);
227
+ VALUE rb_ractor_autoload_load(VALUE space, ID id);
232
228
 
233
229
  VALUE rb_ractor_ensure_shareable(VALUE obj, VALUE name);
234
230
 
235
231
  RUBY_SYMBOL_EXPORT_BEGIN
232
+ void rb_ractor_finish_marking(void);
233
+
236
234
  bool rb_ractor_shareable_p_continue(VALUE obj);
237
235
 
238
236
  // THIS FUNCTION SHOULD NOT CALL WHILE INCREMENTAL MARKING!!
@@ -309,18 +307,15 @@ rb_ractor_thread_switch(rb_ractor_t *cr, rb_thread_t *th)
309
307
  }
310
308
 
311
309
  #define rb_ractor_set_current_ec(cr, ec) rb_ractor_set_current_ec_(cr, ec, __FILE__, __LINE__)
310
+ #ifdef RB_THREAD_LOCAL_SPECIFIER
311
+ void rb_current_ec_set(rb_execution_context_t *ec);
312
+ #endif
312
313
 
313
314
  static inline void
314
315
  rb_ractor_set_current_ec_(rb_ractor_t *cr, rb_execution_context_t *ec, const char *file, int line)
315
316
  {
316
317
  #ifdef RB_THREAD_LOCAL_SPECIFIER
317
-
318
- # ifdef __APPLE__
319
318
  rb_current_ec_set(ec);
320
- # else
321
- ruby_current_ec = ec;
322
- # endif
323
-
324
319
  #else
325
320
  native_tls_set(ruby_current_ec_key, ec);
326
321
  #endif
@@ -349,12 +344,6 @@ rb_ractor_setup_belonging_to(VALUE obj, uint32_t rid)
349
344
  RACTOR_BELONGING_ID(obj) = rid;
350
345
  }
351
346
 
352
- static inline void
353
- rb_ractor_setup_belonging(VALUE obj)
354
- {
355
- rb_ractor_setup_belonging_to(obj, rb_ractor_current_id());
356
- }
357
-
358
347
  static inline uint32_t
359
348
  rb_ractor_belonging(VALUE obj)
360
349
  {
@@ -163,9 +163,6 @@
163
163
  rb_thread_check_ints(); \
164
164
  } \
165
165
  } while(0)
166
- # define HANDLE_REG_TIMEOUT_IN_MATCH_AT do { \
167
- rb_reg_raise_timeout(); \
168
- } while (0)
169
166
  # define onig_st_init_table st_init_table
170
167
  # define onig_st_init_table_with_size st_init_table_with_size
171
168
  # define onig_st_init_numtable st_init_numtable
@@ -1002,7 +999,6 @@ extern int onig_st_insert_strend(hash_table_type* table, const UChar* str_key, c
1002
999
  extern size_t onig_memsize(const regex_t *reg);
1003
1000
  extern size_t onig_region_memsize(const struct re_registers *regs);
1004
1001
  bool rb_reg_timeout_p(regex_t *reg, void *end_time);
1005
- NORETURN(void rb_reg_raise_timeout(void));
1006
1002
  #endif
1007
1003
 
1008
1004
  RUBY_SYMBOL_EXPORT_END
@@ -0,0 +1,5 @@
1
+ #define RUBY_REVISION "f450108330"
2
+ #define RUBY_FULL_REVISION "f45010833071b953744658842369e3496dfacb48"
3
+ #define RUBY_RELEASE_YEAR 2024
4
+ #define RUBY_RELEASE_MONTH 12
5
+ #define RUBY_RELEASE_DAY 25