@appthreat/atom-parsetools 1.2.2 → 1.4.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.
Files changed (267) hide show
  1. package/README.md +118 -7
  2. package/astgen.js +297 -57
  3. package/package.json +9 -6
  4. package/plugins/composer/installed.php +6 -6
  5. package/plugins/rubyastgen/Gemfile +6 -4
  6. package/plugins/rubyastgen/Gemfile.lock +5 -8
  7. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/Gemfile +11 -0
  8. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/exe/ruby_ast_gen +55 -0
  9. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/lib/ruby_ast_gen/cli.rb +133 -0
  10. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/lib/ruby_ast_gen/node_handling.rb +449 -0
  11. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/{ruby_ast_gen-cc312ebf06b4 → ruby_ast_gen-4ac84327b3af}/lib/ruby_ast_gen/version.rb +1 -1
  12. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/lib/ruby_ast_gen.rb +888 -0
  13. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/ruby_ast_gen.gemspec +25 -0
  14. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/current.rb +1 -1
  15. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/version.rb +1 -1
  16. package/plugins/rubyastgen/bundle/ruby/4.0.0/specifications/ast-2.4.3.gemspec +29 -0
  17. package/plugins/rubyastgen/bundle/ruby/4.0.0/specifications/bundler-2.6.9.gemspec +25 -0
  18. package/plugins/rubyastgen/bundle/ruby/4.0.0/specifications/ostruct-0.6.3.gemspec +22 -0
  19. package/plugins/rubyastgen/bundle/ruby/4.0.0/specifications/parser-3.3.12.0.gemspec +37 -0
  20. package/rbastgen.js +102 -13
  21. package/scalasem.js +11 -2
  22. package/plugins/bin/bundler +0 -14
  23. package/plugins/bin/ruby_ast_gen +0 -14
  24. package/plugins/rubyastgen/bundle/bundler/setup.rb +0 -44
  25. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-cc312ebf06b4/exe/ruby_ast_gen +0 -63
  26. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-cc312ebf06b4/lib/ruby_ast_gen/node_handling.rb +0 -269
  27. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-cc312ebf06b4/lib/ruby_ast_gen.rb +0 -218
  28. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/prism-1.9.0/gem.build_complete +0 -0
  29. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/prism-1.9.0/gem_make.out +0 -44
  30. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/prism-1.9.0/mkmf.log +0 -74
  31. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/prism-1.9.0/prism/prism.so +0 -0
  32. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/racc-1.8.1/gem.build_complete +0 -0
  33. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/racc-1.8.1/gem_make.out +0 -18
  34. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/racc-1.8.1/racc/cparse.so +0 -0
  35. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/BSDmakefile +0 -58
  36. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/Makefile +0 -116
  37. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/Makefile +0 -273
  38. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/api_node.c +0 -6945
  39. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/api_pack.c +0 -276
  40. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/extconf.rb +0 -127
  41. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/extension.c +0 -1427
  42. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/extension.h +0 -19
  43. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/ast.h +0 -8254
  44. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/defines.h +0 -260
  45. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/diagnostic.h +0 -458
  46. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/encoding.h +0 -283
  47. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/node.h +0 -129
  48. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/options.h +0 -488
  49. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/pack.h +0 -163
  50. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/parser.h +0 -936
  51. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/prettyprint.h +0 -34
  52. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/regexp.h +0 -43
  53. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/static_literals.h +0 -121
  54. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_buffer.h +0 -236
  55. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_char.h +0 -204
  56. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_constant_pool.h +0 -218
  57. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_integer.h +0 -130
  58. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_list.h +0 -103
  59. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_memchr.h +0 -29
  60. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_newline_list.h +0 -113
  61. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_string.h +0 -200
  62. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_strncasecmp.h +0 -32
  63. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_strpbrk.h +0 -46
  64. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/version.h +0 -29
  65. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism.h +0 -408
  66. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/compiler.rb +0 -801
  67. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/desugar_compiler.rb +0 -392
  68. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/dispatcher.rb +0 -2210
  69. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/dot_visitor.rb +0 -4767
  70. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/dsl.rb +0 -1003
  71. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/ffi.rb +0 -578
  72. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/inspect_visitor.rb +0 -2393
  73. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/lex_compat.rb +0 -911
  74. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/mutation_compiler.rb +0 -772
  75. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/node.rb +0 -19966
  76. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/node_ext.rb +0 -511
  77. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/pack.rb +0 -230
  78. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/parse_result/comments.rb +0 -188
  79. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/parse_result/errors.rb +0 -66
  80. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/parse_result/newlines.rb +0 -155
  81. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/parse_result.rb +0 -907
  82. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/pattern.rb +0 -269
  83. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/polyfill/append_as_bytes.rb +0 -15
  84. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/polyfill/byteindex.rb +0 -13
  85. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/polyfill/scan_byte.rb +0 -14
  86. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/polyfill/unpack1.rb +0 -14
  87. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/polyfill/warn.rb +0 -36
  88. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/prism.so +0 -0
  89. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/reflection.rb +0 -416
  90. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/relocation.rb +0 -505
  91. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/serialize.rb +0 -2400
  92. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/string_query.rb +0 -31
  93. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser/builder.rb +0 -62
  94. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser/compiler.rb +0 -2234
  95. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser/lexer.rb +0 -820
  96. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser.rb +0 -376
  97. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser_current.rb +0 -26
  98. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser_versions.rb +0 -36
  99. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ripper/filter.rb +0 -53
  100. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ripper/lexer.rb +0 -135
  101. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ripper/sexp.rb +0 -126
  102. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ripper/shim.rb +0 -5
  103. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ripper.rb +0 -3520
  104. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ruby_parser.rb +0 -1964
  105. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation.rb +0 -18
  106. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/visitor.rb +0 -813
  107. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism.rb +0 -98
  108. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/compiler.rbi +0 -12
  109. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/dsl.rbi +0 -524
  110. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/inspect_visitor.rbi +0 -12
  111. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/node.rbi +0 -8750
  112. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/node_ext.rbi +0 -107
  113. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/parse_result.rbi +0 -404
  114. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/reflection.rbi +0 -58
  115. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/string_query.rbi +0 -12
  116. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/translation/parser.rbi +0 -11
  117. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/translation/parser_versions.rbi +0 -23
  118. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/translation/ripper.rbi +0 -15
  119. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/visitor.rbi +0 -473
  120. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism.rbi +0 -63
  121. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/compiler.rbs +0 -9
  122. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/dispatcher.rbs +0 -19
  123. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/dot_visitor.rbs +0 -6
  124. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/dsl.rbs +0 -351
  125. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/inspect_visitor.rbs +0 -22
  126. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/lex_compat.rbs +0 -10
  127. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/mutation_compiler.rbs +0 -159
  128. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/node.rbs +0 -4042
  129. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/node_ext.rbs +0 -149
  130. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/pack.rbs +0 -43
  131. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/parse_result/comments.rbs +0 -38
  132. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/parse_result.rbs +0 -197
  133. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/pattern.rbs +0 -13
  134. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/reflection.rbs +0 -50
  135. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/relocation.rbs +0 -185
  136. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/serialize.rbs +0 -8
  137. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/string_query.rbs +0 -11
  138. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/visitor.rbs +0 -169
  139. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism.rbs +0 -272
  140. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/diagnostic.c +0 -854
  141. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/encoding.c +0 -5340
  142. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/node.c +0 -8685
  143. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/options.c +0 -338
  144. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/pack.c +0 -509
  145. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/prettyprint.c +0 -8957
  146. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/prism.c +0 -22679
  147. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/regexp.c +0 -790
  148. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/serialize.c +0 -2274
  149. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/static_literals.c +0 -617
  150. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/token_type.c +0 -703
  151. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_buffer.c +0 -357
  152. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_char.c +0 -318
  153. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_constant_pool.c +0 -342
  154. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_integer.c +0 -670
  155. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_list.c +0 -49
  156. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_memchr.c +0 -35
  157. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_newline_list.c +0 -125
  158. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_string.c +0 -381
  159. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_strncasecmp.c +0 -36
  160. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_strpbrk.c +0 -206
  161. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/BSDL +0 -22
  162. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/COPYING +0 -56
  163. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ChangeLog +0 -846
  164. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/README.ja.rdoc +0 -58
  165. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/README.rdoc +0 -60
  166. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/TODO +0 -5
  167. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/bin/racc +0 -320
  168. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ext/racc/cparse/Makefile +0 -273
  169. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ext/racc/cparse/cparse.c +0 -840
  170. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ext/racc/cparse/extconf.rb +0 -8
  171. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/compat.rb +0 -33
  172. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/cparse.so +0 -0
  173. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/debugflags.rb +0 -60
  174. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/exception.rb +0 -16
  175. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/grammar.rb +0 -1191
  176. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/grammarfileparser.rb +0 -667
  177. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/info.rb +0 -18
  178. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/iset.rb +0 -92
  179. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/logfilegenerator.rb +0 -212
  180. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/parser-text.rb +0 -644
  181. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/parser.rb +0 -630
  182. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/parserfilegenerator.rb +0 -473
  183. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/sourcetext.rb +0 -35
  184. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/state.rb +0 -976
  185. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/statetransitiontable.rb +0 -311
  186. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/static.rb +0 -5
  187. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc.rb +0 -6
  188. /package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/{ruby_ast_gen-cc312ebf06b4 → ruby_ast_gen-4ac84327b3af}/.rspec +0 -0
  189. /package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/{ruby_ast_gen-cc312ebf06b4 → ruby_ast_gen-4ac84327b3af}/bin/console +0 -0
  190. /package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/{ruby_ast_gen-cc312ebf06b4 → ruby_ast_gen-4ac84327b3af}/bin/setup +0 -0
  191. /package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/{ruby_ast_gen-cc312ebf06b4 → ruby_ast_gen-4ac84327b3af}/update_version.rb +0 -0
  192. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/bin/ruby-parse +0 -0
  193. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/bin/ruby-rewrite +0 -0
  194. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/gauntlet_parser.rb +0 -0
  195. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/all.rb +0 -0
  196. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ast/node.rb +0 -0
  197. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ast/processor.rb +0 -0
  198. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/base.rb +0 -0
  199. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/builders/default.rb +0 -0
  200. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/clobbering_error.rb +0 -0
  201. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/color.rb +0 -0
  202. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/context.rb +0 -0
  203. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/current_arg_stack.rb +0 -0
  204. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/deprecation.rb +0 -0
  205. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/diagnostic/engine.rb +0 -0
  206. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/diagnostic.rb +0 -0
  207. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/lexer/dedenter.rb +0 -0
  208. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/lexer/explanation.rb +0 -0
  209. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/lexer/literal.rb +0 -0
  210. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/lexer/stack_state.rb +0 -0
  211. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/lexer-F0.rb +0 -0
  212. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/lexer-F1.rb +0 -0
  213. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/lexer-strings.rb +0 -0
  214. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/macruby.rb +0 -0
  215. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/max_numparam_stack.rb +0 -0
  216. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/messages.rb +0 -0
  217. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/meta.rb +0 -0
  218. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/rewriter.rb +0 -0
  219. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby18.rb +0 -0
  220. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby19.rb +0 -0
  221. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby20.rb +0 -0
  222. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby21.rb +0 -0
  223. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby22.rb +0 -0
  224. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby23.rb +0 -0
  225. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby24.rb +0 -0
  226. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby25.rb +0 -0
  227. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby26.rb +0 -0
  228. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby27.rb +0 -0
  229. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby30.rb +0 -0
  230. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby31.rb +0 -0
  231. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby32.rb +0 -0
  232. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby33.rb +0 -0
  233. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/ruby34.rb +0 -0
  234. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/rubymotion.rb +0 -0
  235. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/runner/ruby_parse.rb +0 -0
  236. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/runner/ruby_rewrite.rb +0 -0
  237. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/runner.rb +0 -0
  238. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/buffer.rb +0 -0
  239. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/comment/associator.rb +0 -0
  240. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/comment.rb +0 -0
  241. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/collection.rb +0 -0
  242. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/condition.rb +0 -0
  243. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/constant.rb +0 -0
  244. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/definition.rb +0 -0
  245. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/for.rb +0 -0
  246. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/heredoc.rb +0 -0
  247. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/index.rb +0 -0
  248. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/keyword.rb +0 -0
  249. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/method_definition.rb +0 -0
  250. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/objc_kwarg.rb +0 -0
  251. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/operator.rb +0 -0
  252. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/rescue_body.rb +0 -0
  253. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/send.rb +0 -0
  254. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/ternary.rb +0 -0
  255. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map/variable.rb +0 -0
  256. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/map.rb +0 -0
  257. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/range.rb +0 -0
  258. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/rewriter/action.rb +0 -0
  259. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/rewriter.rb +0 -0
  260. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/tree_rewriter/action.rb +0 -0
  261. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/source/tree_rewriter.rb +0 -0
  262. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/static_environment.rb +0 -0
  263. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/syntax_error.rb +0 -0
  264. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/tree_rewriter.rb +0 -0
  265. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/unknown_encoding_in_magic_comment_error.rb +0 -0
  266. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser/variables_stack.rb +0 -0
  267. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/lib/parser.rb +0 -0
