herb 0.11.1 → 0.11.2

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 (247) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -2
  3. data/config.yml +6 -0
  4. data/ext/herb/extconf.rb +8 -31
  5. data/ext/herb/nodes.c +75 -75
  6. data/ext/herb/parser_options_helpers.c +26 -0
  7. data/lib/herb/analysis/partial_index.rb +1 -1
  8. data/lib/herb/analysis/partial_resolution.rb +27 -0
  9. data/lib/herb/ast/helpers.rb +1 -1
  10. data/lib/herb/configuration.rb +11 -1
  11. data/lib/herb/dev/classifier.rb +1 -1
  12. data/lib/herb/engine/compiler.rb +5 -8
  13. data/lib/herb/engine/slots/dynamics_compiler.rb +53 -14
  14. data/lib/herb/engine/slots/subtree_compiler.rb +1 -1
  15. data/lib/herb/engine/slots/visitor.rb +32 -4
  16. data/lib/herb/engine/visitors/instrumentation_visitor.rb +18 -6
  17. data/lib/herb/parser_options.rb +6 -3
  18. data/lib/herb/project.rb +19 -8
  19. data/lib/herb/version.rb +1 -1
  20. data/lib/herb.rb +1 -1
  21. data/sig/herb/analysis/partial_resolution.rbs +8 -0
  22. data/sig/herb/configuration.rbs +3 -0
  23. data/sig/herb/engine/slots/dynamics_compiler.rbs +24 -7
  24. data/sig/herb/engine/slots/visitor.rbs +14 -0
  25. data/sig/herb/engine/visitors/instrumentation_visitor.rbs +5 -1
  26. data/sig/herb/parser_options.rbs +6 -4
  27. data/sig/herb.rbs +2 -2
  28. data/src/analyze/action_view/attribute_extraction_helpers.c +40 -21
  29. data/src/analyze/action_view/generated_handlers.c +36 -36
  30. data/src/analyze/action_view/image_tag.c +7 -3
  31. data/src/analyze/action_view/javascript_include_tag.c +6 -3
  32. data/src/analyze/action_view/link_to.c +23 -23
  33. data/src/analyze/action_view/registry.c +7 -3
  34. data/src/analyze/action_view/tag_helper_node_builders.c +6 -13
  35. data/src/analyze/action_view/tag_helpers.c +139 -90
  36. data/src/analyze/action_view/turbo_frame_tag.c +5 -4
  37. data/src/analyze/analyze.c +35 -19
  38. data/src/analyze/analyze_helpers.c +161 -188
  39. data/src/analyze/analyzed_ruby.c +8 -7
  40. data/src/analyze/control_type.c +29 -22
  41. data/src/analyze/herb_directives.c +16 -20
  42. data/src/analyze/iteration_nodes.c +69 -24
  43. data/src/analyze/parse_errors.c +32 -22
  44. data/src/analyze/postfix_conditionals.c +23 -13
  45. data/src/analyze/prism_annotate.c +29 -28
  46. data/src/analyze/render_nodes.c +51 -41
  47. data/src/analyze/strict_locals.c +14 -15
  48. data/src/analyze/ternary_conditionals.c +14 -10
  49. data/src/herb.c +10 -8
  50. data/src/include/analyze/action_view/tag_helper_handler.h +1 -1
  51. data/src/include/analyze/action_view/tag_helper_node_builders.h +1 -0
  52. data/src/include/analyze/action_view/tag_helpers.h +1 -1
  53. data/src/include/analyze/analyze.h +3 -2
  54. data/src/include/analyze/analyzed_ruby.h +4 -2
  55. data/src/include/analyze/helpers.h +6 -6
  56. data/src/include/herb.h +3 -2
  57. data/src/include/parser/parser_options.h +5 -0
  58. data/src/include/prism/prism_context.h +12 -12
  59. data/src/include/prism/prism_helpers.h +30 -0
  60. data/src/include/prism_version.h +11 -0
  61. data/src/include/version.h +1 -1
  62. data/src/parser/parser_helpers.c +1 -2
  63. data/src/parser.c +6 -7
  64. data/src/parser_options_defaults.c +1 -0
  65. data/src/prism/prism_helpers.c +84 -50
  66. data/src/prism/ruby_parser.c +20 -20
  67. data/templates/ext/herb/nodes.c.erb +5 -5
  68. data/templates/ext/herb/parser_options_helpers.c.erb +33 -0
  69. data/templates/java/nodes.c.erb +6 -6
  70. data/templates/java/parser_options_helpers.c.erb +41 -2
  71. data/templates/java/parser_options_helpers.h.erb +2 -1
  72. data/templates/javascript/packages/node/extension/nodes.cpp.erb +5 -5
  73. data/templates/javascript/packages/node/extension/parser_options_helpers.cpp.erb +34 -2
  74. data/templates/javascript/packages/node/extension/parser_options_helpers.h.erb +1 -1
  75. data/templates/lib/herb/parser_options.rb.erb +1 -1
  76. data/templates/rust/src/prism/generated_deserialize.rs.erb +90 -44
  77. data/templates/rust/src/prism/generated_prettyprint.rs.erb +18 -27
  78. data/templates/src/analyze/action_view/generated_handlers.c.erb +23 -22
  79. data/templates/src/include/parser/parser_options.h.erb +10 -0
  80. data/templates/src/include/prism_version.h.erb +17 -0
  81. data/templates/src/parser_options_defaults.c.erb +1 -1
  82. data/templates/template.rb +17 -2
  83. data/templates/wasm/nodes.cpp.erb +5 -5
  84. data/templates/wasm/parser_options_helpers.cpp.erb +24 -0
  85. data/vendor/prism/Rakefile +76 -7
  86. data/vendor/prism/config.yml +174 -161
  87. data/vendor/prism/include/prism/arena.h +45 -0
  88. data/vendor/prism/include/prism/arena.hpp +42 -0
  89. data/vendor/prism/include/prism/ast.h +2738 -611
  90. data/vendor/prism/include/prism/ast.hpp +641 -0
  91. data/vendor/prism/include/prism/buffer.h +60 -0
  92. data/vendor/prism/include/prism/buffer.hpp +55 -0
  93. data/vendor/prism/include/prism/comments.h +72 -0
  94. data/vendor/prism/include/prism/compiler/accel.h +26 -0
  95. data/vendor/prism/include/prism/compiler/align.h +36 -0
  96. data/vendor/prism/include/prism/compiler/assume.h +25 -0
  97. data/vendor/prism/include/prism/compiler/branch.h +26 -0
  98. data/vendor/prism/include/prism/compiler/bswap.h +46 -0
  99. data/vendor/prism/include/prism/compiler/cplusplus.hpp +16 -0
  100. data/vendor/prism/include/prism/compiler/endianness.h +34 -0
  101. data/vendor/prism/include/prism/compiler/exceptions.hpp +17 -0
  102. data/vendor/prism/include/prism/compiler/exported.h +24 -0
  103. data/vendor/prism/include/prism/compiler/fallthrough.h +22 -0
  104. data/vendor/prism/include/prism/compiler/filesystem.h +32 -0
  105. data/vendor/prism/include/prism/compiler/flex_array.h +19 -0
  106. data/vendor/prism/include/prism/compiler/force_inline.h +21 -0
  107. data/vendor/prism/include/prism/compiler/format.h +27 -0
  108. data/vendor/prism/include/prism/compiler/inline.h +17 -0
  109. data/vendor/prism/include/prism/compiler/lifetimebound.hpp +25 -0
  110. data/vendor/prism/include/prism/compiler/nodiscard.h +22 -0
  111. data/vendor/prism/include/prism/compiler/nonnull.h +18 -0
  112. data/vendor/prism/include/prism/compiler/unused.h +18 -0
  113. data/vendor/prism/include/prism/constant_pool.h +106 -0
  114. data/vendor/prism/include/prism/diagnostic.h +55 -402
  115. data/vendor/prism/include/prism/errors_format.h +61 -0
  116. data/vendor/prism/include/prism/excludes.h +29 -0
  117. data/vendor/prism/include/prism/integer.h +41 -0
  118. data/vendor/prism/include/prism/internal/allocator.h +68 -0
  119. data/vendor/prism/include/prism/internal/allocator_debug.h +88 -0
  120. data/vendor/prism/include/prism/internal/arena.h +108 -0
  121. data/vendor/prism/include/prism/internal/bit.h +42 -0
  122. data/vendor/prism/include/prism/internal/buffer.h +94 -0
  123. data/vendor/prism/include/prism/internal/char.h +145 -0
  124. data/vendor/prism/include/prism/internal/comments.h +54 -0
  125. data/vendor/prism/include/prism/internal/constant_pool.h +152 -0
  126. data/vendor/prism/include/prism/internal/diagnostic.h +389 -0
  127. data/vendor/prism/include/prism/{encoding.h → internal/encoding.h} +27 -68
  128. data/vendor/prism/include/prism/internal/integer.h +68 -0
  129. data/vendor/prism/include/prism/internal/isinf.h +16 -0
  130. data/vendor/prism/include/prism/internal/line_offset_list.h +34 -0
  131. data/vendor/prism/include/prism/{util/pm_list.h → internal/list.h} +11 -52
  132. data/vendor/prism/include/prism/internal/magic_comments.h +23 -0
  133. data/vendor/prism/include/prism/internal/memchr.h +15 -0
  134. data/vendor/prism/include/prism/internal/node.h +42 -0
  135. data/vendor/prism/include/prism/internal/options.h +232 -0
  136. data/vendor/prism/include/prism/internal/parser.h +1015 -0
  137. data/vendor/prism/include/prism/internal/regexp.h +26 -0
  138. data/vendor/prism/include/prism/internal/serialize.h +39 -0
  139. data/vendor/prism/include/prism/internal/source.h +72 -0
  140. data/vendor/prism/include/prism/internal/static_literals.h +60 -0
  141. data/vendor/prism/include/prism/internal/stringy.h +30 -0
  142. data/vendor/prism/include/prism/{util/pm_strncasecmp.h → internal/strncasecmp.h} +3 -17
  143. data/vendor/prism/include/prism/{util/pm_strpbrk.h → internal/strpbrk.h} +7 -20
  144. data/vendor/prism/include/prism/internal/tokens.h +11 -0
  145. data/vendor/prism/include/prism/internal/xxh3.h +16 -0
  146. data/vendor/prism/include/prism/json.h +40 -0
  147. data/vendor/prism/include/prism/line_offset_list.h +69 -0
  148. data/vendor/prism/include/prism/magic_comments.h +53 -0
  149. data/vendor/prism/include/prism/node.h +59 -49
  150. data/vendor/prism/include/prism/node.hpp +272 -0
  151. data/vendor/prism/include/prism/node_type.hpp +38 -0
  152. data/vendor/prism/include/prism/options.h +154 -279
  153. data/vendor/prism/include/prism/options.hpp +43 -0
  154. data/vendor/prism/include/prism/parser.h +367 -870
  155. data/vendor/prism/include/prism/parser.hpp +274 -0
  156. data/vendor/prism/include/prism/prettyprint.h +14 -9
  157. data/vendor/prism/include/prism/serialize.h +123 -0
  158. data/vendor/prism/include/prism/source.h +163 -0
  159. data/vendor/prism/include/prism/stream.h +36 -0
  160. data/vendor/prism/include/prism/string_query.h +82 -0
  161. data/vendor/prism/include/prism/stringy.h +61 -0
  162. data/vendor/prism/include/prism/stringy.hpp +31 -0
  163. data/vendor/prism/include/prism/version.h +20 -3
  164. data/vendor/prism/include/prism.h +35 -320
  165. data/vendor/prism/include/prism.hpp +24 -0
  166. data/vendor/prism/src/arena.c +122 -0
  167. data/vendor/prism/src/{util/pm_buffer.c → buffer.c} +53 -21
  168. data/vendor/prism/src/{util/pm_char.c → char.c} +28 -57
  169. data/vendor/prism/src/comments.c +455 -0
  170. data/vendor/prism/src/constant_pool.c +406 -0
  171. data/vendor/prism/src/diagnostic.c +120 -68
  172. data/vendor/prism/src/encoding.c +8 -3
  173. data/vendor/prism/src/errors_format.c +519 -0
  174. data/vendor/prism/src/{util/pm_integer.c → integer.c} +38 -22
  175. data/vendor/prism/src/json.c +5733 -0
  176. data/vendor/prism/src/line_offset_list.c +100 -0
  177. data/vendor/prism/src/list.c +24 -0
  178. data/vendor/prism/src/{util/pm_memchr.c → memchr.c} +8 -6
  179. data/vendor/prism/src/node.c +3465 -7787
  180. data/vendor/prism/src/options.c +161 -54
  181. data/vendor/prism/src/parser.c +371 -0
  182. data/vendor/prism/src/prettyprint.c +421 -354
  183. data/vendor/prism/src/prism.c +8522 -7280
  184. data/vendor/prism/src/regexp.c +960 -45
  185. data/vendor/prism/src/serialize.c +2434 -2048
  186. data/vendor/prism/src/source.c +524 -0
  187. data/vendor/prism/src/static_literals.c +303 -360
  188. data/vendor/prism/src/string_query.c +180 -0
  189. data/vendor/prism/src/stringy.c +61 -0
  190. data/vendor/prism/src/{util/pm_strncasecmp.c → strncasecmp.c} +5 -4
  191. data/vendor/prism/src/strpbrk.c +447 -0
  192. data/vendor/prism/src/{token_type.c → tokens.c} +39 -18
  193. data/vendor/prism/src/xxh3.c +292 -0
  194. data/vendor/prism/templates/ext/prism/api_node.c.erb +58 -44
  195. data/vendor/prism/templates/include/prism/ast.h.erb +67 -17
  196. data/vendor/prism/templates/include/prism/ast.hpp.erb +31 -0
  197. data/vendor/prism/templates/include/prism/internal/diagnostic.h.erb +60 -0
  198. data/vendor/prism/templates/java/{org → api/src/main/java-templates/org/ruby_lang}/prism/AbstractNodeVisitor.java.erb +1 -1
  199. data/vendor/prism/templates/java/{org → api/src/main/java-templates/org/ruby_lang}/prism/Loader.java.erb +232 -133
  200. data/vendor/prism/templates/java/{org → api/src/main/java-templates/org/ruby_lang}/prism/Nodes.java.erb +62 -23
  201. data/vendor/prism/templates/javascript/src/deserialize.js.erb +153 -146
  202. data/vendor/prism/templates/javascript/src/nodes.js.erb +4 -9
  203. data/vendor/prism/templates/lib/prism/compiler.rb.erb +14 -5
  204. data/vendor/prism/templates/lib/prism/dispatcher.rb.erb +20 -12
  205. data/vendor/prism/templates/lib/prism/dot_visitor.rb.erb +37 -11
  206. data/vendor/prism/templates/lib/prism/dsl.rb.erb +43 -4
  207. data/vendor/prism/templates/lib/prism/inspect_visitor.rb.erb +26 -10
  208. data/vendor/prism/templates/lib/prism/mutation_compiler.rb.erb +5 -2
  209. data/vendor/prism/templates/lib/prism/node.rb.erb +283 -105
  210. data/vendor/prism/templates/lib/prism/reflection.rb.erb +11 -2
  211. data/vendor/prism/templates/lib/prism/serialize.rb.erb +291 -134
  212. data/vendor/prism/templates/lib/prism/visitor.rb.erb +18 -0
  213. data/vendor/prism/templates/src/diagnostic.c.erb +114 -63
  214. data/vendor/prism/templates/src/json.c.erb +130 -0
  215. data/vendor/prism/templates/src/node.c.erb +79 -236
  216. data/vendor/prism/templates/src/prettyprint.c.erb +24 -13
  217. data/vendor/prism/templates/src/serialize.c.erb +369 -183
  218. data/vendor/prism/templates/src/{token_type.c.erb → tokens.c.erb} +22 -11
  219. data/vendor/prism/templates/template.rb +193 -91
  220. metadata +100 -42
  221. data/vendor/prism/include/prism/defines.h +0 -260
  222. data/vendor/prism/include/prism/pack.h +0 -163
  223. data/vendor/prism/include/prism/regexp.h +0 -43
  224. data/vendor/prism/include/prism/static_literals.h +0 -121
  225. data/vendor/prism/include/prism/util/pm_buffer.h +0 -236
  226. data/vendor/prism/include/prism/util/pm_char.h +0 -204
  227. data/vendor/prism/include/prism/util/pm_constant_pool.h +0 -218
  228. data/vendor/prism/include/prism/util/pm_integer.h +0 -130
  229. data/vendor/prism/include/prism/util/pm_memchr.h +0 -29
  230. data/vendor/prism/include/prism/util/pm_newline_list.h +0 -113
  231. data/vendor/prism/include/prism/util/pm_string.h +0 -200
  232. data/vendor/prism/src/pack.c +0 -509
  233. data/vendor/prism/src/util/pm_constant_pool.c +0 -342
  234. data/vendor/prism/src/util/pm_list.c +0 -49
  235. data/vendor/prism/src/util/pm_newline_list.c +0 -125
  236. data/vendor/prism/src/util/pm_string.c +0 -381
  237. data/vendor/prism/src/util/pm_strpbrk.c +0 -206
  238. data/vendor/prism/templates/include/prism/diagnostic.h.erb +0 -130
  239. data/vendor/prism/templates/rbi/prism/dsl.rbi.erb +0 -68
  240. data/vendor/prism/templates/rbi/prism/node.rbi.erb +0 -167
  241. data/vendor/prism/templates/rbi/prism/visitor.rbi.erb +0 -18
  242. data/vendor/prism/templates/sig/prism/_private/dot_visitor.rbs.erb +0 -45
  243. data/vendor/prism/templates/sig/prism/dsl.rbs.erb +0 -31
  244. data/vendor/prism/templates/sig/prism/mutation_compiler.rbs.erb +0 -7
  245. data/vendor/prism/templates/sig/prism/node.rbs.erb +0 -136
  246. data/vendor/prism/templates/sig/prism/visitor.rbs.erb +0 -17
  247. data/vendor/prism/templates/sig/prism.rbs.erb +0 -92
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: herb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Roth
@@ -743,6 +743,7 @@ files:
743
743
  - src/include/prism/prism_helpers.h
