@appthreat/atom-parsetools 1.3.0 → 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 (266) hide show
  1. package/README.md +111 -14
  2. package/package.json +2 -1
  3. package/plugins/composer/installed.php +6 -6
  4. package/plugins/rubyastgen/Gemfile +6 -4
  5. package/plugins/rubyastgen/Gemfile.lock +5 -8
  6. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/Gemfile +11 -0
  7. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/exe/ruby_ast_gen +55 -0
  8. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/lib/ruby_ast_gen/cli.rb +133 -0
  9. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/lib/ruby_ast_gen/node_handling.rb +449 -0
  10. 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
  11. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/lib/ruby_ast_gen.rb +888 -0
  12. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-4ac84327b3af/ruby_ast_gen.gemspec +25 -0
  13. 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
  14. 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
  15. package/plugins/rubyastgen/bundle/ruby/4.0.0/specifications/ast-2.4.3.gemspec +29 -0
  16. package/plugins/rubyastgen/bundle/ruby/4.0.0/specifications/bundler-2.6.9.gemspec +25 -0
  17. package/plugins/rubyastgen/bundle/ruby/4.0.0/specifications/ostruct-0.6.3.gemspec +22 -0
  18. package/plugins/rubyastgen/bundle/ruby/4.0.0/specifications/parser-3.3.12.0.gemspec +37 -0
  19. package/rbastgen.js +102 -13
  20. package/scalasem.js +11 -2
  21. package/plugins/bin/bundler +0 -14
  22. package/plugins/bin/ruby_ast_gen +0 -14
  23. package/plugins/rubyastgen/bundle/bundler/setup.rb +0 -44
  24. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-cc312ebf06b4/exe/ruby_ast_gen +0 -63
  25. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-cc312ebf06b4/lib/ruby_ast_gen/node_handling.rb +0 -269
  26. package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/ruby_ast_gen-cc312ebf06b4/lib/ruby_ast_gen.rb +0 -218
  27. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/prism-1.9.0/gem.build_complete +0 -0
  28. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/prism-1.9.0/gem_make.out +0 -44
  29. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/prism-1.9.0/mkmf.log +0 -74
  30. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/prism-1.9.0/prism/prism.so +0 -0
  31. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/racc-1.8.1/gem.build_complete +0 -0
  32. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/racc-1.8.1/gem_make.out +0 -18
  33. package/plugins/rubyastgen/bundle/ruby/4.0.0/extensions/x86_64-linux/4.0.0/racc-1.8.1/racc/cparse.so +0 -0
  34. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/BSDmakefile +0 -58
  35. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/Makefile +0 -116
  36. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/Makefile +0 -273
  37. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/api_node.c +0 -6945
  38. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/api_pack.c +0 -276
  39. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/extconf.rb +0 -127
  40. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/extension.c +0 -1427
  41. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/ext/prism/extension.h +0 -19
  42. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/ast.h +0 -8254
  43. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/defines.h +0 -260
  44. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/diagnostic.h +0 -458
  45. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/encoding.h +0 -283
  46. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/node.h +0 -129
  47. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/options.h +0 -488
  48. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/pack.h +0 -163
  49. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/parser.h +0 -936
  50. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/prettyprint.h +0 -34
  51. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/regexp.h +0 -43
  52. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/static_literals.h +0 -121
  53. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_buffer.h +0 -236
  54. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_char.h +0 -204
  55. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_constant_pool.h +0 -218
  56. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_integer.h +0 -130
  57. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_list.h +0 -103
  58. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_memchr.h +0 -29
  59. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_newline_list.h +0 -113
  60. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_string.h +0 -200
  61. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_strncasecmp.h +0 -32
  62. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/util/pm_strpbrk.h +0 -46
  63. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism/version.h +0 -29
  64. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/include/prism.h +0 -408
  65. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/compiler.rb +0 -801
  66. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/desugar_compiler.rb +0 -392
  67. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/dispatcher.rb +0 -2210
  68. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/dot_visitor.rb +0 -4767
  69. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/dsl.rb +0 -1003
  70. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/ffi.rb +0 -578
  71. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/inspect_visitor.rb +0 -2393
  72. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/lex_compat.rb +0 -911
  73. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/mutation_compiler.rb +0 -772
  74. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/node.rb +0 -19966
  75. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/node_ext.rb +0 -511
  76. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/pack.rb +0 -230
  77. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/parse_result/comments.rb +0 -188
  78. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/parse_result/errors.rb +0 -66
  79. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/parse_result/newlines.rb +0 -155
  80. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/parse_result.rb +0 -907
  81. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/pattern.rb +0 -269
  82. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/polyfill/append_as_bytes.rb +0 -15
  83. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/polyfill/byteindex.rb +0 -13
  84. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/polyfill/scan_byte.rb +0 -14
  85. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/polyfill/unpack1.rb +0 -14
  86. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/polyfill/warn.rb +0 -36
  87. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/prism.so +0 -0
  88. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/reflection.rb +0 -416
  89. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/relocation.rb +0 -505
  90. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/serialize.rb +0 -2400
  91. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/string_query.rb +0 -31
  92. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser/builder.rb +0 -62
  93. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser/compiler.rb +0 -2234
  94. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser/lexer.rb +0 -820
  95. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser.rb +0 -376
  96. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser_current.rb +0 -26
  97. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/parser_versions.rb +0 -36
  98. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ripper/filter.rb +0 -53
  99. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ripper/lexer.rb +0 -135
  100. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ripper/sexp.rb +0 -126
  101. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ripper/shim.rb +0 -5
  102. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ripper.rb +0 -3520
  103. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation/ruby_parser.rb +0 -1964
  104. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/translation.rb +0 -18
  105. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism/visitor.rb +0 -813
  106. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/lib/prism.rb +0 -98
  107. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/compiler.rbi +0 -12
  108. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/dsl.rbi +0 -524
  109. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/inspect_visitor.rbi +0 -12
  110. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/node.rbi +0 -8750
  111. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/node_ext.rbi +0 -107
  112. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/parse_result.rbi +0 -404
  113. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/reflection.rbi +0 -58
  114. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/string_query.rbi +0 -12
  115. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/translation/parser.rbi +0 -11
  116. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/translation/parser_versions.rbi +0 -23
  117. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/translation/ripper.rbi +0 -15
  118. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism/visitor.rbi +0 -473
  119. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/rbi/prism.rbi +0 -63
  120. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/compiler.rbs +0 -9
  121. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/dispatcher.rbs +0 -19
  122. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/dot_visitor.rbs +0 -6
  123. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/dsl.rbs +0 -351
  124. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/inspect_visitor.rbs +0 -22
  125. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/lex_compat.rbs +0 -10
  126. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/mutation_compiler.rbs +0 -159
  127. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/node.rbs +0 -4042
  128. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/node_ext.rbs +0 -149
  129. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/pack.rbs +0 -43
  130. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/parse_result/comments.rbs +0 -38
  131. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/parse_result.rbs +0 -197
  132. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/pattern.rbs +0 -13
  133. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/reflection.rbs +0 -50
  134. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/relocation.rbs +0 -185
  135. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/serialize.rbs +0 -8
  136. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/string_query.rbs +0 -11
  137. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism/visitor.rbs +0 -169
  138. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/sig/prism.rbs +0 -272
  139. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/diagnostic.c +0 -854
  140. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/encoding.c +0 -5340
  141. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/node.c +0 -8685
  142. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/options.c +0 -338
  143. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/pack.c +0 -509
  144. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/prettyprint.c +0 -8957
  145. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/prism.c +0 -22679
  146. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/regexp.c +0 -790
  147. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/serialize.c +0 -2274
  148. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/static_literals.c +0 -617
  149. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/token_type.c +0 -703
  150. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_buffer.c +0 -357
  151. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_char.c +0 -318
  152. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_constant_pool.c +0 -342
  153. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_integer.c +0 -670
  154. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_list.c +0 -49
  155. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_memchr.c +0 -35
  156. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_newline_list.c +0 -125
  157. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_string.c +0 -381
  158. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_strncasecmp.c +0 -36
  159. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/prism-1.9.0/src/util/pm_strpbrk.c +0 -206
  160. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/BSDL +0 -22
  161. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/COPYING +0 -56
  162. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ChangeLog +0 -846
  163. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/README.ja.rdoc +0 -58
  164. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/README.rdoc +0 -60
  165. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/TODO +0 -5
  166. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/bin/racc +0 -320
  167. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ext/racc/cparse/Makefile +0 -273
  168. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ext/racc/cparse/cparse.c +0 -840
  169. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/ext/racc/cparse/extconf.rb +0 -8
  170. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/compat.rb +0 -33
  171. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/cparse.so +0 -0
  172. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/debugflags.rb +0 -60
  173. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/exception.rb +0 -16
  174. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/grammar.rb +0 -1191
  175. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/grammarfileparser.rb +0 -667
  176. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/info.rb +0 -18
  177. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/iset.rb +0 -92
  178. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/logfilegenerator.rb +0 -212
  179. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/parser-text.rb +0 -644
  180. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/parser.rb +0 -630
  181. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/parserfilegenerator.rb +0 -473
  182. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/sourcetext.rb +0 -35
  183. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/state.rb +0 -976
  184. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/statetransitiontable.rb +0 -311
  185. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc/static.rb +0 -5
  186. package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/racc-1.8.1/lib/racc.rb +0 -6
  187. /package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/{ruby_ast_gen-cc312ebf06b4 → ruby_ast_gen-4ac84327b3af}/.rspec +0 -0
  188. /package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/{ruby_ast_gen-cc312ebf06b4 → ruby_ast_gen-4ac84327b3af}/bin/console +0 -0
  189. /package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/{ruby_ast_gen-cc312ebf06b4 → ruby_ast_gen-4ac84327b3af}/bin/setup +0 -0
  190. /package/plugins/rubyastgen/bundle/ruby/4.0.0/bundler/gems/{ruby_ast_gen-cc312ebf06b4 → ruby_ast_gen-4ac84327b3af}/update_version.rb +0 -0
  191. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/bin/ruby-parse +0 -0
  192. /package/plugins/rubyastgen/bundle/ruby/4.0.0/gems/{parser-3.3.11.1 → parser-3.3.12.0}/bin/ruby-rewrite +0 -0
  193. /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
  194. /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
  195. /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
  196. /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
  197. /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
  198. /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
  199. /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
  200. /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
  201. /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
  202. /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
  203. /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
  204. /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
  205. /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
  206. /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
  207. /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
  208. /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
  209. /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
  210. /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
  211. /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
  212. /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
  213. /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
  214. /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
  215. /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
  216. /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
  217. /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
  218. /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
  219. /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
  220. /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
  221. /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
  222. /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
  223. /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
  224. /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
  225. /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
  226. /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
  227. /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
  228. /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
  229. /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
  230. /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
  231. /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
  232. /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
  233. /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
  234. /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
  235. /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
  236. /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
  237. /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
  238. /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
  239. /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
  240. /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
  241. /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
  242. /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
  243. /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
  244. /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
  245. /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
  246. /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
  247. /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
  248. /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
  249. /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
  250. /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
  251. /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
  252. /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
  253. /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
  254. /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
  255. /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
  256. /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
  257. /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
  258. /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
  259. /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
  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.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/static_environment.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/syntax_error.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/tree_rewriter.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/unknown_encoding_in_magic_comment_error.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/variables_stack.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.rb +0 -0