@@ -1,342 +0,0 @@
1
- #include "prism/util/pm_constant_pool.h"
2
-
3
- /**
4
- * Initialize a list of constant ids.
5
- */
6
- void
7
- pm_constant_id_list_init(pm_constant_id_list_t *list) {
8
- list->ids = NULL;
9
- list->size = 0;
10
- list->capacity = 0;
11
- }
12
-
13
- /**
14
- * Initialize a list of constant ids with a given capacity.
15
- */
16
- void
17
- pm_constant_id_list_init_capacity(pm_constant_id_list_t *list, size_t capacity) {
18
- if (capacity) {
19
- list->ids = xcalloc(capacity, sizeof(pm_constant_id_t));
20
- if (list->ids == NULL) abort();
21
- } else {
22
- list->ids = NULL;
23
- }
24
-
25
- list->size = 0;
26
- list->capacity = capacity;
27
- }
28
-
29
- /**
30
- * Append a constant id to a list of constant ids. Returns false if any
31
- * potential reallocations fail.
32
- */
33
- bool
34
- pm_constant_id_list_append(pm_constant_id_list_t *list, pm_constant_id_t id) {
35
- if (list->size >= list->capacity) {
36
- list->capacity = list->capacity == 0 ? 8 : list->capacity * 2;
37
- list->ids = (pm_constant_id_t *) xrealloc(list->ids, sizeof(pm_constant_id_t) * list->capacity);
38
- if (list->ids == NULL) return false;
39
- }
40
-
41
- list->ids[list->size++] = id;
42
- return true;
43
- }
44
-
45
- /**
46
- * Insert a constant id into a list of constant ids at the specified index.
47
- */
48
- void
49
- pm_constant_id_list_insert(pm_constant_id_list_t *list, size_t index, pm_constant_id_t id) {
50
- assert(index < list->capacity);
51
- assert(list->ids[index] == PM_CONSTANT_ID_UNSET);
52
-
53
- list->ids[index] = id;
54
- list->size++;
55
- }
56
-
57
- /**
58
- * Checks if the current constant id list includes the given constant id.
59
- */
60
- bool
61
- pm_constant_id_list_includes(pm_constant_id_list_t *list, pm_constant_id_t id) {
62
- for (size_t index = 0; index < list->size; index++) {
63
- if (list->ids[index] == id) return true;
64
- }
65
- return false;
66
- }
67
-
68
- /**
69
- * Free the memory associated with a list of constant ids.
70
- */
71
- void
72
- pm_constant_id_list_free(pm_constant_id_list_t *list) {
73
- if (list->ids != NULL) {
74
- xfree(list->ids);
75
- }
76
- }
77
-
78
- /**
79
- * A relatively simple hash function (djb2) that is used to hash strings. We are
80
- * optimizing here for simplicity and speed.
81
- */
82
- static inline uint32_t
83
- pm_constant_pool_hash(const uint8_t *start, size_t length) {
84
- // This is a prime number used as the initial value for the hash function.
85
- uint32_t value = 5381;
86
-
87
- for (size_t index = 0; index < length; index++) {
88
- value = ((value << 5) + value) + start[index];
89
- }
90
-
91
- return value;
92
- }
93
-
94
- /**
95
- * https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
96
- */
97
- static uint32_t
98
- next_power_of_two(uint32_t v) {
99
- // Avoid underflow in subtraction on next line.
100
- if (v == 0) {
101
- // 1 is the nearest power of 2 to 0 (2^0)
102
- return 1;
103
- }
104
- v--;
105
- v |= v >> 1;
106
- v |= v >> 2;
107
- v |= v >> 4;
108
- v |= v >> 8;
109
- v |= v >> 16;
110
- v++;
111
- return v;
112
- }
113
-
114
- #ifndef NDEBUG
115
- static bool
116
- is_power_of_two(uint32_t size) {
117
- return (size & (size - 1)) == 0;
118
- }
119
- #endif
120
-
121
- /**
122
- * Resize a constant pool to a given capacity.
123
- */
124
- static inline bool
125
- pm_constant_pool_resize(pm_constant_pool_t *pool) {
126
- assert(is_power_of_two(pool->capacity));
127
-
128
- uint32_t next_capacity = pool->capacity * 2;
129
- if (next_capacity < pool->capacity) return false;
130
-
131
- const uint32_t mask = next_capacity - 1;
132
- const size_t element_size = sizeof(pm_constant_pool_bucket_t) + sizeof(pm_constant_t);
133
-
134
- void *next = xcalloc(next_capacity, element_size);
135
- if (next == NULL) return false;
136
-
137
- pm_constant_pool_bucket_t *next_buckets = next;
138
- pm_constant_t *next_constants = (void *)(((char *) next) + next_capacity * sizeof(pm_constant_pool_bucket_t));
139
-
140
- // For each bucket in the current constant pool, find the index in the
141
- // next constant pool, and insert it.
142
- for (uint32_t index = 0; index < pool->capacity; index++) {
143
- pm_constant_pool_bucket_t *bucket = &pool->buckets[index];
144
-
145
- // If an id is set on this constant, then we know we have content here.
146
- // In this case we need to insert it into the next constant pool.
147
- if (bucket->id != PM_CONSTANT_ID_UNSET) {
148
- uint32_t next_index = bucket->hash & mask;
149
-
150
- // This implements linear scanning to find the next available slot
151
- // in case this index is already taken. We don't need to bother
152
- // comparing the values since we know that the hash is unique.
153
- while (next_buckets[next_index].id != PM_CONSTANT_ID_UNSET) {
154
- next_index = (next_index + 1) & mask;
155
- }
156
-
157
- // Here we copy over the entire bucket, which includes the id so
158
- // that they are consistent between resizes.
159
- next_buckets[next_index] = *bucket;
160
- }
161
- }
162
-
163
- // The constants are stable with respect to hash table resizes.
164
- memcpy(next_constants, pool->constants, pool->size * sizeof(pm_constant_t));
165
-
166
- // pool->constants and pool->buckets are allocated out of the same chunk
167
- // of memory, with the buckets coming first.
168
- xfree(pool->buckets);
169
- pool->constants = next_constants;
170
- pool->buckets = next_buckets;
171
- pool->capacity = next_capacity;
172
- return true;
173
- }
174
-
175
- /**
176
- * Initialize a new constant pool with a given capacity.
177
- */
178
- bool
179
- pm_constant_pool_init(pm_constant_pool_t *pool, uint32_t capacity) {
180
- const uint32_t maximum = (~((uint32_t) 0));
181
- if (capacity >= ((maximum / 2) + 1)) return false;
182
-
183
- capacity = next_power_of_two(capacity);
184
- const size_t element_size = sizeof(pm_constant_pool_bucket_t) + sizeof(pm_constant_t);
185
- void *memory = xcalloc(capacity, element_size);
186
- if (memory == NULL) return false;
187
-
188
- pool->buckets = memory;
189
- pool->constants = (void *)(((char *)memory) + capacity * sizeof(pm_constant_pool_bucket_t));
190
- pool->size = 0;
191
- pool->capacity = capacity;
192
- return true;
193
- }
194
-
195
- /**
196
- * Return a pointer to the constant indicated by the given constant id.
197
- */
198
- pm_constant_t *
199
- pm_constant_pool_id_to_constant(const pm_constant_pool_t *pool, pm_constant_id_t constant_id) {
200
- assert(constant_id != PM_CONSTANT_ID_UNSET && constant_id <= pool->size);
201
- return &pool->constants[constant_id - 1];
202
- }
203
-
204
- /**
205
- * Find a constant in a constant pool. Returns the id of the constant, or 0 if
206
- * the constant is not found.
207
- */
208
- pm_constant_id_t
209
- pm_constant_pool_find(const pm_constant_pool_t *pool, const uint8_t *start, size_t length) {
210
- assert(is_power_of_two(pool->capacity));
211
- const uint32_t mask = pool->capacity - 1;
212
-
213
- uint32_t hash = pm_constant_pool_hash(start, length);
214
- uint32_t index = hash & mask;
215
- pm_constant_pool_bucket_t *bucket;
216
-
217
- while (bucket = &pool->buckets[index], bucket->id != PM_CONSTANT_ID_UNSET) {
218
- pm_constant_t *constant = &pool->constants[bucket->id - 1];
219
- if ((constant->length == length) && memcmp(constant->start, start, length) == 0) {
220
- return bucket->id;
221
- }
222
-
223
- index = (index + 1) & mask;
224
- }
225
-
226
- return PM_CONSTANT_ID_UNSET;
227
- }
228
-
229
- /**
230
- * Insert a constant into a constant pool and return its index in the pool.
231
- */
232
- static inline pm_constant_id_t
233
- pm_constant_pool_insert(pm_constant_pool_t *pool, const uint8_t *start, size_t length, pm_constant_pool_bucket_type_t type) {
234
- if (pool->size >= (pool->capacity / 4 * 3)) {
235
- if (!pm_constant_pool_resize(pool)) return PM_CONSTANT_ID_UNSET;
236
- }
237
-
238
- assert(is_power_of_two(pool->capacity));
239
- const uint32_t mask = pool->capacity - 1;
240
-
241
- uint32_t hash = pm_constant_pool_hash(start, length);
242
- uint32_t index = hash & mask;
243
- pm_constant_pool_bucket_t *bucket;
244
-
245
- while (bucket = &pool->buckets[index], bucket->id != PM_CONSTANT_ID_UNSET) {
246
- // If there is a collision, then we need to check if the content is the
247
- // same as the content we are trying to insert. If it is, then we can
248
- // return the id of the existing constant.
249
- pm_constant_t *constant = &pool->constants[bucket->id - 1];
250
-
251
- if ((constant->length == length) && memcmp(constant->start, start, length) == 0) {
252
- // Since we have found a match, we need to check if this is
253
- // attempting to insert a shared or an owned constant. We want to
254
- // prefer shared constants since they don't require allocations.
255
- if (type == PM_CONSTANT_POOL_BUCKET_OWNED) {
256
- // If we're attempting to insert an owned constant and we have
257
- // an existing constant, then either way we don't want the given
258
- // memory. Either it's duplicated with the existing constant or
259
- // it's not necessary because we have a shared version.
260
- xfree((void *) start);
261
- } else if (bucket->type == PM_CONSTANT_POOL_BUCKET_OWNED) {
262
- // If we're attempting to insert a shared constant and the
263
- // existing constant is owned, then we can free the owned
264
- // constant and replace it with the shared constant.
265
- xfree((void *) constant->start);
266
- constant->start = start;
267
- bucket->type = (unsigned int) (type & 0x3);
268
- }
269
-
270
- return bucket->id;
271
- }
272
-
273
- index = (index + 1) & mask;
274
- }
275
-
276
- // IDs are allocated starting at 1, since the value 0 denotes a non-existent
277
- // constant.
278
- uint32_t id = ++pool->size;
279
- assert(pool->size < ((uint32_t) (1 << 30)));
280
-
281
- *bucket = (pm_constant_pool_bucket_t) {
282
- .id = (unsigned int) (id & 0x3fffffff),
283
- .type = (unsigned int) (type & 0x3),
284
- .hash = hash
285
- };
286
-
287
- pool->constants[id - 1] = (pm_constant_t) {
288
- .start = start,
289
- .length = length,
290
- };
291
-
292
- return id;
293
- }
294
-
295
- /**
296
- * Insert a constant into a constant pool. Returns the id of the constant, or
297
- * PM_CONSTANT_ID_UNSET if any potential calls to resize fail.
298
- */
299
- pm_constant_id_t
300
- pm_constant_pool_insert_shared(pm_constant_pool_t *pool, const uint8_t *start, size_t length) {
301
- return pm_constant_pool_insert(pool, start, length, PM_CONSTANT_POOL_BUCKET_DEFAULT);
302
- }
303
-
304
- /**
305
- * Insert a constant into a constant pool from memory that is now owned by the
306
- * constant pool. Returns the id of the constant, or PM_CONSTANT_ID_UNSET if any
307
- * potential calls to resize fail.
308
- */
309
- pm_constant_id_t
310
- pm_constant_pool_insert_owned(pm_constant_pool_t *pool, uint8_t *start, size_t length) {
311
- return pm_constant_pool_insert(pool, start, length, PM_CONSTANT_POOL_BUCKET_OWNED);
312
- }
313
-
314
- /**
315
- * Insert a constant into a constant pool from memory that is constant. Returns
316
- * the id of the constant, or PM_CONSTANT_ID_UNSET if any potential calls to
317
- * resize fail.
318
- */
319
- pm_constant_id_t
320
- pm_constant_pool_insert_constant(pm_constant_pool_t *pool, const uint8_t *start, size_t length) {
321
- return pm_constant_pool_insert(pool, start, length, PM_CONSTANT_POOL_BUCKET_CONSTANT);
322
- }
323
-
324
- /**
325
- * Free the memory associated with a constant pool.
326
- */
327
- void
328
- pm_constant_pool_free(pm_constant_pool_t *pool) {
329
- // For each constant in the current constant pool, free the contents if the
330
- // contents are owned.
331
- for (uint32_t index = 0; index < pool->capacity; index++) {
332
- pm_constant_pool_bucket_t *bucket = &pool->buckets[index];
333
-
334
- // If an id is set on this constant, then we know we have content here.
335
- if (bucket->id != PM_CONSTANT_ID_UNSET && bucket->type == PM_CONSTANT_POOL_BUCKET_OWNED) {
336
- pm_constant_t *constant = &pool->constants[bucket->id - 1];
337
- xfree((void *) constant->start);
338
- }
339
- }
340
-
341
- xfree(pool->buckets);
342
- }