744
744
  - src/include/prism/prism_serialized.h
745
745
  - src/include/prism/ruby_parser.h
746
+ - src/include/prism_version.h
746
747
  - src/include/util/html_elements.h
747
748
  - src/include/util/html_util.h
748
749
  - src/include/util/io.h
@@ -862,6 +863,7 @@ files:
862
863
  - templates/src/include/lib/hb_foreach.h.erb
863
864
  - templates/src/include/parser/foreign_content_elements.h.erb
864
865
  - templates/src/include/parser/parser_options.h.erb
866
+ - templates/src/include/prism_version.h.erb
865
867
  - templates/src/include/util/html_elements.h.erb
866
868
  - templates/src/parser/match_tags.c.erb
867
869
  - templates/src/parser_options_defaults.c.erb
@@ -876,55 +878,119 @@ files:
876
878
  - vendor/prism/Rakefile
877
879
  - vendor/prism/config.yml
878
880
  - vendor/prism/include/prism.h
881
+ - vendor/prism/include/prism.hpp
882
+ - vendor/prism/include/prism/arena.h
883
+ - vendor/prism/include/prism/arena.hpp
879
884
  - vendor/prism/include/prism/ast.h
880
- - vendor/prism/include/prism/defines.h
885
+ - vendor/prism/include/prism/ast.hpp
886
+ - vendor/prism/include/prism/buffer.h
887
+ - vendor/prism/include/prism/buffer.hpp
888
+ - vendor/prism/include/prism/comments.h
889
+ - vendor/prism/include/prism/compiler/accel.h
890
+ - vendor/prism/include/prism/compiler/align.h
891
+ - vendor/prism/include/prism/compiler/assume.h
892
+ - vendor/prism/include/prism/compiler/branch.h
893
+ - vendor/prism/include/prism/compiler/bswap.h
894
+ - vendor/prism/include/prism/compiler/cplusplus.hpp
895
+ - vendor/prism/include/prism/compiler/endianness.h
896
+ - vendor/prism/include/prism/compiler/exceptions.hpp
897
+ - vendor/prism/include/prism/compiler/exported.h
898
+ - vendor/prism/include/prism/compiler/fallthrough.h
899
+ - vendor/prism/include/prism/compiler/filesystem.h
900
+ - vendor/prism/include/prism/compiler/flex_array.h
901
+ - vendor/prism/include/prism/compiler/force_inline.h
902
+ - vendor/prism/include/prism/compiler/format.h
903
+ - vendor/prism/include/prism/compiler/inline.h
904
+ - vendor/prism/include/prism/compiler/lifetimebound.hpp
905
+ - vendor/prism/include/prism/compiler/nodiscard.h
906
+ - vendor/prism/include/prism/compiler/nonnull.h
907
+ - vendor/prism/include/prism/compiler/unused.h
908
+ - vendor/prism/include/prism/constant_pool.h
881
909
  - vendor/prism/include/prism/diagnostic.h