@@ -1,376 +0,0 @@
1
- # frozen_string_literal: true
2
- # :markup: markdown
3
-
4
- begin
5
- required_version = ">= 3.3.7.2"
6
- gem "parser", required_version
7
- require "parser"
8
- rescue LoadError
9
- warn(<<~MSG)
10
- Error: Unable to load parser #{required_version}. \
11
- Add `gem "parser"` to your Gemfile or run `bundle update parser`.
12
- MSG
13
- exit(1)
14
- end
15
-
16
- module Prism
17
- module Translation
18
- # This class is the entry-point for converting a prism syntax tree into the
19
- # whitequark/parser gem's syntax tree. It inherits from the base parser for
20
- # the parser gem, and overrides the parse* methods to parse with prism and
21
- # then translate.
22
- #
23
- # Note that this version of the parser always parses using the latest
24
- # version of Ruby syntax supported by Prism. If you want specific version
25
- # support, use one of the version-specific subclasses, such as
26
- # `Prism::Translation::Parser34`. If you want to parse using the same
27
- # version of Ruby syntax as the currently running version of Ruby, use
28
- # `Prism::Translation::ParserCurrent`.
29
- class Parser < ::Parser::Base
30
- Diagnostic = ::Parser::Diagnostic # :nodoc:
31
- private_constant :Diagnostic
32
-
33
- # The parser gem has a list of diagnostics with a hard-coded set of error
34
- # messages. We create our own diagnostic class in order to set our own
35
- # error messages.
36
- class PrismDiagnostic < Diagnostic
37
- # This is the cached message coming from prism.
38
- attr_reader :message
39
-
40
- # Initialize a new diagnostic with the given message and location.
41
- def initialize(message, level, reason, location)
42
- @message = message
43
- super(level, reason, {}, location, [])
44
- end
45
- end
46
-
47
- Racc_debug_parser = false # :nodoc:
48
-
49
- # The `builder` argument is used to create the parser using our custom builder class by default.
50
- #
51
- # By using the `:parser` keyword argument, you can translate in a way that is compatible with
52
- # the Parser gem using any parser.
53
- #
54
- # For example, in RuboCop for Ruby LSP, the following approach can be used to improve performance
55
- # by reusing a pre-parsed `Prism::ParseLexResult`:
56
- #
57
- # class PrismPreparsed
58
- # def initialize(prism_result)
59
- # @prism_result = prism_result
60
- # end
61
- #
62
- # def parse_lex(source, **options)
63
- # @prism_result
64
- # end
65
- # end
66
- #
67
- # prism_preparsed = PrismPreparsed.new(prism_result)
68
- #
69
- # Prism::Translation::Ruby34.new(builder, parser: prism_preparsed)
70
- #
71
- # In an object passed to the `:parser` keyword argument, the `parse` and `parse_lex` methods
72
- # should be implemented as needed.
73
- #
74
- def initialize(builder = Prism::Translation::Parser::Builder.new, parser: Prism)
75
- if !builder.is_a?(Prism::Translation::Parser::Builder)
76
- warn(<<~MSG, uplevel: 1, category: :deprecated)
77
- [deprecation]: The builder passed to `Prism::Translation::Parser.new` is not a \
78
- `Prism::Translation::Parser::Builder` subclass. This will raise in the next major version.
79
- MSG
80
- end
81
- @parser = parser
82
-
83
- super(builder)
84
- end
85
-
86
- def version # :nodoc:
87
- 41
88
- end
89
-
90
- # The default encoding for Ruby files is UTF-8.
91
- def default_encoding
92
- Encoding::UTF_8
93
- end
94
-
95
- def yyerror # :nodoc:
96
- end
97
-
98
- # Parses a source buffer and returns the AST.
99
- def parse(source_buffer)
100
- @source_buffer = source_buffer
101
- source = source_buffer.source
102
-
103
- offset_cache = build_offset_cache(source)
104
- result = unwrap(@parser.parse(source, **prism_options), offset_cache)
105
-
106
- build_ast(result.value, offset_cache)
107
- ensure
108
- @source_buffer = nil
109
- end
110
-
111
- # Parses a source buffer and returns the AST and the source code comments.
112
- def parse_with_comments(source_buffer)
113
- @source_buffer = source_buffer
114
- source = source_buffer.source
115
-
116
- offset_cache = build_offset_cache(source)
117
- result = unwrap(@parser.parse(source, **prism_options), offset_cache)
118
-
119
- [
120
- build_ast(result.value, offset_cache),
121
- build_comments(result.comments, offset_cache)
122
- ]
123
- ensure
124
- @source_buffer = nil
125
- end
126
-
127
- # Parses a source buffer and returns the AST, the source code comments,
128
- # and the tokens emitted by the lexer.
129
- def tokenize(source_buffer, recover = false)
130
- @source_buffer = source_buffer
131
- source = source_buffer.source
132
-
133
- offset_cache = build_offset_cache(source)
134
- result =
135
- begin
136
- unwrap(@parser.parse_lex(source, **prism_options), offset_cache)
137
- rescue ::Parser::SyntaxError
138
- raise if !recover
139
- end
140
-
141
- program, tokens = result.value
142
- ast = build_ast(program, offset_cache) if result.success?
143
-
144
- [
145
- ast,
146
- build_comments(result.comments, offset_cache),
147
- build_tokens(tokens, offset_cache)
148
- ]
149
- ensure
150
- @source_buffer = nil
151
- end
152
-
153
- # Since prism resolves num params for us, we don't need to support this
154
- # kind of logic here.
155
- def try_declare_numparam(node)
156
- node.children[0].match?(/\A_[1-9]\z/)
157
- end
158
-
159
- private
160
-
161
- # This is a hook to allow consumers to disable some errors if they don't
162
- # want them to block creating the syntax tree.
163
- def valid_error?(error)
164
- true
165
- end
166
-
167
- # This is a hook to allow consumers to disable some warnings if they don't
168
- # want them to block creating the syntax tree.
169
- def valid_warning?(warning)
170
- true
171
- end
172
-
173
- # Build a diagnostic from the given prism parse error.
174
- def error_diagnostic(error, offset_cache)
175
- location = error.location
176
- diagnostic_location = build_range(location, offset_cache)
177
-
178
- case error.type
179
- when :argument_block_multi
180
- Diagnostic.new(:error, :block_and_blockarg, {}, diagnostic_location, [])
181
- when :argument_formal_constant
182
- Diagnostic.new(:error, :argument_const, {}, diagnostic_location, [])
183
- when :argument_formal_class
184
- Diagnostic.new(:error, :argument_cvar, {}, diagnostic_location, [])
185
- when :argument_formal_global
186
- Diagnostic.new(:error, :argument_gvar, {}, diagnostic_location, [])
187
- when :argument_formal_ivar
188
- Diagnostic.new(:error, :argument_ivar, {}, diagnostic_location, [])
189
- when :argument_no_forwarding_amp
190
- Diagnostic.new(:error, :no_anonymous_blockarg, {}, diagnostic_location, [])
191
- when :argument_no_forwarding_star
192
- Diagnostic.new(:error, :no_anonymous_restarg, {}, diagnostic_location, [])
193
- when :argument_no_forwarding_star_star
194
- Diagnostic.new(:error, :no_anonymous_kwrestarg, {}, diagnostic_location, [])
195
- when :begin_lonely_else
196
- location = location.copy(length: 4)
197
- diagnostic_location = build_range(location, offset_cache)
198
- Diagnostic.new(:error, :useless_else, {}, diagnostic_location, [])
199
- when :class_name, :module_name
200
- Diagnostic.new(:error, :module_name_const, {}, diagnostic_location, [])
201
- when :class_in_method
202
- Diagnostic.new(:error, :class_in_def, {}, diagnostic_location, [])
203
- when :def_endless_setter
204
- Diagnostic.new(:error, :endless_setter, {}, diagnostic_location, [])
205
- when :embdoc_term
206
- Diagnostic.new(:error, :embedded_document, {}, diagnostic_location, [])
207
- when :incomplete_variable_class, :incomplete_variable_class_3_3
208
- location = location.copy(length: location.length + 1)
209
- diagnostic_location = build_range(location, offset_cache)
210
-
211
- Diagnostic.new(:error, :cvar_name, { name: location.slice }, diagnostic_location, [])
212
- when :incomplete_variable_instance, :incomplete_variable_instance_3_3
213
- location = location.copy(length: location.length + 1)
214
- diagnostic_location = build_range(location, offset_cache)
215
-
216
- Diagnostic.new(:error, :ivar_name, { name: location.slice }, diagnostic_location, [])
217
- when :invalid_variable_global, :invalid_variable_global_3_3
218
- Diagnostic.new(:error, :gvar_name, { name: location.slice }, diagnostic_location, [])
219
- when :module_in_method
220
- Diagnostic.new(:error, :module_in_def, {}, diagnostic_location, [])
221
- when :numbered_parameter_ordinary
222
- Diagnostic.new(:error, :ordinary_param_defined, {}, diagnostic_location, [])
223
- when :numbered_parameter_outer_scope
224
- Diagnostic.new(:error, :numparam_used_in_outer_scope, {}, diagnostic_location, [])
225
- when :parameter_circular
226
- Diagnostic.new(:error, :circular_argument_reference, { var_name: location.slice }, diagnostic_location, [])
227
- when :parameter_name_repeat
228
- Diagnostic.new(:error, :duplicate_argument, {}, diagnostic_location, [])
229
- when :parameter_numbered_reserved
230
- Diagnostic.new(:error, :reserved_for_numparam, { name: location.slice }, diagnostic_location, [])
231
- when :regexp_unknown_options
232
- Diagnostic.new(:error, :regexp_options, { options: location.slice[1..] }, diagnostic_location, [])
233
- when :singleton_for_literals
234
- Diagnostic.new(:error, :singleton_literal, {}, diagnostic_location, [])
235
- when :string_literal_eof
236
- Diagnostic.new(:error, :string_eof, {}, diagnostic_location, [])
237
- when :unexpected_token_ignore
238
- Diagnostic.new(:error, :unexpected_token, { token: location.slice }, diagnostic_location, [])
239
- when :write_target_in_method
240
- Diagnostic.new(:error, :dynamic_const, {}, diagnostic_location, [])
241
- else
242
- PrismDiagnostic.new(error.message, :error, error.type, diagnostic_location)
243
- end
244
- end
245
-
246
- # Build a diagnostic from the given prism parse warning.
247
- def warning_diagnostic(warning, offset_cache)
248
- diagnostic_location = build_range(warning.location, offset_cache)
249
-
250
- case warning.type
251
- when :ambiguous_first_argument_plus
252
- Diagnostic.new(:warning, :ambiguous_prefix, { prefix: "+" }, diagnostic_location, [])
253
- when :ambiguous_first_argument_minus
254
- Diagnostic.new(:warning, :ambiguous_prefix, { prefix: "-" }, diagnostic_location, [])
255
- when :ambiguous_prefix_ampersand
256
- Diagnostic.new(:warning, :ambiguous_prefix, { prefix: "&" }, diagnostic_location, [])
257
- when :ambiguous_prefix_star
258
- Diagnostic.new(:warning, :ambiguous_prefix, { prefix: "*" }, diagnostic_location, [])
259
- when :ambiguous_prefix_star_star
260
- Diagnostic.new(:warning, :ambiguous_prefix, { prefix: "**" }, diagnostic_location, [])
261
- when :ambiguous_slash
262
- Diagnostic.new(:warning, :ambiguous_regexp, {}, diagnostic_location, [])
263
- when :dot_dot_dot_eol
264
- Diagnostic.new(:warning, :triple_dot_at_eol, {}, diagnostic_location, [])
265
- when :duplicated_hash_key
266
- # skip, parser does this on its own
267
- else
268
- PrismDiagnostic.new(warning.message, :warning, warning.type, diagnostic_location)
269
- end
270
- end
271
-
272
- # If there was a error generated during the parse, then raise an
273
- # appropriate syntax error. Otherwise return the result.
274
- def unwrap(result, offset_cache)
275
- result.errors.each do |error|
276
- next unless valid_error?(error)
277
- diagnostics.process(error_diagnostic(error, offset_cache))
278
- end
279
-
280
- result.warnings.each do |warning|
281
- next unless valid_warning?(warning)
282
- diagnostic = warning_diagnostic(warning, offset_cache)
283
- diagnostics.process(diagnostic) if diagnostic
284
- end
285
-
286
- result
287
- end
288
-
289
- # Prism deals with offsets in bytes, while the parser gem deals with
290
- # offsets in characters. We need to handle this conversion in order to
291
- # build the parser gem AST.
292
- #
293
- # If the bytesize of the source is the same as the length, then we can
294
- # just use the offset directly. Otherwise, we build an array where the
295
- # index is the byte offset and the value is the character offset.
296
- def build_offset_cache(source)
297
- if source.bytesize == source.length
298
- -> (offset) { offset }
299
- else
300
- offset_cache = []
301
- offset = 0
302
-
303
- source.each_char do |char|
304
- char.bytesize.times { offset_cache << offset }
305
- offset += 1
306
- end
307
-
308
- offset_cache << offset
309
- end
310
- end
311
-
312
- # Build the parser gem AST from the prism AST.
313
- def build_ast(program, offset_cache)
314
- program.accept(Compiler.new(self, offset_cache))
315
- end
316
-
317
- # Build the parser gem comments from the prism comments.
318
- def build_comments(comments, offset_cache)
319
- comments.map do |comment|
320
- ::Parser::Source::Comment.new(build_range(comment.location, offset_cache))
321
- end
322
- end
323
-
324
- # Build the parser gem tokens from the prism tokens.
325
- def build_tokens(tokens, offset_cache)
326
- Lexer.new(source_buffer, tokens, offset_cache).to_a
327
- end
328
-
329
- # Build a range from a prism location.
330
- def build_range(location, offset_cache)
331
- ::Parser::Source::Range.new(
332
- source_buffer,
333
- offset_cache[location.start_offset],
334
- offset_cache[location.end_offset]
335
- )
336
- end
337
-
338
- # Options for how prism should parse/lex the source.
339
- def prism_options
340
- options = {
341
- filepath: @source_buffer.name,
342
- version: convert_for_prism(version),
343
- partial_script: true,
344
- }
345
- # The parser gem always encodes to UTF-8, unless it is binary.
346
- # https://github.com/whitequark/parser/blob/v3.3.6.0/lib/parser/source/buffer.rb#L80-L107
347
- options[:encoding] = false if @source_buffer.source.encoding != Encoding::BINARY
348
-
349
- options
350
- end
351
-
352
- # Converts the version format handled by Parser to the format handled by Prism.
353
- def convert_for_prism(version)
354
- case version
355
- when 33
356
- "3.3.1"
357
- when 34
358
- "3.4.0"
359
- when 35, 40
360
- "4.0.0"
361
- when 41
362
- "4.1.0"
363
- else
364
- "latest"
365
- end
366
- end
367
-
368
- require_relative "parser/builder"
369
- require_relative "parser/compiler"
370
- require_relative "parser/lexer"
371
-
372
- private_constant :Compiler
373
- private_constant :Lexer
374
- end
375
- end
376
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
- # :markup: markdown
3
- # typed: ignore
4
-
5
- #
6
- module Prism
7
- module Translation
8
- case RUBY_VERSION
9
- when /^3\.3\./
10
- ParserCurrent = Parser33
11
- when /^3\.4\./
12
- ParserCurrent = Parser34
13
- when /^3\.5\./, /^4\.0\./
14
- ParserCurrent = Parser40
15
- when /^4\.1\./
16
- ParserCurrent = Parser41
17
- else
18
- # Keep this in sync with released Ruby.
19
- parser = Parser40
20
- major, minor, _patch = Gem::Version.new(RUBY_VERSION).segments
21
- warn "warning: `Prism::Translation::Current` is loading #{parser.name}, " \
22
- "but you are running #{major}.#{minor}."
23
- ParserCurrent = parser
24
- end
25
- end
26
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
- # :markup: markdown
3
-
4
- module Prism
5
- module Translation
6
- # This class is the entry-point for Ruby 3.3 of `Prism::Translation::Parser`.
7
- class Parser33 < Parser
8
- def version # :nodoc:
9
- 33
10
- end
11
- end
12
-
13
- # This class is the entry-point for Ruby 3.4 of `Prism::Translation::Parser`.
14
- class Parser34 < Parser
15
- def version # :nodoc:
16
- 34
17
- end
18
- end
19
-
20
- # This class is the entry-point for Ruby 4.0 of `Prism::Translation::Parser`.
21
- class Parser40 < Parser
22
- def version # :nodoc:
23
- 40
24
- end
25
- end
26
-
27
- Parser35 = Parser40 # :nodoc:
28
-
29
- # This class is the entry-point for Ruby 4.1 of `Prism::Translation::Parser`.
30
- class Parser41 < Parser
31
- def version # :nodoc:
32
- 41
33
- end
34
- end
35
- end
36
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Prism
4
- module Translation
5
- class Ripper
6
- class Filter # :nodoc:
7
- # :stopdoc:
8
- def initialize(src, filename = '-', lineno = 1)
9
- @__lexer = Lexer.new(src, filename, lineno)
10
- @__line = nil
11
- @__col = nil
12
- @__state = nil
13
- end
14
-
15
- def filename
16
- @__lexer.filename
17
- end
18
-
19
- def lineno
20
- @__line
21
- end
22
-
23
- def column
24
- @__col
25
- end
26
-
27
- def state
28
- @__state
29
- end
30
-
31
- def parse(init = nil)
32
- data = init
33
- @__lexer.lex.each do |pos, event, tok, state|
34
- @__line, @__col = *pos
35
- @__state = state
36
- data = if respond_to?(event, true)
37
- then __send__(event, tok, data)
38
- else on_default(event, tok, data)
39
- end
40
- end
41
- data
42
- end
43
-
44
- private
45
-
46
- def on_default(event, token, data)
47
- data
48
- end
49
- # :startdoc:
50
- end
51
- end
52
- end
53
- end
@@ -1,135 +0,0 @@
1
- # frozen_string_literal: true
2
- # :markup: markdown
3
-
4
- require_relative "../ripper"
5
-
6
- module Prism
7
- module Translation
8
- class Ripper
9
- class Lexer < Ripper # :nodoc:
10
- # :stopdoc:
11
- class State
12
-
13
- attr_reader :to_int, :to_s
14
-
15
- def initialize(i)
16
- @to_int = i
17
- @to_s = Ripper.lex_state_name(i)
18
- freeze
19
- end
20
-
21
- def [](index)
22
- case index
23
- when 0, :to_int
24
- @to_int
25
- when 1, :to_s
26
- @to_s
27
- else
28
- nil
29
- end
30
- end
31
-
32
- alias to_i to_int
33
- alias inspect to_s
34
- def pretty_print(q) q.text(to_s) end
35
- def ==(i) super or to_int == i end
36
- def &(i) self.class.new(to_int & i) end
37
- def |(i) self.class.new(to_int | i) end
38
- def allbits?(i) to_int.allbits?(i) end
39
- def anybits?(i) to_int.anybits?(i) end
40
- def nobits?(i) to_int.nobits?(i) end
41
-
42
- # Instances are frozen and there are only a handful of them so we cache them here.
43
- STATES = Hash.new { |h,k| h[k] = State.new(k) }
44
-
45
- def self.cached(i)
46
- STATES[i]
47
- end
48
- end
49
-
50
- class Elem
51
- attr_accessor :pos, :event, :tok, :state, :message
52
-
53
- def initialize(pos, event, tok, state, message = nil)
54
- @pos = pos
55
- @event = event
56
- @tok = tok
57
- @state = State.cached(state)
58
- @message = message
59
- end
60
-
61
- def [](index)
62
- case index
63
- when 0, :pos
64
- @pos
65
- when 1, :event
66
- @event
67
- when 2, :tok
68
- @tok
69
- when 3, :state
70
- @state
71
- when 4, :message
72
- @message
73
- else
74
- nil
75
- end
76
- end
77
-
78
- def inspect
79
- "#<#{self.class}: #{event}@#{pos[0]}:#{pos[1]}:#{state}: #{tok.inspect}#{": " if message}#{message}>"
80
- end
81
-
82
- alias to_s inspect
83
-
84
- def pretty_print(q)
85
- q.group(2, "#<#{self.class}:", ">") {
86
- q.breakable
87
- q.text("#{event}@#{pos[0]}:#{pos[1]}")
88
- q.breakable
89
- state.pretty_print(q)
90
- q.breakable
91
- q.text("token: ")
92
- tok.pretty_print(q)
93
- if message
94
- q.breakable
95
- q.text("message: ")
96
- q.text(message)
97
- end
98
- }
99
- end
100
-
101
- def to_a
102
- if @message
103
- [@pos, @event, @tok, @state, @message]
104
- else
105
- [@pos, @event, @tok, @state]
106
- end
107
- end
108
- end
109
-
110
- # Pretty much just the same as Prism.lex_compat.
111
- def lex(raise_errors: false)
112
- Ripper.lex(@source, filename, lineno, raise_errors: raise_errors)
113
- end
114
-
115
- # Returns the lex_compat result wrapped in `Elem`. Errors are omitted.
116
- # Since ripper is a streaming parser, tokens are expected to be emitted in the order
117
- # that the parser encounters them. This is not implemented.
118
- def parse(...)
119
- lex(...).map do |position, event, token, state|
120
- Elem.new(position, event, token, state.to_int)
121
- end
122
- end
123
-
124
- # Similar to parse but ripper sorts the elements by position in the source. Also
125
- # includes errors. Since prism does error recovery, in cases of syntax errors
126
- # the result may differ greatly compared to ripper.
127
- def scan(...)
128
- parse(...)
129
- end
130
-
131
- # :startdoc:
132
- end
133
- end
134
- end
135
- end