882
- - vendor/prism/include/prism/encoding.h
910
+ - vendor/prism/include/prism/errors_format.h
911
+ - vendor/prism/include/prism/excludes.h
912
+ - vendor/prism/include/prism/integer.h
913
+ - vendor/prism/include/prism/internal/allocator.h
914
+ - vendor/prism/include/prism/internal/allocator_debug.h
915
+ - vendor/prism/include/prism/internal/arena.h
916
+ - vendor/prism/include/prism/internal/bit.h
917
+ - vendor/prism/include/prism/internal/buffer.h
918
+ - vendor/prism/include/prism/internal/char.h
919
+ - vendor/prism/include/prism/internal/comments.h
920
+ - vendor/prism/include/prism/internal/constant_pool.h
921
+ - vendor/prism/include/prism/internal/diagnostic.h
922
+ - vendor/prism/include/prism/internal/encoding.h
923
+ - vendor/prism/include/prism/internal/integer.h
924
+ - vendor/prism/include/prism/internal/isinf.h
925
+ - vendor/prism/include/prism/internal/line_offset_list.h
926
+ - vendor/prism/include/prism/internal/list.h
927
+ - vendor/prism/include/prism/internal/magic_comments.h
928
+ - vendor/prism/include/prism/internal/memchr.h
929
+ - vendor/prism/include/prism/internal/node.h
930
+ - vendor/prism/include/prism/internal/options.h
931
+ - vendor/prism/include/prism/internal/parser.h
932
+ - vendor/prism/include/prism/internal/regexp.h
933
+ - vendor/prism/include/prism/internal/serialize.h
934
+ - vendor/prism/include/prism/internal/source.h
935
+ - vendor/prism/include/prism/internal/static_literals.h
936
+ - vendor/prism/include/prism/internal/stringy.h
937
+ - vendor/prism/include/prism/internal/strncasecmp.h
938
+ - vendor/prism/include/prism/internal/strpbrk.h
939
+ - vendor/prism/include/prism/internal/tokens.h
940
+ - vendor/prism/include/prism/internal/xxh3.h
941
+ - vendor/prism/include/prism/json.h
942
+ - vendor/prism/include/prism/line_offset_list.h
943
+ - vendor/prism/include/prism/magic_comments.h
883
944
  - vendor/prism/include/prism/node.h
945
+ - vendor/prism/include/prism/node.hpp
946
+ - vendor/prism/include/prism/node_type.hpp
884
947
  - vendor/prism/include/prism/options.h
885
- - vendor/prism/include/prism/pack.h
948
+ - vendor/prism/include/prism/options.hpp
886
949
  - vendor/prism/include/prism/parser.h
950
+ - vendor/prism/include/prism/parser.hpp
887
951
  - vendor/prism/include/prism/prettyprint.h
888
- - vendor/prism/include/prism/regexp.h
889
- - vendor/prism/include/prism/static_literals.h
890
- - vendor/prism/include/prism/util/pm_buffer.h
891
- - vendor/prism/include/prism/util/pm_char.h
892
- - vendor/prism/include/prism/util/pm_constant_pool.h
893
- - vendor/prism/include/prism/util/pm_integer.h
894
- - vendor/prism/include/prism/util/pm_list.h
895
- - vendor/prism/include/prism/util/pm_memchr.h
896
- - vendor/prism/include/prism/util/pm_newline_list.h
897
- - vendor/prism/include/prism/util/pm_string.h
898
- - vendor/prism/include/prism/util/pm_strncasecmp.h
899
- - vendor/prism/include/prism/util/pm_strpbrk.h
952
+ - vendor/prism/include/prism/serialize.h
953
+ - vendor/prism/include/prism/source.h
954
+ - vendor/prism/include/prism/stream.h
955
+ - vendor/prism/include/prism/string_query.h
956
+ - vendor/prism/include/prism/stringy.h
957
+ - vendor/prism/include/prism/stringy.hpp
900
958
  - vendor/prism/include/prism/version.h
959
+ - vendor/prism/src/arena.c
960
+ - vendor/prism/src/buffer.c
961
+ - vendor/prism/src/char.c
962
+ - vendor/prism/src/comments.c
963
+ - vendor/prism/src/constant_pool.c
901
964
  - vendor/prism/src/diagnostic.c
902
965
  - vendor/prism/src/encoding.c
966
+ - vendor/prism/src/errors_format.c
967
+ - vendor/prism/src/integer.c
968
+ - vendor/prism/src/json.c
969
+ - vendor/prism/src/line_offset_list.c
970
+ - vendor/prism/src/list.c
971
+ - vendor/prism/src/memchr.c
903
972
  - vendor/prism/src/node.c
904
973
  - vendor/prism/src/options.c
905
- - vendor/prism/src/pack.c
974
+ - vendor/prism/src/parser.c
906
975
  - vendor/prism/src/prettyprint.c
907
976
  - vendor/prism/src/prism.c
908
977
  - vendor/prism/src/regexp.c
909
978
  - vendor/prism/src/serialize.c
979
+ - vendor/prism/src/source.c
910
980
  - vendor/prism/src/static_literals.c
911
- - vendor/prism/src/token_type.c
912
- - vendor/prism/src/util/pm_buffer.c
913
- - vendor/prism/src/util/pm_char.c
914
- - vendor/prism/src/util/pm_constant_pool.c
915
- - vendor/prism/src/util/pm_integer.c
916
- - vendor/prism/src/util/pm_list.c
917
- - vendor/prism/src/util/pm_memchr.c
918
- - vendor/prism/src/util/pm_newline_list.c
919
- - vendor/prism/src/util/pm_string.c
920
- - vendor/prism/src/util/pm_strncasecmp.c
921
- - vendor/prism/src/util/pm_strpbrk.c
981
+ - vendor/prism/src/string_query.c
982
+ - vendor/prism/src/stringy.c
983
+ - vendor/prism/src/strncasecmp.c
984
+ - vendor/prism/src/strpbrk.c
985
+ - vendor/prism/src/tokens.c
986
+ - vendor/prism/src/xxh3.c
922
987
  - vendor/prism/templates/ext/prism/api_node.c.erb
923
988
  - vendor/prism/templates/include/prism/ast.h.erb
924
- - vendor/prism/templates/include/prism/diagnostic.h.erb
925
- - vendor/prism/templates/java/org/prism/AbstractNodeVisitor.java.erb
926
- - vendor/prism/templates/java/org/prism/Loader.java.erb
927
- - vendor/prism/templates/java/org/prism/Nodes.java.erb
989
+ - vendor/prism/templates/include/prism/ast.hpp.erb
990
+ - vendor/prism/templates/include/prism/internal/diagnostic.h.erb
991
+ - vendor/prism/templates/java/api/src/main/java-templates/org/ruby_lang/prism/AbstractNodeVisitor.java.erb
992
+ - vendor/prism/templates/java/api/src/main/java-templates/org/ruby_lang/prism/Loader.java.erb
993
+ - vendor/prism/templates/java/api/src/main/java-templates/org/ruby_lang/prism/Nodes.java.erb
928
994
  - vendor/prism/templates/javascript/src/deserialize.js.erb
929
995
  - vendor/prism/templates/javascript/src/nodes.js.erb
930
996
  - vendor/prism/templates/javascript/src/visitor.js.erb
@@ -938,20 +1004,12 @@ files:
938
1004
  - vendor/prism/templates/lib/prism/reflection.rb.erb
939
1005
  - vendor/prism/templates/lib/prism/serialize.rb.erb
940
1006
  - vendor/prism/templates/lib/prism/visitor.rb.erb
941
- - vendor/prism/templates/rbi/prism/dsl.rbi.erb
942
- - vendor/prism/templates/rbi/prism/node.rbi.erb
943
- - vendor/prism/templates/rbi/prism/visitor.rbi.erb
944
- - vendor/prism/templates/sig/prism.rbs.erb
945
- - vendor/prism/templates/sig/prism/_private/dot_visitor.rbs.erb
946
- - vendor/prism/templates/sig/prism/dsl.rbs.erb
947
- - vendor/prism/templates/sig/prism/mutation_compiler.rbs.erb
948
- - vendor/prism/templates/sig/prism/node.rbs.erb
949
- - vendor/prism/templates/sig/prism/visitor.rbs.erb
950
1007
  - vendor/prism/templates/src/diagnostic.c.erb
1008
+ - vendor/prism/templates/src/json.c.erb
951
1009
  - vendor/prism/templates/src/node.c.erb
952
1010
  - vendor/prism/templates/src/prettyprint.c.erb
953
1011
  - vendor/prism/templates/src/serialize.c.erb
954
- - vendor/prism/templates/src/token_type.c.erb
1012
+ - vendor/prism/templates/src/tokens.c.erb
955
1013
  - vendor/prism/templates/template.rb
956
1014
  homepage: https://herb-tools.dev
957
1015
  licenses:
@@ -1,260 +0,0 @@
1
- /**
2
- * @file defines.h
3
- *
4
- * Macro definitions used throughout the prism library.
5
- *
6
- * This file should be included first by any *.h or *.c in prism for consistency
7
- * and to ensure that the macros are defined before they are used.
8
- */
9
- #ifndef PRISM_DEFINES_H
10
- #define PRISM_DEFINES_H
11
-
12
- #include <ctype.h>
13
- #include <limits.h>
14
- #include <math.h>
15
- #include <stdarg.h>
16
- #include <stddef.h>
17
- #include <stdint.h>
18
- #include <stdio.h>
19
- #include <string.h>
20
-
21
- /**
22
- * We want to be able to use the PRI* macros for printing out integers, but on
23
- * some platforms they aren't included unless this is already defined.
24
- */
25
- #define __STDC_FORMAT_MACROS
26
- // Include sys/types.h before inttypes.h to work around issue with
27
- // certain versions of GCC and newlib which causes omission of PRIx64
28
- #include <sys/types.h>
29
- #include <inttypes.h>
30
-
31
- /**
32
- * When we are parsing using recursive descent, we want to protect against
33
- * malicious payloads that could attempt to crash our parser. We do this by
34
- * specifying a maximum depth to which we are allowed to recurse.
35
- */
36
- #ifndef PRISM_DEPTH_MAXIMUM
37
- #define PRISM_DEPTH_MAXIMUM 10000
38
- #endif
39
-
40
- /**
41
- * By default, we compile with -fvisibility=hidden. When this is enabled, we
42
- * need to mark certain functions as being publically-visible. This macro does
43
- * that in a compiler-agnostic way.
44
- */
45
- #ifndef PRISM_EXPORTED_FUNCTION
46
- # ifdef PRISM_EXPORT_SYMBOLS
47
- # ifdef _WIN32
48
- # define PRISM_EXPORTED_FUNCTION __declspec(dllexport) extern
49
- # else
50
- # define PRISM_EXPORTED_FUNCTION __attribute__((__visibility__("default"))) extern
51
- # endif
52
- # else
53
- # define PRISM_EXPORTED_FUNCTION
54
- # endif
55
- #endif
56
-
57
- /**
58
- * Certain compilers support specifying that a function accepts variadic
59
- * parameters that look like printf format strings to provide a better developer
60
- * experience when someone is using the function. This macro does that in a
61
- * compiler-agnostic way.
62
- */
63
- #if defined(__GNUC__)
64
- # if defined(__MINGW_PRINTF_FORMAT)
65
- # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(__MINGW_PRINTF_FORMAT, string_index, argument_index)))
66
- # else
67
- # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(printf, string_index, argument_index)))
68
- # endif
69
- #elif defined(__clang__)
70
- # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((__format__(__printf__, string_index, argument_index)))
71
- #else
72
- # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index)
73
- #endif
74
-
75
- /**
76
- * GCC will warn if you specify a function or parameter that is unused at
77
- * runtime. This macro allows you to mark a function or parameter as unused in a
78
- * compiler-agnostic way.
79
- */
80
- #if defined(__GNUC__)
81
- # define PRISM_ATTRIBUTE_UNUSED __attribute__((unused))
82
- #else
83
- # define PRISM_ATTRIBUTE_UNUSED
84
- #endif
85
-
86
- /**
87
- * Old Visual Studio versions do not support the inline keyword, so we need to
88
- * define it to be __inline.
89
- */
90
- #if defined(_MSC_VER) && !defined(inline)
91
- # define inline __inline
92
- #endif
93
-
94
- /**
95
- * Old Visual Studio versions before 2015 do not implement sprintf, but instead
96
- * implement _snprintf. We standard that here.
97
- */
98
- #if !defined(snprintf) && defined(_MSC_VER) && (_MSC_VER < 1900)
99
- # define snprintf _snprintf
100
- #endif
101
-
102
- /**
103
- * A simple utility macro to concatenate two tokens together, necessary when one
104
- * of the tokens is itself a macro.
105
- */
106
- #define PM_CONCATENATE(left, right) left ## right
107
-
108
- /**
109
- * We want to be able to use static assertions, but they weren't standardized
110
- * until C11. As such, we polyfill it here by making a hacky typedef that will
111
- * fail to compile due to a negative array size if the condition is false.
112
- */
113
- #if defined(_Static_assert)
114
- # define PM_STATIC_ASSERT(line, condition, message) _Static_assert(condition, message)
115
- #else
116
- # define PM_STATIC_ASSERT(line, condition, message) typedef char PM_CONCATENATE(static_assert_, line)[(condition) ? 1 : -1]
117
- #endif
118
-
119
- /**
120
- * In general, libc for embedded systems does not support memory-mapped files.
121
- * If the target platform is POSIX or Windows, we can map a file in memory and
122
- * read it in a more efficient manner.
123
- */
124
- #ifdef _WIN32
125
- # define PRISM_HAS_MMAP
126
- #else
127
- # include <unistd.h>
128
- # ifdef _POSIX_MAPPED_FILES
129
- # define PRISM_HAS_MMAP
130
- # endif
131
- #endif
132
-
133
- /**
134
- * If PRISM_HAS_NO_FILESYSTEM is defined, then we want to exclude all filesystem
135
- * related code from the library. All filesystem related code should be guarded
136
- * by PRISM_HAS_FILESYSTEM.
137
- */
138
- #ifndef PRISM_HAS_NO_FILESYSTEM
139
- # define PRISM_HAS_FILESYSTEM
140
- #endif
141
-
142
- /**
143
- * isinf on POSIX systems it accepts a float, a double, or a long double.
144
- * But mingw didn't provide an isinf macro, only an isinf function that only
145
- * accepts floats, so we need to use _finite instead.
146
- */
147
- #ifdef __MINGW64__
148
- #include <float.h>
149
- #define PRISM_ISINF(x) (!_finite(x))
150
- #else
151
- #define PRISM_ISINF(x) isinf(x)
152
- #endif
153
-
154
- /**
155
- * If you build prism with a custom allocator, configure it with
156
- * "-D PRISM_XALLOCATOR" to use your own allocator that defines xmalloc,
157
- * xrealloc, xcalloc, and xfree.
158
- *
159
- * For example, your `prism_xallocator.h` file could look like this:
160
- *
161
- * ```
162
- * #ifndef PRISM_XALLOCATOR_H
163
- * #define PRISM_XALLOCATOR_H
164
- * #define xmalloc my_malloc
165
- * #define xrealloc my_realloc
166
- * #define xcalloc my_calloc
167
- * #define xfree my_free
168
- * #endif
169
- * ```
170
- */
171
- #ifdef PRISM_XALLOCATOR
172
- #include "prism_xallocator.h"
173
- #else
174
- #ifndef xmalloc
175
- /**
176
- * The malloc function that should be used. This can be overridden with
177
- * the PRISM_XALLOCATOR define.
178
- */
179
- #define xmalloc malloc
180
- #endif
181
-
182
- #ifndef xrealloc
183
- /**
184
- * The realloc function that should be used. This can be overridden with
185
- * the PRISM_XALLOCATOR define.
186
- */
187
- #define xrealloc realloc
188
- #endif
189
-
190
- #ifndef xcalloc
191
- /**
192
- * The calloc function that should be used. This can be overridden with
193
- * the PRISM_XALLOCATOR define.
194
- */
195
- #define xcalloc calloc
196
- #endif
197
-
198
- #ifndef xfree
199
- /**
200
- * The free function that should be used. This can be overridden with the
201
- * PRISM_XALLOCATOR define.
202
- */
203
- #define xfree free
204
- #endif
205
- #endif
206
-
207
- /**
208
- * If PRISM_BUILD_MINIMAL is defined, then we're going to define every possible
209
- * switch that will turn off certain features of prism.
210
- */
211
- #ifdef PRISM_BUILD_MINIMAL
212
- /** Exclude the serialization API. */
213
- #define PRISM_EXCLUDE_SERIALIZATION
214
-
215
- /** Exclude the JSON serialization API. */
216
- #define PRISM_EXCLUDE_JSON
217
-
218
- /** Exclude the Array#pack parser API. */
219
- #define PRISM_EXCLUDE_PACK
220
-
221
- /** Exclude the prettyprint API. */
222
- #define PRISM_EXCLUDE_PRETTYPRINT
223
-
224
- /** Exclude the full set of encodings, using the minimal only. */
225
- #define PRISM_ENCODING_EXCLUDE_FULL
226
- #endif
227
-
228
- /**
229
- * Support PRISM_LIKELY and PRISM_UNLIKELY to help the compiler optimize its
230
- * branch predication.
231
- */
232
- #if defined(__GNUC__) || defined(__clang__)
233
- /** The compiler should predicate that this branch will be taken. */
234
- #define PRISM_LIKELY(x) __builtin_expect(!!(x), 1)
235
-
236
- /** The compiler should predicate that this branch will not be taken. */
237
- #define PRISM_UNLIKELY(x) __builtin_expect(!!(x), 0)
238
- #else
239
- /** Void because this platform does not support branch prediction hints. */
240
- #define PRISM_LIKELY(x) (x)
241
-
242
- /** Void because this platform does not support branch prediction hints. */
243
- #define PRISM_UNLIKELY(x) (x)
244
- #endif
245
-
246
- /**
247
- * We use -Wimplicit-fallthrough to guard potentially unintended fall-through between cases of a switch.
248
- * Use PRISM_FALLTHROUGH to explicitly annotate cases where the fallthrough is intentional.
249
- */
250
- #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L // C23 or later
251
- #define PRISM_FALLTHROUGH [[fallthrough]];
252
- #elif defined(__GNUC__) || defined(__clang__)
253
- #define PRISM_FALLTHROUGH __attribute__((fallthrough));
254
- #elif defined(_MSC_VER)
255
- #define PRISM_FALLTHROUGH __fallthrough;
256
- #else
257
- #define PRISM_FALLTHROUGH
258
- #endif
259
-
260
- #endif
@@ -1,163 +0,0 @@
1
- /**
2
- * @file pack.h
3
- *
4
- * A pack template string parser.
5
- */
6
- #ifndef PRISM_PACK_H
7
- #define PRISM_PACK_H
8
-
9
- #include "prism/defines.h"
10
-
11
- // We optionally support parsing String#pack templates. For systems that don't
12
- // want or need this functionality, it can be turned off with the
13
- // PRISM_EXCLUDE_PACK define.
14
- #ifdef PRISM_EXCLUDE_PACK
15
-
16
- void pm_pack_parse(void);
17
-
18
- #else
19
-
20
- #include <stdint.h>
21
- #include <stdlib.h>
22
-
23
- /** The version of the pack template language that we are parsing. */
24
- typedef enum pm_pack_version {
25
- PM_PACK_VERSION_3_2_0
26
- } pm_pack_version;
27
-
28
- /** The type of pack template we are parsing. */
29
- typedef enum pm_pack_variant {
30
- PM_PACK_VARIANT_PACK,
31
- PM_PACK_VARIANT_UNPACK
32
- } pm_pack_variant;
33
-
34
- /** A directive within the pack template. */
35
- typedef enum pm_pack_type {
36
- PM_PACK_SPACE,
37
- PM_PACK_COMMENT,
38
- PM_PACK_INTEGER,
39
- PM_PACK_UTF8,
40
- PM_PACK_BER,
41
- PM_PACK_FLOAT,
42
- PM_PACK_STRING_SPACE_PADDED,
43
- PM_PACK_STRING_NULL_PADDED,
44
- PM_PACK_STRING_NULL_TERMINATED,
45
- PM_PACK_STRING_MSB,
46
- PM_PACK_STRING_LSB,
47
- PM_PACK_STRING_HEX_HIGH,
48
- PM_PACK_STRING_HEX_LOW,
49
- PM_PACK_STRING_UU,
50
- PM_PACK_STRING_MIME,
51
- PM_PACK_STRING_BASE64,
52
- PM_PACK_STRING_FIXED,
53
- PM_PACK_STRING_POINTER,
54
- PM_PACK_MOVE,
55
- PM_PACK_BACK,
56
- PM_PACK_NULL,
57
- PM_PACK_END
58
- } pm_pack_type;
59
-
60
- /** The signness of a pack directive. */
61
- typedef enum pm_pack_signed {
62
- PM_PACK_UNSIGNED,
63
- PM_PACK_SIGNED,
64
- PM_PACK_SIGNED_NA
65
- } pm_pack_signed;
66
-
67
- /** The endianness of a pack directive. */
68
- typedef enum pm_pack_endian {
69
- PM_PACK_AGNOSTIC_ENDIAN,
70
- PM_PACK_LITTLE_ENDIAN, // aka 'VAX', or 'V'
71
- PM_PACK_BIG_ENDIAN, // aka 'network', or 'N'
72
- PM_PACK_NATIVE_ENDIAN,
73
- PM_PACK_ENDIAN_NA
74
- } pm_pack_endian;
75
-
76
- /** The size of an integer pack directive. */
77
- typedef enum pm_pack_size {
78
- PM_PACK_SIZE_SHORT,
79
- PM_PACK_SIZE_INT,
80
- PM_PACK_SIZE_LONG,
81
- PM_PACK_SIZE_LONG_LONG,
82
- PM_PACK_SIZE_8,
83
- PM_PACK_SIZE_16,
84
- PM_PACK_SIZE_32,
85
- PM_PACK_SIZE_64,
86
- PM_PACK_SIZE_P,
87
- PM_PACK_SIZE_NA
88
- } pm_pack_size;
89
-
90
- /** The type of length of a pack directive. */
91
- typedef enum pm_pack_length_type {
92
- PM_PACK_LENGTH_FIXED,
93
- PM_PACK_LENGTH_MAX,
94
- PM_PACK_LENGTH_RELATIVE, // special case for unpack @*
95
- PM_PACK_LENGTH_NA
96
- } pm_pack_length_type;
97
-
98
- /** The type of encoding for a pack template string. */
99
- typedef enum pm_pack_encoding {
100
- PM_PACK_ENCODING_START,
101
- PM_PACK_ENCODING_ASCII_8BIT,
102
- PM_PACK_ENCODING_US_ASCII,
103
- PM_PACK_ENCODING_UTF_8
104
- } pm_pack_encoding;
105
-
106
- /** The result of parsing a pack template. */
107
- typedef enum pm_pack_result {
108
- PM_PACK_OK,
109
- PM_PACK_ERROR_UNSUPPORTED_DIRECTIVE,
110
- PM_PACK_ERROR_UNKNOWN_DIRECTIVE,
111
- PM_PACK_ERROR_LENGTH_TOO_BIG,
112
- PM_PACK_ERROR_BANG_NOT_ALLOWED,
113
- PM_PACK_ERROR_DOUBLE_ENDIAN
114
- } pm_pack_result;
115
-
116
- /**
117
- * Parse a single directive from a pack or unpack format string.
118
- *
119
- * @param variant (in) pack or unpack
120
- * @param format (in, out) the start of the next directive to parse on calling,
121
- * and advanced beyond the parsed directive on return, or as much of it as
122
- * was consumed until an error was encountered
123
- * @param format_end (in) the end of the format string
124
- * @param type (out) the type of the directive
125
- * @param signed_type (out) whether the value is signed
126
- * @param endian (out) the endianness of the value
127
- * @param size (out) the size of the value
128
- * @param length_type (out) what kind of length is specified
129
- * @param length (out) the length of the directive
130
- * @param encoding (in, out) takes the current encoding of the string which
131
- * would result from parsing the whole format string, and returns a possibly
132
- * changed directive - the encoding should be `PM_PACK_ENCODING_START` when
133
- * pm_pack_parse is called for the first directive in a format string
134
- *
135
- * @return `PM_PACK_OK` on success or `PM_PACK_ERROR_*` on error
136
- * @note Consult Ruby documentation for the meaning of directives.
137
- */
138
- PRISM_EXPORTED_FUNCTION pm_pack_result
139
- pm_pack_parse(
140
- pm_pack_variant variant,
141
- const char **format,
142
- const char *format_end,
143
- pm_pack_type *type,
144
- pm_pack_signed *signed_type,
145
- pm_pack_endian *endian,
146
- pm_pack_size *size,
147
- pm_pack_length_type *length_type,
148
- uint64_t *length,
149
- pm_pack_encoding *encoding
150
- );
151
-
152
- /**
153
- * Prism abstracts sizes away from the native system - this converts an abstract
154
- * size to a native size.
155
- *
156
- * @param size The abstract size to convert.
157
- * @return The native size.
158
- */
159
- PRISM_EXPORTED_FUNCTION size_t pm_size_to_native(pm_pack_size size);
160
-
161
- #endif
162
-
163
- #endif
@@ -1,43 +0,0 @@
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 by pm_regexp_parse() 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 by pm_regexp_parse() 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