herb 0.10.4-x86-linux-gnu → 0.11.1-x86-linux-gnu

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 (793) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +16 -6
  3. data/README.md +36 -119
  4. data/Rakefile +2 -11
  5. data/config/action_view_helpers/actioncable/action_cable_helper/action_cable_meta_tag.yml +12 -8
  6. data/config/action_view_helpers/actionpack/content_security_policy/content_security_policy?.yml +9 -6
  7. data/config/action_view_helpers/actionpack/content_security_policy/content_security_policy_nonce.yml +9 -6
  8. data/config/action_view_helpers/actionpack/polymorphic_routes/polymorphic_path.yml +20 -12
  9. data/config/action_view_helpers/actionpack/polymorphic_routes/polymorphic_url.yml +30 -18
  10. data/config/action_view_helpers/actionpack/request_forgery_protection/form_authenticity_token.yml +15 -9
  11. data/config/action_view_helpers/actionpack/request_forgery_protection/protect_against_forgery?.yml +9 -6
  12. data/config/action_view_helpers/actiontext/content_helper/render_action_text_content.yml +15 -9
  13. data/config/action_view_helpers/actiontext/content_helper/sanitize_action_text_content.yml +15 -9
  14. data/config/action_view_helpers/actiontext/tag_helper/rich_textarea_tag.yml +34 -22
  15. data/config/action_view_helpers/actionview/active_model_helper/error_message.yml +9 -6
  16. data/config/action_view_helpers/actionview/active_model_helper/error_wrapping.yml +9 -6
  17. data/config/action_view_helpers/actionview/active_model_helper/object.yml +9 -6
  18. data/config/action_view_helpers/actionview/asset_tag_helper/apply_stylesheet_media_default.yml +9 -6
  19. data/config/action_view_helpers/actionview/asset_tag_helper/audio_tag.yml +40 -27
  20. data/config/action_view_helpers/actionview/asset_tag_helper/auto_discovery_link_tag.yml +37 -23
  21. data/config/action_view_helpers/actionview/asset_tag_helper/auto_include_nonce.yml +9 -6
  22. data/config/action_view_helpers/actionview/asset_tag_helper/auto_include_nonce_for_scripts.yml +9 -6
  23. data/config/action_view_helpers/actionview/asset_tag_helper/auto_include_nonce_for_styles.yml +9 -6
  24. data/config/action_view_helpers/actionview/asset_tag_helper/favicon_link_tag.yml +32 -22
  25. data/config/action_view_helpers/actionview/asset_tag_helper/image_decoding.yml +9 -6
  26. data/config/action_view_helpers/actionview/asset_tag_helper/image_loading.yml +9 -6
  27. data/config/action_view_helpers/actionview/asset_tag_helper/image_tag.yml +67 -46
  28. data/config/action_view_helpers/actionview/asset_tag_helper/javascript_include_tag.yml +58 -39
  29. data/config/action_view_helpers/actionview/asset_tag_helper/picture_tag.yml +22 -14
  30. data/config/action_view_helpers/actionview/asset_tag_helper/preload_link_tag.yml +45 -30
  31. data/config/action_view_helpers/actionview/asset_tag_helper/preload_links_header.yml +9 -6
  32. data/config/action_view_helpers/actionview/asset_tag_helper/stylesheet_link_tag.yml +49 -30
  33. data/config/action_view_helpers/actionview/asset_tag_helper/video_tag.yml +53 -35
  34. data/config/action_view_helpers/actionview/asset_url_helper/asset_path.yml +16 -10
  35. data/config/action_view_helpers/actionview/asset_url_helper/asset_url.yml +16 -10
  36. data/config/action_view_helpers/actionview/asset_url_helper/audio_path.yml +16 -10
  37. data/config/action_view_helpers/actionview/asset_url_helper/audio_url.yml +16 -10
  38. data/config/action_view_helpers/actionview/asset_url_helper/compute_asset_extname.yml +9 -6
  39. data/config/action_view_helpers/actionview/asset_url_helper/compute_asset_host.yml +9 -6
  40. data/config/action_view_helpers/actionview/asset_url_helper/compute_asset_path.yml +9 -6
  41. data/config/action_view_helpers/actionview/asset_url_helper/font_path.yml +16 -10
  42. data/config/action_view_helpers/actionview/asset_url_helper/font_url.yml +16 -10
  43. data/config/action_view_helpers/actionview/asset_url_helper/image_path.yml +16 -10
  44. data/config/action_view_helpers/actionview/asset_url_helper/image_url.yml +16 -10
  45. data/config/action_view_helpers/actionview/asset_url_helper/javascript_path.yml +16 -10
  46. data/config/action_view_helpers/actionview/asset_url_helper/javascript_url.yml +16 -10
  47. data/config/action_view_helpers/actionview/asset_url_helper/public_compute_asset_path.yml +9 -6
  48. data/config/action_view_helpers/actionview/asset_url_helper/stylesheet_path.yml +16 -10
  49. data/config/action_view_helpers/actionview/asset_url_helper/stylesheet_url.yml +16 -10
  50. data/config/action_view_helpers/actionview/asset_url_helper/video_path.yml +16 -10
  51. data/config/action_view_helpers/actionview/asset_url_helper/video_url.yml +16 -10
  52. data/config/action_view_helpers/actionview/atom_feed_helper/atom_feed.yml +52 -27
  53. data/config/action_view_helpers/actionview/cache_helper/cache.yml +25 -15
  54. data/config/action_view_helpers/actionview/cache_helper/cache_fragment_name.yml +9 -6
  55. data/config/action_view_helpers/actionview/cache_helper/cache_if.yml +20 -12
  56. data/config/action_view_helpers/actionview/cache_helper/cache_unless.yml +20 -12
  57. data/config/action_view_helpers/actionview/cache_helper/caching_predicate.yml +9 -6
  58. data/config/action_view_helpers/actionview/cache_helper/digest_path_from_template.yml +9 -6
  59. data/config/action_view_helpers/actionview/cache_helper/fragment_for.yml +9 -6
  60. data/config/action_view_helpers/actionview/cache_helper/fragment_name_with_digest.yml +9 -6
  61. data/config/action_view_helpers/actionview/cache_helper/read_fragment_for.yml +9 -6
  62. data/config/action_view_helpers/actionview/cache_helper/uncacheable.yml +9 -6
  63. data/config/action_view_helpers/actionview/cache_helper/write_fragment_for.yml +9 -6
  64. data/config/action_view_helpers/actionview/capture_helper/capture.yml +9 -6
  65. data/config/action_view_helpers/actionview/capture_helper/content_for.yml +20 -12
  66. data/config/action_view_helpers/actionview/capture_helper/content_for_predicate.yml +15 -9
  67. data/config/action_view_helpers/actionview/capture_helper/provide.yml +15 -9
  68. data/config/action_view_helpers/actionview/capture_helper/with_output_buffer.yml +9 -6
  69. data/config/action_view_helpers/actionview/content_exfiltration_prevention_helper/prepend_content_exfiltration_prevention.yml +9 -6
  70. data/config/action_view_helpers/actionview/content_exfiltration_prevention_helper/prevent_content_exfiltration.yml +9 -6
  71. data/config/action_view_helpers/actionview/controller_helper/action_name.yml +9 -6
  72. data/config/action_view_helpers/actionview/controller_helper/assign_controller.yml +9 -6
  73. data/config/action_view_helpers/actionview/controller_helper/controller.yml +9 -6
  74. data/config/action_view_helpers/actionview/controller_helper/controller_name.yml +9 -6
  75. data/config/action_view_helpers/actionview/controller_helper/controller_path.yml +9 -6
  76. data/config/action_view_helpers/actionview/controller_helper/cookies.yml +9 -6
  77. data/config/action_view_helpers/actionview/controller_helper/flash.yml +9 -6
  78. data/config/action_view_helpers/actionview/controller_helper/headers.yml +9 -6
  79. data/config/action_view_helpers/actionview/controller_helper/logger.yml +9 -6
  80. data/config/action_view_helpers/actionview/controller_helper/params.yml +9 -6
  81. data/config/action_view_helpers/actionview/controller_helper/request.yml +9 -6
  82. data/config/action_view_helpers/actionview/controller_helper/request_forgery_protection_token.yml +9 -6
  83. data/config/action_view_helpers/actionview/controller_helper/response.yml +9 -6
  84. data/config/action_view_helpers/actionview/controller_helper/session.yml +9 -6
  85. data/config/action_view_helpers/actionview/csp_helper/csp_meta_tag.yml +18 -11
  86. data/config/action_view_helpers/actionview/csrf_helper/csrf_meta_tags.yml +16 -10
  87. data/config/action_view_helpers/actionview/date_helper/date_select.yml +85 -51
  88. data/config/action_view_helpers/actionview/date_helper/datetime_select.yml +65 -39
  89. data/config/action_view_helpers/actionview/date_helper/distance_of_time_in_words.yml +30 -18
  90. data/config/action_view_helpers/actionview/date_helper/relative_time_in_words.yml +35 -21
  91. data/config/action_view_helpers/actionview/date_helper/select_date.yml +50 -30
  92. data/config/action_view_helpers/actionview/date_helper/select_datetime.yml +65 -39
  93. data/config/action_view_helpers/actionview/date_helper/select_day.yml +40 -24
  94. data/config/action_view_helpers/actionview/date_helper/select_hour.yml +50 -30
  95. data/config/action_view_helpers/actionview/date_helper/select_minute.yml +40 -24
  96. data/config/action_view_helpers/actionview/date_helper/select_month.yml +60 -36
  97. data/config/action_view_helpers/actionview/date_helper/select_second.yml +35 -21
  98. data/config/action_view_helpers/actionview/date_helper/select_time.yml +55 -33
  99. data/config/action_view_helpers/actionview/date_helper/select_year.yml +45 -27
  100. data/config/action_view_helpers/actionview/date_helper/time_ago_in_words.yml +21 -13
  101. data/config/action_view_helpers/actionview/date_helper/time_select.yml +60 -36
  102. data/config/action_view_helpers/actionview/date_helper/time_tag.yml +32 -20
  103. data/config/action_view_helpers/actionview/debug_helper/debug.yml +15 -9
  104. data/config/action_view_helpers/actionview/form_builder/button.yml +60 -0
  105. data/config/action_view_helpers/actionview/form_builder/submit.yml +48 -0
  106. data/config/action_view_helpers/actionview/form_helper/apply_form_for_options.yml +9 -6
  107. data/config/action_view_helpers/actionview/form_helper/checkbox.yml +41 -25
  108. data/config/action_view_helpers/actionview/form_helper/color_field.yml +25 -15
  109. data/config/action_view_helpers/actionview/form_helper/date_field.yml +35 -21
  110. data/config/action_view_helpers/actionview/form_helper/datetime_field.yml +41 -25
  111. data/config/action_view_helpers/actionview/form_helper/email_field.yml +25 -15
  112. data/config/action_view_helpers/actionview/form_helper/emitted_hidden_id.yml +9 -6
  113. data/config/action_view_helpers/actionview/form_helper/fields.yml +37 -18
  114. data/config/action_view_helpers/actionview/form_helper/fields_for.yml +33 -15
  115. data/config/action_view_helpers/actionview/form_helper/file_field.yml +45 -27
  116. data/config/action_view_helpers/actionview/form_helper/form_for.yml +45 -24
  117. data/config/action_view_helpers/actionview/form_helper/form_with.yml +56 -30
  118. data/config/action_view_helpers/actionview/form_helper/form_with_generates_ids.yml +9 -6
  119. data/config/action_view_helpers/actionview/form_helper/form_with_generates_remote_forms.yml +9 -6
  120. data/config/action_view_helpers/actionview/form_helper/hidden_field.yml +25 -15
  121. data/config/action_view_helpers/actionview/form_helper/label.yml +52 -27
  122. data/config/action_view_helpers/actionview/form_helper/month_field.yml +25 -15
  123. data/config/action_view_helpers/actionview/form_helper/multipart.yml +9 -6
  124. data/config/action_view_helpers/actionview/form_helper/multiple_file_field_include_hidden.yml +9 -6
  125. data/config/action_view_helpers/actionview/form_helper/number_field.yml +45 -27
  126. data/config/action_view_helpers/actionview/form_helper/password_field.yml +25 -15
  127. data/config/action_view_helpers/actionview/form_helper/radio_button.yml +30 -18
  128. data/config/action_view_helpers/actionview/form_helper/range_field.yml +45 -27
  129. data/config/action_view_helpers/actionview/form_helper/search_field.yml +25 -15
  130. data/config/action_view_helpers/actionview/form_helper/telephone_field.yml +26 -16
  131. data/config/action_view_helpers/actionview/form_helper/text_field.yml +25 -15
  132. data/config/action_view_helpers/actionview/form_helper/textarea.yml +31 -19
  133. data/config/action_view_helpers/actionview/form_helper/time_field.yml +40 -24
  134. data/config/action_view_helpers/actionview/form_helper/url_field.yml +25 -15
  135. data/config/action_view_helpers/actionview/form_helper/week_field.yml +25 -15
  136. data/config/action_view_helpers/actionview/form_options_helper/collection_checkboxes.yml +58 -31
  137. data/config/action_view_helpers/actionview/form_options_helper/collection_radio_buttons.yml +57 -30
  138. data/config/action_view_helpers/actionview/form_options_helper/collection_select.yml +65 -39
  139. data/config/action_view_helpers/actionview/form_options_helper/grouped_collection_select.yml +65 -39
  140. data/config/action_view_helpers/actionview/form_options_helper/grouped_options_for_select.yml +35 -21
  141. data/config/action_view_helpers/actionview/form_options_helper/option_groups_from_collection_for_select.yml +40 -24
  142. data/config/action_view_helpers/actionview/form_options_helper/options_for_select.yml +20 -12
  143. data/config/action_view_helpers/actionview/form_options_helper/options_from_collection_for_select.yml +30 -18
  144. data/config/action_view_helpers/actionview/form_options_helper/select.yml +60 -36
  145. data/config/action_view_helpers/actionview/form_options_helper/time_zone_options_for_select.yml +25 -15
  146. data/config/action_view_helpers/actionview/form_options_helper/time_zone_select.yml +50 -30
  147. data/config/action_view_helpers/actionview/form_options_helper/weekday_options_for_select.yml +30 -18
  148. data/config/action_view_helpers/actionview/form_options_helper/weekday_select.yml +30 -18
  149. data/config/action_view_helpers/actionview/form_tag_helper/button_tag.yml +39 -21
  150. data/config/action_view_helpers/actionview/form_tag_helper/checkbox_tag.yml +33 -21
  151. data/config/action_view_helpers/actionview/form_tag_helper/color_field_tag.yml +26 -17
  152. data/config/action_view_helpers/actionview/form_tag_helper/date_field_tag.yml +27 -17
  153. data/config/action_view_helpers/actionview/form_tag_helper/datetime_field_tag.yml +28 -18
  154. data/config/action_view_helpers/actionview/form_tag_helper/default_enforce_utf8.yml +9 -6
  155. data/config/action_view_helpers/actionview/form_tag_helper/email_field_tag.yml +27 -17
  156. data/config/action_view_helpers/actionview/form_tag_helper/embed_authenticity_token_in_remote_forms.yml +9 -6
  157. data/config/action_view_helpers/actionview/form_tag_helper/field_id.yml +30 -18
  158. data/config/action_view_helpers/actionview/form_tag_helper/field_name.yml +30 -18
  159. data/config/action_view_helpers/actionview/form_tag_helper/field_set_tag.yml +23 -15
  160. data/config/action_view_helpers/actionview/form_tag_helper/file_field_tag.yml +35 -22
  161. data/config/action_view_helpers/actionview/form_tag_helper/form_tag.yml +38 -24
  162. data/config/action_view_helpers/actionview/form_tag_helper/hidden_field_tag.yml +27 -17
  163. data/config/action_view_helpers/actionview/form_tag_helper/image_submit_tag.yml +31 -21
  164. data/config/action_view_helpers/actionview/form_tag_helper/label_tag.yml +33 -17
  165. data/config/action_view_helpers/actionview/form_tag_helper/month_field_tag.yml +27 -17
  166. data/config/action_view_helpers/actionview/form_tag_helper/number_field_tag.yml +47 -29
  167. data/config/action_view_helpers/actionview/form_tag_helper/password_field_tag.yml +27 -17
  168. data/config/action_view_helpers/actionview/form_tag_helper/radio_button_tag.yml +32 -20
  169. data/config/action_view_helpers/actionview/form_tag_helper/range_field_tag.yml +47 -29
  170. data/config/action_view_helpers/actionview/form_tag_helper/search_field_tag.yml +27 -17
  171. data/config/action_view_helpers/actionview/form_tag_helper/select_tag.yml +47 -29
  172. data/config/action_view_helpers/actionview/form_tag_helper/submit_tag.yml +33 -21
  173. data/config/action_view_helpers/actionview/form_tag_helper/telephone_field_tag.yml +28 -18
  174. data/config/action_view_helpers/actionview/form_tag_helper/text_field_tag.yml +27 -17
  175. data/config/action_view_helpers/actionview/form_tag_helper/textarea_tag.yml +31 -20
  176. data/config/action_view_helpers/actionview/form_tag_helper/time_field_tag.yml +27 -17
  177. data/config/action_view_helpers/actionview/form_tag_helper/url_field_tag.yml +27 -17
  178. data/config/action_view_helpers/actionview/form_tag_helper/utf8_enforcer_tag.yml +9 -6
  179. data/config/action_view_helpers/actionview/form_tag_helper/week_field_tag.yml +28 -18
  180. data/config/action_view_helpers/actionview/javascript_helper/escape_javascript.yml +16 -10
  181. data/config/action_view_helpers/actionview/javascript_helper/javascript_cdata_section.yml +9 -6
  182. data/config/action_view_helpers/actionview/javascript_helper/javascript_tag.yml +41 -27
  183. data/config/action_view_helpers/actionview/number_helper/number_to_currency.yml +29 -18
  184. data/config/action_view_helpers/actionview/number_helper/number_to_human.yml +25 -15
  185. data/config/action_view_helpers/actionview/number_helper/number_to_human_size.yml +20 -12
  186. data/config/action_view_helpers/actionview/number_helper/number_to_percentage.yml +20 -12
  187. data/config/action_view_helpers/actionview/number_helper/number_to_phone.yml +33 -20
  188. data/config/action_view_helpers/actionview/number_helper/number_with_delimiter.yml +21 -13
  189. data/config/action_view_helpers/actionview/number_helper/number_with_precision.yml +25 -15
  190. data/config/action_view_helpers/actionview/output_safety_helper/raw.yml +15 -9
  191. data/config/action_view_helpers/actionview/output_safety_helper/safe_join.yml +20 -12
  192. data/config/action_view_helpers/actionview/output_safety_helper/to_sentence.yml +24 -15
  193. data/config/action_view_helpers/actionview/record_identifier/dom_class.yml +20 -12
  194. data/config/action_view_helpers/actionview/record_identifier/dom_id.yml +20 -12
  195. data/config/action_view_helpers/actionview/record_identifier/dom_target.yml +15 -9
  196. data/config/action_view_helpers/actionview/record_identifier/model_name_from_record_or_class.yml +9 -6
  197. data/config/action_view_helpers/actionview/rendering_helper/render.yml +108 -22
  198. data/config/action_view_helpers/actionview/sanitize_helper/sanitize.yml +25 -15
  199. data/config/action_view_helpers/actionview/sanitize_helper/sanitize_css.yml +15 -9
  200. data/config/action_view_helpers/actionview/sanitize_helper/sanitizer_vendor.yml +9 -6
  201. data/config/action_view_helpers/actionview/sanitize_helper/strip_links.yml +15 -9
  202. data/config/action_view_helpers/actionview/sanitize_helper/strip_tags.yml +15 -9
  203. data/config/action_view_helpers/actionview/tag_helper/cdata_section.yml +15 -9
  204. data/config/action_view_helpers/actionview/tag_helper/content_tag.yml +59 -38
  205. data/config/action_view_helpers/actionview/tag_helper/escape_once.yml +15 -9
  206. data/config/action_view_helpers/actionview/tag_helper/tag.yml +54 -31
  207. data/config/action_view_helpers/actionview/tag_helper/token_list.yml +16 -10
  208. data/config/action_view_helpers/actionview/text_helper/concat.yml +15 -9
  209. data/config/action_view_helpers/actionview/text_helper/current_cycle.yml +15 -9
  210. data/config/action_view_helpers/actionview/text_helper/cycle.yml +23 -14
  211. data/config/action_view_helpers/actionview/text_helper/excerpt.yml +33 -20
  212. data/config/action_view_helpers/actionview/text_helper/highlight.yml +37 -18
  213. data/config/action_view_helpers/actionview/text_helper/pluralize.yml +30 -18
  214. data/config/action_view_helpers/actionview/text_helper/reset_cycle.yml +15 -9
  215. data/config/action_view_helpers/actionview/text_helper/safe_concat.yml +9 -6
  216. data/config/action_view_helpers/actionview/text_helper/simple_format.yml +33 -20
  217. data/config/action_view_helpers/actionview/text_helper/truncate.yml +38 -23
  218. data/config/action_view_helpers/actionview/text_helper/word_wrap.yml +25 -15
  219. data/config/action_view_helpers/actionview/translation_helper/debug_missing_translation.yml +9 -6
  220. data/config/action_view_helpers/actionview/translation_helper/localize.yml +26 -16
  221. data/config/action_view_helpers/actionview/translation_helper/translate.yml +31 -19
  222. data/config/action_view_helpers/actionview/url_helper/button_to.yml +57 -33
  223. data/config/action_view_helpers/actionview/url_helper/button_to_generates_button_tag.yml +9 -6
  224. data/config/action_view_helpers/actionview/url_helper/current_page?.yml +25 -15
  225. data/config/action_view_helpers/actionview/url_helper/link_to.yml +76 -53
  226. data/config/action_view_helpers/actionview/url_helper/link_to_if.yml +54 -20
  227. data/config/action_view_helpers/actionview/url_helper/link_to_unless.yml +54 -20
  228. data/config/action_view_helpers/actionview/url_helper/link_to_unless_current.yml +49 -17
  229. data/config/action_view_helpers/actionview/url_helper/mail_to.yml +60 -34
  230. data/config/action_view_helpers/actionview/url_helper/phone_to.yml +40 -22
  231. data/config/action_view_helpers/actionview/url_helper/sms_to.yml +45 -25
  232. data/config/action_view_helpers/actionview/url_helper/url_for.yml +15 -9
  233. data/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_import_module_tag.yml +32 -0
  234. data/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_module_preload_tags.yml +39 -0
  235. data/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_tags.yml +35 -0
  236. data/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_inline_importmap_tag.yml +32 -0
  237. data/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_module_preload_tag.yml +35 -0
  238. data/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_cache.yml +9 -6
  239. data/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_cache_tag.yml +12 -8
  240. data/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_preview.yml +9 -6
  241. data/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_preview_tag.yml +12 -8
  242. data/config/action_view_helpers/turbo-rails/drive_helper/turbo_page_requires_reload.yml +9 -6
  243. data/config/action_view_helpers/turbo-rails/drive_helper/turbo_page_requires_reload_tag.yml +12 -8
  244. data/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_method_tag.yml +17 -11
  245. data/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_scroll_tag.yml +17 -11
  246. data/config/action_view_helpers/turbo-rails/drive_helper/turbo_refreshes_with.yml +20 -12
  247. data/config/action_view_helpers/turbo-rails/frames_helper/turbo_frame_tag.yml +54 -33
  248. data/config/action_view_helpers/turbo-rails/includes_helper/turbo_include_tags.yml +9 -6
  249. data/config/action_view_helpers/turbo-rails/streams_action_helper/turbo_stream_action_tag.yml +32 -20
  250. data/config/action_view_helpers/turbo-rails/streams_action_helper/turbo_stream_refresh_tag.yml +18 -11
  251. data/config/action_view_helpers/turbo-rails/streams_helper/turbo_stream.yml +9 -6
  252. data/config/action_view_helpers/turbo-rails/streams_helper/turbo_stream_from.yml +28 -18
  253. data/config/html_elements.yml +597 -0
  254. data/config/options.yml +1 -0
  255. data/config/slots/components.yml +52 -0
  256. data/config/state/kind.yml +61 -0
  257. data/config/state/operators.yml +27 -0
  258. data/config/state/predicates.yml +39 -0
  259. data/config/state/transforms.yml +18 -0
  260. data/config/view_context_methods/actionview/base/annotate_rendered_view_with_filenames.yml +4 -4
  261. data/config/view_context_methods/actionview/base/assign.yml +4 -4
  262. data/config/view_context_methods/actionview/base/assigns.yml +4 -4
  263. data/config/view_context_methods/actionview/base/automatically_disable_submit_tag.yml +4 -4
  264. data/config/view_context_methods/actionview/base/compiled_method_container.yml +4 -4
  265. data/config/view_context_methods/actionview/base/config.yml +4 -4
  266. data/config/view_context_methods/actionview/base/default_form_builder.yml +4 -4
  267. data/config/view_context_methods/actionview/base/default_formats.yml +4 -4
  268. data/config/view_context_methods/actionview/base/field_error_proc.yml +4 -4
  269. data/config/view_context_methods/actionview/base/formats.yml +4 -4
  270. data/config/view_context_methods/actionview/base/in_rendering_context.yml +4 -4
  271. data/config/view_context_methods/actionview/base/locale.yml +4 -4
  272. data/config/view_context_methods/actionview/base/lookup_context.yml +4 -4
  273. data/config/view_context_methods/actionview/base/output_buffer.yml +4 -4
  274. data/config/view_context_methods/actionview/base/prefix_partial_path_with_controller_namespace.yml +4 -4
  275. data/config/view_context_methods/actionview/base/remove_hidden_field_autocomplete.yml +4 -4
  276. data/config/view_context_methods/actionview/base/streaming_completion_on_exception.yml +4 -4
  277. data/config/view_context_methods/actionview/base/view_flow.yml +4 -4
  278. data/config/view_context_methods/actionview/base/view_paths.yml +4 -4
  279. data/config/view_context_methods/actionview/base/view_renderer.yml +4 -4
  280. data/config/view_context_methods/actionview/template/local_assigns.yml +4 -4
  281. data/config/view_context_methods/activemodel/conversion/convert_to_model.yml +4 -4
  282. data/config/view_context_methods/activesupport/benchmarkable/benchmark.yml +4 -4
  283. data/config.yml +1243 -790
  284. data/exe/herb +2 -0
  285. data/ext/herb/error_helpers.c +355 -17
  286. data/ext/herb/error_helpers.h +1 -1
  287. data/ext/herb/extconf.rb +4 -2
  288. data/ext/herb/extension.c +137 -89
  289. data/ext/herb/extension_helpers.c +81 -42
  290. data/ext/herb/extension_helpers.h +4 -1
  291. data/ext/herb/nodes.c +859 -374
  292. data/ext/herb/nodes.h +3 -2
  293. data/ext/herb/parser_options_helpers.c +151 -0
  294. data/ext/herb/parser_options_helpers.h +14 -0
  295. data/herb.gemspec +2 -2
  296. data/lib/herb/3.2/herb.so +0 -0
  297. data/lib/herb/3.3/herb.so +0 -0
  298. data/lib/herb/3.4/herb.so +0 -0
  299. data/lib/herb/4.0/herb.so +0 -0
  300. data/lib/herb/action_view/helper_registry.rb +1358 -62
  301. data/lib/herb/analysis/partial_declaration.rb +140 -0
  302. data/lib/herb/analysis/partial_index.rb +189 -0
  303. data/lib/herb/analysis/partial_resolution.rb +161 -0
  304. data/lib/herb/analysis/partial_resolver.rb +144 -0
  305. data/lib/herb/analysis/project_index.rb +152 -0
  306. data/lib/herb/{action_view → analysis}/render_analyzer.rb +287 -77
  307. data/lib/herb/analysis/render_graph/ancestor_chain.rb +27 -0
  308. data/lib/herb/analysis/render_graph/builder.rb +376 -0
  309. data/lib/herb/analysis/render_graph/call_frame.rb +9 -0
  310. data/lib/herb/analysis/render_graph/call_site_location.rb +23 -0
  311. data/lib/herb/analysis/render_graph/inferred_signature.rb +21 -0
  312. data/lib/herb/analysis/render_graph/partial_call_site.rb +40 -0
  313. data/lib/herb/analysis/render_graph/partial_context.rb +46 -0
  314. data/lib/herb/analysis/render_graph/template_roots.rb +31 -0
  315. data/lib/herb/analysis/render_graph.rb +285 -0
  316. data/lib/herb/analysis/ruby_locals_index/local.rb +25 -0
  317. data/lib/herb/analysis/ruby_locals_index/named_reference.rb +22 -0
  318. data/lib/herb/analysis/ruby_locals_index/offset_table.rb +44 -0
  319. data/lib/herb/analysis/ruby_locals_index/reference_collector.rb +80 -0
  320. data/lib/herb/analysis/ruby_locals_index/state_locals.rb +49 -0
  321. data/lib/herb/analysis/ruby_locals_index.rb +165 -0
  322. data/lib/herb/analysis/ruby_reference.rb +67 -0
  323. data/lib/herb/analysis/template_dependencies/dependency_collector.rb +179 -0
  324. data/lib/herb/analysis/template_dependencies/node_dependency_collector.rb +309 -0
  325. data/lib/herb/analysis/template_dependencies.rb +562 -0
  326. data/lib/herb/ast/erb_render_node.rb +26 -94
  327. data/lib/herb/ast/helpers.rb +90 -10
  328. data/lib/herb/ast/herb_directive_node.rb +18 -0
  329. data/lib/herb/ast/node.rb +32 -2
  330. data/lib/herb/ast/nodes.rb +1368 -105
  331. data/lib/herb/backend.rb +73 -0
  332. data/lib/herb/bootstrap.rb +8 -8
  333. data/lib/herb/cli.rb +550 -32
  334. data/lib/herb/colors.rb +14 -0
  335. data/lib/herb/configuration.rb +71 -35
  336. data/lib/herb/defaults.yml +2 -1
  337. data/lib/herb/dev/assets.rb +57 -0
  338. data/lib/herb/dev/classifier.rb +84 -0
  339. data/lib/herb/dev/embedded.rb +27 -0
  340. data/lib/herb/dev/pipeline.rb +305 -0
  341. data/lib/herb/dev/protocol.rb +221 -0
  342. data/lib/herb/dev/runner.rb +180 -175
  343. data/lib/herb/dev/server.rb +89 -26
  344. data/lib/herb/dev/server_entry.rb +41 -6
  345. data/lib/herb/dev/watcher.rb +181 -0
  346. data/lib/herb/dev.rb +163 -0
  347. data/lib/herb/diagnostic/formatter.rb +88 -0
  348. data/lib/herb/diagnostic.rb +172 -0
  349. data/lib/herb/diff/operation.rb +36 -0
  350. data/lib/herb/diff/result.rb +62 -0
  351. data/lib/herb/diff.rb +10 -0
  352. data/lib/herb/engine/collector.rb +62 -0
  353. data/lib/herb/engine/compiler.rb +387 -113
  354. data/lib/herb/engine/component_tags/constant_resolver.rb +28 -0
  355. data/lib/herb/engine/component_tags/partial_resolver.rb +54 -0
  356. data/lib/herb/engine/component_tags/resolver.rb +32 -0
  357. data/lib/herb/engine/component_tags/visitor.rb +231 -0
  358. data/lib/herb/engine/css_inliner/inliner.rb +101 -0
  359. data/lib/herb/engine/css_inliner/visitor.rb +174 -0
  360. data/lib/herb/engine/errors.rb +122 -0
  361. data/lib/herb/engine/helpers.rb +82 -0
  362. data/lib/herb/engine/inline_render/inliner.rb +122 -0
  363. data/lib/herb/engine/inline_render/visitor.rb +267 -0
  364. data/lib/herb/engine/runtime/entry.rb +62 -0
  365. data/lib/herb/engine/runtime/error_page.rb +362 -0
  366. data/lib/herb/engine/runtime/html_safe_assertions.rb +217 -0
  367. data/lib/herb/engine/runtime/journal/summary.rb +227 -0
  368. data/lib/herb/engine/runtime/journal.rb +379 -0
  369. data/lib/herb/engine/runtime/middleware.rb +212 -0
  370. data/lib/herb/engine/runtime/observations.rb +73 -0
  371. data/lib/herb/engine/runtime/report.rb +204 -0
  372. data/lib/herb/engine/runtime/session.rb +437 -0
  373. data/lib/herb/engine/runtime.rb +21 -0
  374. data/lib/herb/engine/scoped_style/channel.rb +66 -0
  375. data/lib/herb/engine/scoped_style/collector.rb +74 -0
  376. data/lib/herb/engine/scoped_style/visitor.rb +533 -0
  377. data/lib/herb/engine/slots/annotation.rb +98 -0
  378. data/lib/herb/engine/slots/bindings.rb +61 -0
  379. data/lib/herb/engine/slots/callee.rb +118 -0
  380. data/lib/herb/engine/slots/component_definitions.rb +67 -0
  381. data/lib/herb/engine/slots/components/async.rb +24 -0
  382. data/lib/herb/engine/slots/components/base.rb +132 -0
  383. data/lib/herb/engine/slots/components/deferred.rb +81 -0
  384. data/lib/herb/engine/slots/components/fallback.rb +27 -0
  385. data/lib/herb/engine/slots/components/fragment.rb +99 -0
  386. data/lib/herb/engine/slots/components/lazy.rb +24 -0
  387. data/lib/herb/engine/slots/components.rb +52 -0
  388. data/lib/herb/engine/slots/dependencies/channel.rb +72 -0
  389. data/lib/herb/engine/slots/dependencies.rb +269 -0
  390. data/lib/herb/engine/slots/dynamics_compiler.rb +864 -0
  391. data/lib/herb/engine/slots/identifier.rb +35 -0
  392. data/lib/herb/engine/slots/manifest/channel.rb +74 -0
  393. data/lib/herb/engine/slots/manifest/collector.rb +75 -0
  394. data/lib/herb/engine/slots/markers.rb +152 -0
  395. data/lib/herb/engine/slots/render_bindings.rb +141 -0
  396. data/lib/herb/engine/slots/schema_compiler.rb +94 -0
  397. data/lib/herb/engine/slots/state_anchor.rb +94 -0
  398. data/lib/herb/engine/slots/state_compiler.rb +1325 -0
  399. data/lib/herb/engine/slots/state_directives.rb +854 -0
  400. data/lib/herb/engine/slots/state_kinds.rb +54 -0
  401. data/lib/herb/engine/slots/state_operators.rb +36 -0
  402. data/lib/herb/engine/slots/state_overrides.rb +79 -0
  403. data/lib/herb/engine/slots/state_predicates.rb +65 -0
  404. data/lib/herb/engine/slots/state_transforms.rb +42 -0
  405. data/lib/herb/engine/slots/statics.rb +185 -0
  406. data/lib/herb/engine/slots/subtree.rb +82 -0
  407. data/lib/herb/engine/slots/subtree_compiler.rb +255 -0
  408. data/lib/herb/engine/slots/types.rb +42 -0
  409. data/lib/herb/engine/slots/visitor.rb +2267 -0
  410. data/lib/herb/engine/validators/accessibility_validator.rb +3 -3
  411. data/lib/herb/engine/validators/base.rb +36 -0
  412. data/lib/herb/engine/validators/generator_template_validator.rb +39 -0
  413. data/lib/herb/engine/validators/nesting_validator.rb +3 -3
  414. data/lib/herb/engine/validators/render_validator.rb +13 -33
  415. data/lib/herb/engine/validators/security_validator.rb +3 -17
  416. data/lib/herb/engine/validators.rb +43 -0
  417. data/lib/herb/engine/visitors/auto_close_omitted_tags_visitor.rb +48 -0
  418. data/lib/herb/engine/visitors/content_for_visitor.rb +127 -0
  419. data/lib/herb/engine/{debug_visitor.rb → visitors/debug_visitor.rb} +121 -93
  420. data/lib/herb/engine/visitors/html_safe_assertions_visitor.rb +281 -0
  421. data/lib/herb/engine/visitors/instrumentation_visitor.rb +290 -0
  422. data/lib/herb/engine/visitors/optimize_visitor.rb +728 -0
  423. data/lib/herb/engine/visitors/remove_comments_visitor.rb +106 -0
  424. data/lib/herb/engine/visitors/source_attribution_visitor.rb +177 -0
  425. data/lib/herb/engine.rb +218 -259
  426. data/lib/herb/ensure_installed.rb +43 -0
  427. data/lib/herb/errors.rb +646 -157
  428. data/lib/herb/fingerprint.rb +82 -0
  429. data/lib/herb/html/elements.rb +18 -0
  430. data/lib/herb/html/util.rb +21 -2
  431. data/lib/herb/lex_result.rb +0 -10
  432. data/lib/herb/locate.rb +163 -0
  433. data/lib/herb/location.rb +20 -0
  434. data/lib/herb/parse_result.rb +17 -11
  435. data/lib/herb/parser_options.rb +65 -46
  436. data/lib/herb/position.rb +19 -0
  437. data/lib/herb/prism_inspect.rb +1 -4
  438. data/lib/herb/project.rb +28 -15
  439. data/lib/herb/range.rb +5 -0
  440. data/lib/herb/result.rb +2 -2
  441. data/lib/herb/ruby_program.rb +110 -0
  442. data/lib/herb/source_path.rb +232 -0
  443. data/lib/herb/token.rb +14 -3
  444. data/lib/herb/version.rb +1 -1
  445. data/lib/herb/visitor/context/origin.rb +52 -0
  446. data/lib/herb/visitor/context/replacements.rb +59 -0
  447. data/lib/herb/visitor/context.rb +169 -0
  448. data/lib/herb/visitor/context_aware.rb +45 -0
  449. data/lib/herb/visitor/diagnostics.rb +148 -0
  450. data/lib/herb/visitor/experimental.rb +33 -0
  451. data/lib/herb/visitor/parser_option_requirements.rb +151 -0
  452. data/lib/herb/visitor/stack.rb +192 -0
  453. data/lib/herb/visitor.rb +47 -1
  454. data/lib/herb/warnings.rb +25 -0
  455. data/lib/herb.rb +74 -63
  456. data/sig/herb/action_view/helper_registry.rbs +82 -10
  457. data/sig/herb/analysis/partial_declaration.rbs +80 -0
  458. data/sig/herb/analysis/partial_index.rbs +66 -0
  459. data/sig/herb/analysis/partial_resolution.rbs +57 -0
  460. data/sig/herb/analysis/partial_resolver.rbs +76 -0
  461. data/sig/herb/analysis/project_index.rbs +57 -0
  462. data/sig/herb/{action_view → analysis}/render_analyzer.rbs +25 -4
  463. data/sig/herb/analysis/render_graph/ancestor_chain.rbs +22 -0
  464. data/sig/herb/analysis/render_graph/builder.rbs +180 -0
  465. data/sig/herb/analysis/render_graph/call_frame.rbs +26 -0
  466. data/sig/herb/analysis/render_graph/call_site_location.rbs +28 -0
  467. data/sig/herb/analysis/render_graph/inferred_signature.rbs +27 -0
  468. data/sig/herb/analysis/render_graph/partial_call_site.rbs +36 -0
  469. data/sig/herb/analysis/render_graph/partial_context.rbs +31 -0
  470. data/sig/herb/analysis/render_graph/template_roots.rbs +32 -0
  471. data/sig/herb/analysis/render_graph.rbs +83 -0
  472. data/sig/herb/analysis/ruby_locals_index/local.rbs +21 -0
  473. data/sig/herb/analysis/ruby_locals_index/named_reference.rbs +20 -0
  474. data/sig/herb/analysis/ruby_locals_index/offset_table.rbs +26 -0
  475. data/sig/herb/analysis/ruby_locals_index/reference_collector.rbs +40 -0
  476. data/sig/herb/analysis/ruby_locals_index/state_locals.rbs +19 -0
  477. data/sig/herb/analysis/ruby_locals_index.rbs +62 -0
  478. data/sig/herb/analysis/ruby_reference.rbs +28 -0
  479. data/sig/herb/analysis/template_dependencies/dependency_collector.rbs +52 -0
  480. data/sig/herb/analysis/template_dependencies/node_dependency_collector.rbs +81 -0
  481. data/sig/herb/analysis/template_dependencies.rbs +125 -0
  482. data/sig/herb/ast/erb_render_node.rbs +10 -2
  483. data/sig/herb/ast/helpers.rbs +31 -1
  484. data/sig/herb/ast/herb_directive_node.rbs +13 -0
  485. data/sig/herb/ast/node.rbs +9 -0
  486. data/sig/herb/ast/nodes.rbs +668 -89
  487. data/sig/herb/backend.rbs +52 -0
  488. data/sig/herb/bootstrap.rbs +2 -0
  489. data/sig/herb/colors.rbs +3 -0
  490. data/sig/herb/configuration.rbs +27 -3
  491. data/sig/herb/dev/assets.rbs +27 -0
  492. data/sig/herb/dev/classifier.rbs +57 -0
  493. data/sig/herb/dev/embedded.rbs +21 -0
  494. data/sig/herb/dev/pipeline.rbs +118 -0
  495. data/sig/herb/dev/protocol.rbs +78 -0
  496. data/sig/herb/dev/runner.rbs +64 -23
  497. data/sig/herb/dev/server.rbs +49 -22
  498. data/sig/herb/dev/server_entry.rbs +46 -21
  499. data/sig/herb/dev/watcher.rbs +84 -0
  500. data/sig/herb/dev.rbs +58 -0
  501. data/sig/herb/diagnostic/formatter.rbs +28 -0
  502. data/sig/herb/diagnostic.rbs +88 -0
  503. data/sig/herb/diff/operation.rbs +36 -0
  504. data/sig/herb/diff/result.rbs +36 -0
  505. data/sig/herb/diff.rbs +6 -0
  506. data/sig/herb/engine/collector.rbs +48 -0
  507. data/sig/herb/engine/compiler.rbs +74 -24
  508. data/sig/herb/engine/component_tags/constant_resolver.rbs +19 -0
  509. data/sig/herb/engine/component_tags/partial_resolver.rbs +30 -0
  510. data/sig/herb/engine/component_tags/resolver.rbs +25 -0
  511. data/sig/herb/engine/component_tags/visitor.rbs +69 -0
  512. data/sig/herb/engine/css_inliner/inliner.rbs +65 -0
  513. data/sig/herb/engine/css_inliner/visitor.rbs +87 -0
  514. data/sig/herb/engine/errors.rbs +68 -0
  515. data/sig/herb/engine/helpers.rbs +28 -0
  516. data/sig/herb/engine/inline_render/inliner.rbs +39 -0
  517. data/sig/herb/engine/inline_render/visitor.rbs +104 -0
  518. data/sig/herb/engine/runtime/entry.rbs +43 -0
  519. data/sig/herb/engine/runtime/error_page.rbs +115 -0
  520. data/sig/herb/engine/runtime/html_safe_assertions.rbs +99 -0
  521. data/sig/herb/engine/runtime/journal/summary.rbs +172 -0
  522. data/sig/herb/engine/runtime/journal.rbs +126 -0
  523. data/sig/herb/engine/runtime/middleware.rbs +96 -0
  524. data/sig/herb/engine/runtime/observations.rbs +38 -0
  525. data/sig/herb/engine/runtime/report.rbs +97 -0
  526. data/sig/herb/engine/runtime/session.rbs +233 -0
  527. data/sig/herb/engine/runtime.rbs +14 -0
  528. data/sig/herb/engine/scoped_style/channel.rbs +45 -0
  529. data/sig/herb/engine/scoped_style/collector.rbs +45 -0
  530. data/sig/herb/engine/scoped_style/visitor.rbs +220 -0
  531. data/sig/herb/engine/slots/annotation.rbs +72 -0
  532. data/sig/herb/engine/slots/bindings.rbs +34 -0
  533. data/sig/herb/engine/slots/callee.rbs +62 -0
  534. data/sig/herb/engine/slots/component_definitions.rbs +19 -0
  535. data/sig/herb/engine/slots/components/async.rbs +20 -0
  536. data/sig/herb/engine/slots/components/base.rbs +60 -0
  537. data/sig/herb/engine/slots/components/deferred.rbs +29 -0
  538. data/sig/herb/engine/slots/components/fallback.rbs +21 -0
  539. data/sig/herb/engine/slots/components/fragment.rbs +34 -0
  540. data/sig/herb/engine/slots/components/lazy.rbs +20 -0
  541. data/sig/herb/engine/slots/components.rbs +30 -0
  542. data/sig/herb/engine/slots/dependencies/channel.rbs +51 -0
  543. data/sig/herb/engine/slots/dependencies.rbs +94 -0
  544. data/sig/herb/engine/slots/dynamics_compiler.rbs +352 -0
  545. data/sig/herb/engine/slots/identifier.rbs +19 -0
  546. data/sig/herb/engine/slots/manifest/channel.rbs +49 -0
  547. data/sig/herb/engine/slots/manifest/collector.rbs +45 -0
  548. data/sig/herb/engine/slots/markers.rbs +99 -0
  549. data/sig/herb/engine/slots/render_bindings.rbs +69 -0
  550. data/sig/herb/engine/slots/schema_compiler.rbs +62 -0
  551. data/sig/herb/engine/slots/state_anchor.rbs +41 -0
  552. data/sig/herb/engine/slots/state_compiler.rbs +258 -0
  553. data/sig/herb/engine/slots/state_directives.rbs +278 -0
  554. data/sig/herb/engine/slots/state_kinds.rbs +24 -0
  555. data/sig/herb/engine/slots/state_operators.rbs +19 -0
  556. data/sig/herb/engine/slots/state_overrides.rbs +33 -0
  557. data/sig/herb/engine/slots/state_predicates.rbs +16 -0
  558. data/sig/herb/engine/slots/state_transforms.rbs +15 -0
  559. data/sig/herb/engine/slots/statics.rbs +67 -0
  560. data/sig/herb/engine/slots/subtree.rbs +49 -0
  561. data/sig/herb/engine/slots/subtree_compiler.rbs +130 -0
  562. data/sig/herb/engine/slots/types.rbs +46 -0
  563. data/sig/herb/engine/slots/visitor.rbs +603 -0
  564. data/sig/herb/engine/validators/accessibility_validator.rbs +1 -1
  565. data/sig/herb/engine/validators/base.rbs +28 -0
  566. data/sig/herb/engine/validators/generator_template_validator.rbs +19 -0
  567. data/sig/herb/engine/validators/nesting_validator.rbs +1 -1
  568. data/sig/herb/engine/validators/render_validator.rbs +2 -6
  569. data/sig/herb/engine/validators/security_validator.rbs +1 -3
  570. data/sig/herb/engine/validators.rbs +21 -0
  571. data/sig/herb/engine/visitors/auto_close_omitted_tags_visitor.rbs +26 -0
  572. data/sig/herb/engine/visitors/content_for_visitor.rbs +52 -0
  573. data/sig/herb/engine/{debug_visitor.rbs → visitors/debug_visitor.rbs} +26 -15
  574. data/sig/herb/engine/visitors/html_safe_assertions_visitor.rbs +100 -0
  575. data/sig/herb/engine/visitors/instrumentation_visitor.rbs +111 -0
  576. data/sig/herb/engine/visitors/optimize_visitor.rbs +246 -0
  577. data/sig/herb/engine/visitors/remove_comments_visitor.rbs +66 -0
  578. data/sig/herb/engine/visitors/source_attribution_visitor.rbs +90 -0
  579. data/sig/herb/engine.rbs +47 -41
  580. data/sig/herb/ensure_installed.rbs +9 -0
  581. data/sig/herb/errors.rbs +293 -0
  582. data/sig/herb/fingerprint.rbs +37 -0
  583. data/sig/herb/html/elements.rbs +19 -0
  584. data/sig/herb/html/util.rbs +15 -1
  585. data/sig/herb/lex_result.rbs +0 -6
  586. data/sig/herb/locate.rbs +89 -0
  587. data/sig/herb/location.rbs +12 -0
  588. data/sig/herb/parse_result.rbs +10 -8
  589. data/sig/herb/parser_options.rbs +47 -21
  590. data/sig/herb/position.rbs +11 -0
  591. data/sig/herb/range.rbs +3 -0
  592. data/sig/herb/ruby_program.rbs +51 -0
  593. data/sig/herb/source_path.rbs +132 -0
  594. data/sig/herb/token.rbs +5 -2
  595. data/sig/herb/visitor/context/origin.rbs +51 -0
  596. data/sig/herb/visitor/context/replacements.rbs +39 -0
  597. data/sig/herb/visitor/context.rbs +83 -0
  598. data/sig/herb/visitor/context_aware.rbs +32 -0
  599. data/sig/herb/visitor/diagnostics.rbs +82 -0
  600. data/sig/herb/visitor/experimental.rbs +23 -0
  601. data/sig/herb/visitor/parser_option_requirements.rbs +76 -0
  602. data/sig/herb/visitor/stack.rbs +91 -0
  603. data/sig/herb/visitor.rbs +22 -0
  604. data/sig/herb/warnings.rbs +10 -0
  605. data/sig/herb.rbs +27 -10
  606. data/sig/serialized_ast_errors.rbs +58 -1
  607. data/sig/serialized_ast_nodes.rbs +59 -2
  608. data/src/analyze/action_view/attribute_extraction_helpers.c +73 -36
  609. data/src/analyze/action_view/generated_handlers.c +37 -1
  610. data/src/analyze/action_view/generated_handlers.h +2 -1
  611. data/src/analyze/action_view/helper_registry.c +1353 -58
  612. data/src/analyze/action_view/registry.c +10 -17
  613. data/src/analyze/action_view/stylesheet_link_tag.c +40 -0
  614. data/src/analyze/action_view/tag_helper_node_builders.c +63 -3
  615. data/src/analyze/action_view/tag_helpers.c +497 -111
  616. data/src/analyze/analyze.c +306 -89
  617. data/src/analyze/analyze_helpers.c +502 -243
  618. data/src/analyze/analyzed_ruby.c +2 -0
  619. data/src/analyze/builders.c +80 -51
  620. data/src/analyze/conditional_elements.c +13 -8
  621. data/src/analyze/conditional_open_tags.c +11 -5
  622. data/src/analyze/control_type.c +30 -5
  623. data/src/analyze/herb_directives.c +701 -0
  624. data/src/analyze/invalid_structures.c +11 -7
  625. data/src/analyze/iteration_nodes.c +306 -0
  626. data/src/analyze/missing_end.c +116 -32
  627. data/src/analyze/parse_errors.c +8 -3
  628. data/src/analyze/postfix_conditionals.c +98 -63
  629. data/src/analyze/prism_annotate.c +45 -13
  630. data/src/analyze/render_nodes.c +345 -123
  631. data/src/analyze/strict_locals.c +30 -26
  632. data/src/analyze/ternary_conditionals.c +95 -70
  633. data/src/analyze/transform.c +43 -1
  634. data/src/ast/ast_node.c +3 -13
  635. data/src/ast/ast_nodes.c +914 -113
  636. data/src/ast/ast_pretty_print.c +166 -3
  637. data/src/diff/herb_diff.c +8 -0
  638. data/src/diff/herb_diff_attributes.c +1 -0
  639. data/src/diff/herb_diff_children.c +4 -3
  640. data/src/diff/herb_diff_helpers.c +7 -1
  641. data/src/diff/herb_diff_nodes.c +186 -71
  642. data/src/diff/herb_hash_tree.c +99 -1
  643. data/src/errors.c +1096 -128
  644. data/src/extract.c +227 -144
  645. data/src/herb.c +30 -11
  646. data/src/include/analyze/action_view/attribute_extraction_helpers.h +1 -1
  647. data/src/include/analyze/action_view/helper_registry.h +28 -4
  648. data/src/include/analyze/action_view/tag_helper_handler.h +1 -1
  649. data/src/include/analyze/action_view/tag_helper_node_builders.h +7 -0
  650. data/src/include/analyze/analyze.h +11 -22
  651. data/src/include/analyze/analyzed_ruby.h +25 -0
  652. data/src/include/analyze/builders.h +16 -0
  653. data/src/include/analyze/helpers.h +25 -24
  654. data/src/include/analyze/herb_directive_kinds.h +41 -0
  655. data/src/include/analyze/herb_directives.h +14 -0
  656. data/src/include/analyze/iteration_nodes.h +11 -0
  657. data/src/include/analyze/prism_annotate.h +3 -3
  658. data/src/include/analyze/ternary_conditionals.h +2 -0
  659. data/src/include/ast/ast_node.h +1 -5
  660. data/src/include/ast/ast_nodes.h +78 -3
  661. data/src/include/ast/ast_pretty_print.h +1 -1
  662. data/src/include/diff/herb_diff.h +11 -0
  663. data/src/include/errors.h +156 -39
  664. data/src/include/extract.h +11 -0
  665. data/src/include/herb.h +6 -0
  666. data/src/include/lexer/erb_openers.h +29 -0
  667. data/src/include/lexer/lexer.h +1 -0
  668. data/src/include/lexer/lexer_peek_helpers.h +8 -1
  669. data/src/include/lexer/lexer_struct.h +4 -0
  670. data/src/include/lexer/token.h +3 -0
  671. data/src/include/lexer/token_struct.h +8 -6
  672. data/src/include/lib/hb_allocator.h +2 -1
  673. data/src/include/lib/hb_array.h +2 -0
  674. data/src/include/lib/hb_foreach.h +1 -1
  675. data/src/include/lib/hb_string.h +7 -0
  676. data/src/include/parser/dot_notation.h +1 -1
  677. data/src/include/parser/foreign_content_elements.h +32 -0
  678. data/src/include/parser/parser.h +16 -30
  679. data/src/include/parser/parser_helpers.h +13 -11
  680. data/src/include/parser/parser_options.h +41 -0
  681. data/src/include/prism/herb_prism_node.h +6 -1
  682. data/src/include/prism/ruby_parser.h +6 -0
  683. data/src/include/util/html_elements.h +85 -0
  684. data/src/include/util/html_util.h +1 -0
  685. data/src/include/version.h +1 -1
  686. data/src/lexer/lexer_peek_helpers.c +15 -1
  687. data/src/lexer/token.c +83 -1
  688. data/src/lexer.c +228 -12
  689. data/src/lib/hb_allocator.c +2 -0
  690. data/src/lib/hb_array.c +26 -0
  691. data/src/lib/hb_string.c +26 -0
  692. data/src/main.c +1 -1
  693. data/src/parser/dot_notation.c +4 -3
  694. data/src/parser/match_tags.c +66 -1
  695. data/src/parser/parser_helpers.c +69 -37
  696. data/src/parser.c +606 -383
  697. data/src/parser_options_defaults.c +30 -0
  698. data/src/prism/prism_helpers.c +94 -0
  699. data/src/prism/ruby_parser.c +49 -0
  700. data/src/util/html_util.c +11 -58
  701. data/src/visitor.c +77 -1
  702. data/templates/ext/herb/error_helpers.c.erb +1 -1
  703. data/templates/ext/herb/nodes.c.erb +19 -14
  704. data/templates/ext/herb/nodes.h.erb +2 -1
  705. data/templates/ext/herb/parser_options_helpers.c.erb +69 -0
  706. data/templates/ext/herb/parser_options_helpers.h.erb +11 -0
  707. data/templates/java/nodes.c.erb +21 -17
  708. data/templates/java/nodes.h.erb +3 -2
  709. data/templates/java/org/herb/ParserOptions.java.erb +24 -0
  710. data/templates/java/org/herb/ast/HelperRegistry.java.erb +67 -31
  711. data/templates/java/org/herb/ast/HelperType.java.erb +29 -0
  712. data/templates/java/org/herb/ast/Nodes.java.erb +11 -7
  713. data/templates/java/parser_options_helpers.c.erb +45 -0
  714. data/templates/java/parser_options_helpers.h.erb +10 -0
  715. data/templates/javascript/packages/client/src/state-kinds.ts.erb +49 -0
  716. data/templates/javascript/packages/client/src/state-operators.ts.erb +15 -0
  717. data/templates/javascript/packages/client/src/state-predicates.ts.erb +27 -0
  718. data/templates/javascript/packages/client/src/state-transforms.ts.erb +19 -0
  719. data/templates/javascript/packages/core/src/action-view-helpers.ts.erb +47 -0
  720. data/templates/javascript/packages/core/src/built-in-components.ts.erb +67 -0
  721. data/templates/javascript/packages/core/src/errors.ts.erb +9 -3
  722. data/templates/javascript/packages/core/src/foreign-content-elements.ts.erb +18 -0
  723. data/templates/javascript/packages/core/src/html-constants.ts.erb +32 -0
  724. data/templates/javascript/packages/core/src/html-elements.ts.erb +41 -0
  725. data/templates/javascript/packages/core/src/node-type-guards.ts.erb +11 -7
  726. data/templates/javascript/packages/core/src/nodes.ts.erb +103 -20
  727. data/templates/javascript/packages/core/src/parser-options.ts.erb +41 -0
  728. data/templates/javascript/packages/core/src/visitor.ts.erb +1 -1
  729. data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +3 -3
  730. data/templates/javascript/packages/node/extension/nodes.cpp.erb +18 -13
  731. data/templates/javascript/packages/node/extension/nodes.h.erb +3 -3
  732. data/templates/javascript/packages/node/extension/parser_options_helpers.cpp.erb +41 -0
  733. data/templates/javascript/packages/node/extension/parser_options_helpers.h.erb +12 -0
  734. data/templates/lib/herb/action_view/helper_registry.rb.erb +77 -3
  735. data/templates/lib/herb/ast/nodes.rb.erb +16 -6
  736. data/templates/lib/herb/engine/slots/component_definitions.rb.erb +38 -0
  737. data/templates/lib/herb/engine/slots/state_kinds.rb.erb +37 -0
  738. data/templates/lib/herb/engine/slots/state_operators.rb.erb +26 -0
  739. data/templates/lib/herb/engine/slots/state_predicates.rb.erb +39 -0
  740. data/templates/lib/herb/engine/slots/state_transforms.rb.erb +27 -0
  741. data/templates/lib/herb/errors.rb.erb +34 -6
  742. data/templates/lib/herb/html/elements.rb.erb +12 -0
  743. data/templates/lib/herb/parser_options.rb.erb +32 -0
  744. data/templates/lib/herb/visitor.rb.erb +7 -1
  745. data/templates/rust/herb-printer/src/printer_visitor.rs.erb +14 -0
  746. data/templates/rust/src/action_view_helpers.rs.erb +38 -0
  747. data/templates/rust/src/ast/nodes.rs.erb +21 -31
  748. data/templates/rust/src/errors.rs.erb +1 -1
  749. data/templates/rust/src/nodes.rs.erb +58 -26
  750. data/templates/rust/src/parser_options.rs.erb +16 -0
  751. data/templates/rust/src/prism/generated_deserialize.rs.erb +109 -0
  752. data/templates/rust/src/prism/generated_prettyprint.rs.erb +153 -0
  753. data/templates/rust/src/union_types.rs.erb +7 -1
  754. data/templates/rust/src/visitor.rs.erb +1 -1
  755. data/templates/src/analyze/action_view/helper_registry.c.erb +22 -0
  756. data/templates/src/analyze/missing_end.c.erb +13 -5
  757. data/templates/src/ast/ast_nodes.c.erb +41 -2
  758. data/templates/src/diff/herb_diff_nodes.c.erb +44 -8
  759. data/templates/src/errors.c.erb +8 -3
  760. data/templates/src/include/analyze/action_view/helper_registry.h.erb +19 -0
  761. data/templates/src/include/analyze/herb_directive_kinds.h.erb +25 -0
  762. data/templates/src/include/errors.h.erb +3 -1
  763. data/templates/src/include/parser/foreign_content_elements.h.erb +23 -0
  764. data/templates/src/include/parser/parser_options.h.erb +21 -0
  765. data/templates/src/include/util/html_elements.h.erb +28 -0
  766. data/templates/src/parser_options_defaults.c.erb +9 -0
  767. data/templates/template.rb +564 -9
  768. data/templates/wasm/error_helpers.cpp.erb +4 -4
  769. data/templates/wasm/nodes.cpp.erb +17 -27
  770. data/templates/wasm/nodes.h.erb +3 -3
  771. data/templates/wasm/parser_options_helpers.cpp.erb +25 -0
  772. data/templates/wasm/parser_options_helpers.h.erb +12 -0
  773. metadata +306 -27
  774. data/config/action_view_helpers/actionview/form_helper/button.yml +0 -38
  775. data/config/action_view_helpers/actionview/form_helper/submit.yml +0 -35
  776. data/lib/herb/ast.rb +0 -7
  777. data/lib/herb/diff_operation.rb +0 -34
  778. data/lib/herb/diff_result.rb +0 -59
  779. data/lib/herb/engine/error_formatter.rb +0 -432
  780. data/lib/herb/engine/parser_error_overlay.rb +0 -773
  781. data/lib/herb/engine/validation_error_overlay.rb +0 -182
  782. data/lib/herb/engine/validation_errors.rb +0 -65
  783. data/lib/herb/engine/validator.rb +0 -80
  784. data/sig/herb/ast.rbs +0 -6
  785. data/sig/herb/diff_operation.rbs +0 -34
  786. data/sig/herb/diff_result.rbs +0 -34
  787. data/sig/herb/engine/debug.rbs +0 -38
  788. data/sig/herb/engine/error_formatter.rbs +0 -47
  789. data/sig/herb/engine/parser_error_overlay.rbs +0 -41
  790. data/sig/herb/engine/validation_error_overlay.rbs +0 -35
  791. data/sig/herb/engine/validation_errors.rbs +0 -45
  792. data/sig/herb/engine/validator.rbs +0 -41
  793. data/sig/herb_c_extension.rbs +0 -10
data/src/ast/ast_nodes.c CHANGED
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /home/runner/work/herb/herb/templates/src/ast/ast_nodes.c.erb
2
+ // be modified manually. See templates/src/ast/ast_nodes.c.erb
3
3
 
4
4
  #include <stdio.h>
5
5
  #include <stdbool.h>
@@ -50,9 +50,9 @@ AST_HTML_OPEN_TAG_NODE_T* ast_html_open_tag_node_init(token_T* tag_opening, toke
50
50
 
51
51
  ast_node_init(&html_open_tag_node->base, AST_HTML_OPEN_TAG_NODE, start_position, end_position, errors, allocator);
52
52
 
53
- html_open_tag_node->tag_opening = token_copy(tag_opening, allocator);
54
- html_open_tag_node->tag_name = token_copy(tag_name, allocator);
55
- html_open_tag_node->tag_closing = token_copy(tag_closing, allocator);
53
+ html_open_tag_node->tag_opening = tag_opening;
54
+ html_open_tag_node->tag_name = tag_name;
55
+ html_open_tag_node->tag_closing = tag_closing;
56
56
  html_open_tag_node->children = children;
57
57
  html_open_tag_node->is_void = is_void;
58
58
 
@@ -67,7 +67,7 @@ AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* ast_html_conditional_open_tag_node_init(AS
67
67
  ast_node_init(&html_conditional_open_tag_node->base, AST_HTML_CONDITIONAL_OPEN_TAG_NODE, start_position, end_position, errors, allocator);
68
68
 
69
69
  html_conditional_open_tag_node->conditional = conditional;
70
- html_conditional_open_tag_node->tag_name = token_copy(tag_name, allocator);
70
+ html_conditional_open_tag_node->tag_name = tag_name;
71
71
  html_conditional_open_tag_node->is_void = is_void;
72
72
 
73
73
  return html_conditional_open_tag_node;
@@ -80,10 +80,10 @@ AST_HTML_CLOSE_TAG_NODE_T* ast_html_close_tag_node_init(token_T* tag_opening, to
80
80
 
81
81
  ast_node_init(&html_close_tag_node->base, AST_HTML_CLOSE_TAG_NODE, start_position, end_position, errors, allocator);
82
82
 
83
- html_close_tag_node->tag_opening = token_copy(tag_opening, allocator);
84
- html_close_tag_node->tag_name = token_copy(tag_name, allocator);
83
+ html_close_tag_node->tag_opening = tag_opening;
84
+ html_close_tag_node->tag_name = tag_name;
85
85
  html_close_tag_node->children = children;
86
- html_close_tag_node->tag_closing = token_copy(tag_closing, allocator);
86
+ html_close_tag_node->tag_closing = tag_closing;
87
87
 
88
88
  return html_close_tag_node;
89
89
  }
@@ -95,7 +95,7 @@ AST_HTML_OMITTED_CLOSE_TAG_NODE_T* ast_html_omitted_close_tag_node_init(token_T*
95
95
 
96
96
  ast_node_init(&html_omitted_close_tag_node->base, AST_HTML_OMITTED_CLOSE_TAG_NODE, start_position, end_position, errors, allocator);
97
97
 
98
- html_omitted_close_tag_node->tag_name = token_copy(tag_name, allocator);
98
+ html_omitted_close_tag_node->tag_name = tag_name;
99
99
 
100
100
  return html_omitted_close_tag_node;
101
101
  }
@@ -107,7 +107,7 @@ AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T* ast_html_virtual_close_tag_node_init(token_T*
107
107
 
108
108
  ast_node_init(&html_virtual_close_tag_node->base, AST_HTML_VIRTUAL_CLOSE_TAG_NODE, start_position, end_position, errors, allocator);
109
109
 
110
- html_virtual_close_tag_node->tag_name = token_copy(tag_name, allocator);
110
+ html_virtual_close_tag_node->tag_name = tag_name;
111
111
 
112
112
  return html_virtual_close_tag_node;
113
113
  }
@@ -120,7 +120,7 @@ AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(AST_NODE_T* open_tag, token_
120
120
  ast_node_init(&html_element_node->base, AST_HTML_ELEMENT_NODE, start_position, end_position, errors, allocator);
121
121
 
122
122
  html_element_node->open_tag = open_tag;
123
- html_element_node->tag_name = token_copy(tag_name, allocator);
123
+ html_element_node->tag_name = tag_name;
124
124
  html_element_node->body = body;
125
125
  html_element_node->close_tag = close_tag;
126
126
  html_element_node->is_void = is_void;
@@ -142,7 +142,7 @@ AST_HTML_CONDITIONAL_ELEMENT_NODE_T* ast_html_conditional_element_node_init(hb_s
142
142
  html_conditional_element_node->body = body;
143
143
  html_conditional_element_node->close_tag = close_tag;
144
144
  html_conditional_element_node->close_conditional = close_conditional;
145
- html_conditional_element_node->tag_name = token_copy(tag_name, allocator);
145
+ html_conditional_element_node->tag_name = tag_name;
146
146
  html_conditional_element_node->element_source = element_source;
147
147
 
148
148
  return html_conditional_element_node;
@@ -155,9 +155,9 @@ AST_HTML_ATTRIBUTE_VALUE_NODE_T* ast_html_attribute_value_node_init(token_T* ope
155
155
 
156
156
  ast_node_init(&html_attribute_value_node->base, AST_HTML_ATTRIBUTE_VALUE_NODE, start_position, end_position, errors, allocator);
157
157
 
158
- html_attribute_value_node->open_quote = token_copy(open_quote, allocator);
158
+ html_attribute_value_node->open_quote = open_quote;
159
159
  html_attribute_value_node->children = children;
160
- html_attribute_value_node->close_quote = token_copy(close_quote, allocator);
160
+ html_attribute_value_node->close_quote = close_quote;
161
161
  html_attribute_value_node->quoted = quoted;
162
162
 
163
163
  return html_attribute_value_node;
@@ -183,7 +183,7 @@ AST_HTML_ATTRIBUTE_NODE_T* ast_html_attribute_node_init(struct AST_HTML_ATTRIBUT
183
183
  ast_node_init(&html_attribute_node->base, AST_HTML_ATTRIBUTE_NODE, start_position, end_position, errors, allocator);
184
184
 
185
185
  html_attribute_node->name = name;
186
- html_attribute_node->equals = token_copy(equals, allocator);
186
+ html_attribute_node->equals = equals;
187
187
  html_attribute_node->value = value;
188
188
 
189
189
  return html_attribute_node;
@@ -221,10 +221,10 @@ AST_ERB_OPEN_TAG_NODE_T* ast_erb_open_tag_node_init(token_T* tag_opening, token_
221
221
 
222
222
  ast_node_init(&erb_open_tag_node->base, AST_ERB_OPEN_TAG_NODE, start_position, end_position, errors, allocator);
223
223
 
224
- erb_open_tag_node->tag_opening = token_copy(tag_opening, allocator);
225
- erb_open_tag_node->content = token_copy(content, allocator);
226
- erb_open_tag_node->tag_closing = token_copy(tag_closing, allocator);
227
- erb_open_tag_node->tag_name = token_copy(tag_name, allocator);
224
+ erb_open_tag_node->tag_opening = tag_opening;
225
+ erb_open_tag_node->content = content;
226
+ erb_open_tag_node->tag_closing = tag_closing;
227
+ erb_open_tag_node->tag_name = tag_name;
228
228
  erb_open_tag_node->children = children;
229
229
 
230
230
  return erb_open_tag_node;
@@ -249,9 +249,9 @@ AST_HTML_COMMENT_NODE_T* ast_html_comment_node_init(token_T* comment_start, hb_a
249
249
 
250
250
  ast_node_init(&html_comment_node->base, AST_HTML_COMMENT_NODE, start_position, end_position, errors, allocator);
251
251
 
252
- html_comment_node->comment_start = token_copy(comment_start, allocator);
252
+ html_comment_node->comment_start = comment_start;
253
253
  html_comment_node->children = children;
254
- html_comment_node->comment_end = token_copy(comment_end, allocator);
254
+ html_comment_node->comment_end = comment_end;
255
255
 
256
256
  return html_comment_node;
257
257
  }
@@ -263,9 +263,9 @@ AST_HTML_DOCTYPE_NODE_T* ast_html_doctype_node_init(token_T* tag_opening, hb_arr
263
263
 
264
264
  ast_node_init(&html_doctype_node->base, AST_HTML_DOCTYPE_NODE, start_position, end_position, errors, allocator);
265
265
 
266
- html_doctype_node->tag_opening = token_copy(tag_opening, allocator);
266
+ html_doctype_node->tag_opening = tag_opening;
267
267
  html_doctype_node->children = children;
268
- html_doctype_node->tag_closing = token_copy(tag_closing, allocator);
268
+ html_doctype_node->tag_closing = tag_closing;
269
269
 
270
270
  return html_doctype_node;
271
271
  }
@@ -277,13 +277,28 @@ AST_XML_DECLARATION_NODE_T* ast_xml_declaration_node_init(token_T* tag_opening,
277
277
 
278
278
  ast_node_init(&xml_declaration_node->base, AST_XML_DECLARATION_NODE, start_position, end_position, errors, allocator);
279
279
 
280
- xml_declaration_node->tag_opening = token_copy(tag_opening, allocator);
280
+ xml_declaration_node->tag_opening = tag_opening;
281
281
  xml_declaration_node->children = children;
282
- xml_declaration_node->tag_closing = token_copy(tag_closing, allocator);
282
+ xml_declaration_node->tag_closing = tag_closing;
283
283
 
284
284
  return xml_declaration_node;
285
285
  }
286
286
 
287
+ AST_XML_PROCESSING_INSTRUCTION_NODE_T* ast_xml_processing_instruction_node_init(token_T* tag_opening, token_T* target, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
288
+ AST_XML_PROCESSING_INSTRUCTION_NODE_T* xml_processing_instruction_node = hb_allocator_alloc(allocator, sizeof(AST_XML_PROCESSING_INSTRUCTION_NODE_T));
289
+
290
+ if (!xml_processing_instruction_node) { return NULL; }
291
+
292
+ ast_node_init(&xml_processing_instruction_node->base, AST_XML_PROCESSING_INSTRUCTION_NODE, start_position, end_position, errors, allocator);
293
+
294
+ xml_processing_instruction_node->tag_opening = tag_opening;
295
+ xml_processing_instruction_node->target = target;
296
+ xml_processing_instruction_node->children = children;
297
+ xml_processing_instruction_node->tag_closing = tag_closing;
298
+
299
+ return xml_processing_instruction_node;
300
+ }
301
+
287
302
  AST_CDATA_NODE_T* ast_cdata_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
288
303
  AST_CDATA_NODE_T* cdata_node = hb_allocator_alloc(allocator, sizeof(AST_CDATA_NODE_T));
289
304
 
@@ -291,9 +306,9 @@ AST_CDATA_NODE_T* ast_cdata_node_init(token_T* tag_opening, hb_array_T* children
291
306
 
292
307
  ast_node_init(&cdata_node->base, AST_CDATA_NODE, start_position, end_position, errors, allocator);
293
308
 
294
- cdata_node->tag_opening = token_copy(tag_opening, allocator);
309
+ cdata_node->tag_opening = tag_opening;
295
310
  cdata_node->children = children;
296
- cdata_node->tag_closing = token_copy(tag_closing, allocator);
311
+ cdata_node->tag_closing = tag_closing;
297
312
 
298
313
  return cdata_node;
299
314
  }
@@ -305,7 +320,7 @@ AST_WHITESPACE_NODE_T* ast_whitespace_node_init(token_T* value, position_T start
305
320
 
306
321
  ast_node_init(&whitespace_node->base, AST_WHITESPACE_NODE, start_position, end_position, errors, allocator);
307
322
 
308
- whitespace_node->value = token_copy(value, allocator);
323
+ whitespace_node->value = value;
309
324
 
310
325
  return whitespace_node;
311
326
  }
@@ -317,9 +332,9 @@ AST_ERB_CONTENT_NODE_T* ast_erb_content_node_init(token_T* tag_opening, token_T*
317
332
 
318
333
  ast_node_init(&erb_content_node->base, AST_ERB_CONTENT_NODE, start_position, end_position, errors, allocator);
319
334
 
320
- erb_content_node->tag_opening = token_copy(tag_opening, allocator);
321
- erb_content_node->content = token_copy(content, allocator);
322
- erb_content_node->tag_closing = token_copy(tag_closing, allocator);
335
+ erb_content_node->tag_opening = tag_opening;
336
+ erb_content_node->content = content;
337
+ erb_content_node->tag_closing = tag_closing;
323
338
  erb_content_node->analyzed_ruby = analyzed_ruby;
324
339
  erb_content_node->parsed = parsed;
325
340
  erb_content_node->valid = valid;
@@ -335,9 +350,9 @@ AST_ERB_END_NODE_T* ast_erb_end_node_init(token_T* tag_opening, token_T* content
335
350
 
336
351
  ast_node_init(&erb_end_node->base, AST_ERB_END_NODE, start_position, end_position, errors, allocator);
337
352
 
338
- erb_end_node->tag_opening = token_copy(tag_opening, allocator);
339
- erb_end_node->content = token_copy(content, allocator);
340
- erb_end_node->tag_closing = token_copy(tag_closing, allocator);
353
+ erb_end_node->tag_opening = tag_opening;
354
+ erb_end_node->content = content;
355
+ erb_end_node->tag_closing = tag_closing;
341
356
 
342
357
  return erb_end_node;
343
358
  }
@@ -349,9 +364,9 @@ AST_ERB_ELSE_NODE_T* ast_erb_else_node_init(token_T* tag_opening, token_T* conte
349
364
 
350
365
  ast_node_init(&erb_else_node->base, AST_ERB_ELSE_NODE, start_position, end_position, errors, allocator);
351
366
 
352
- erb_else_node->tag_opening = token_copy(tag_opening, allocator);
353
- erb_else_node->content = token_copy(content, allocator);
354
- erb_else_node->tag_closing = token_copy(tag_closing, allocator);
367
+ erb_else_node->tag_opening = tag_opening;
368
+ erb_else_node->content = content;
369
+ erb_else_node->tag_closing = tag_closing;
355
370
  erb_else_node->statements = statements;
356
371
 
357
372
  return erb_else_node;
@@ -364,9 +379,9 @@ AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content,
364
379
 
365
380
  ast_node_init(&erb_if_node->base, AST_ERB_IF_NODE, start_position, end_position, errors, allocator);
366
381
 
367
- erb_if_node->tag_opening = token_copy(tag_opening, allocator);
368
- erb_if_node->content = token_copy(content, allocator);
369
- erb_if_node->tag_closing = token_copy(tag_closing, allocator);
382
+ erb_if_node->tag_opening = tag_opening;
383
+ erb_if_node->content = content;
384
+ erb_if_node->tag_closing = tag_closing;
370
385
  erb_if_node->then_keyword = then_keyword;
371
386
  erb_if_node->prism_node = prism_node;
372
387
  erb_if_node->statements = statements;
@@ -383,9 +398,9 @@ AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* con
383
398
 
384
399
  ast_node_init(&erb_block_node->base, AST_ERB_BLOCK_NODE, start_position, end_position, errors, allocator);
385
400
 
386
- erb_block_node->tag_opening = token_copy(tag_opening, allocator);
387
- erb_block_node->content = token_copy(content, allocator);
388
- erb_block_node->tag_closing = token_copy(tag_closing, allocator);
401
+ erb_block_node->tag_opening = tag_opening;
402
+ erb_block_node->content = content;
403
+ erb_block_node->tag_closing = tag_closing;
389
404
  erb_block_node->prism_node = prism_node;
390
405
  erb_block_node->body = body;
391
406
  erb_block_node->block_arguments = block_arguments;
@@ -397,6 +412,32 @@ AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* con
397
412
  return erb_block_node;
398
413
  }
399
414
 
415
+ AST_ERB_ITERATION_BLOCK_NODE_T* ast_erb_iteration_block_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, token_T* receiver, token_T* call_operator, token_T* message, hb_array_T* arguments, token_T* block_opening, hb_array_T* body, hb_array_T* block_arguments, struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_ENSURE_NODE_STRUCT* ensure_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
416
+ AST_ERB_ITERATION_BLOCK_NODE_T* erb_iteration_block_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_ITERATION_BLOCK_NODE_T));
417
+
418
+ if (!erb_iteration_block_node) { return NULL; }
419
+
420
+ ast_node_init(&erb_iteration_block_node->base, AST_ERB_ITERATION_BLOCK_NODE, start_position, end_position, errors, allocator);
421
+
422
+ erb_iteration_block_node->tag_opening = tag_opening;
423
+ erb_iteration_block_node->content = content;
424
+ erb_iteration_block_node->tag_closing = tag_closing;
425
+ erb_iteration_block_node->prism_node = prism_node;
426
+ erb_iteration_block_node->receiver = receiver;
427
+ erb_iteration_block_node->call_operator = call_operator;
428
+ erb_iteration_block_node->message = message;
429
+ erb_iteration_block_node->arguments = arguments;
430
+ erb_iteration_block_node->block_opening = block_opening;
431
+ erb_iteration_block_node->body = body;
432
+ erb_iteration_block_node->block_arguments = block_arguments;
433
+ erb_iteration_block_node->rescue_clause = rescue_clause;
434
+ erb_iteration_block_node->else_clause = else_clause;
435
+ erb_iteration_block_node->ensure_clause = ensure_clause;
436
+ erb_iteration_block_node->end_node = end_node;
437
+
438
+ return erb_iteration_block_node;
439
+ }
440
+
400
441
  AST_ERB_WHEN_NODE_T* ast_erb_when_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
401
442
  AST_ERB_WHEN_NODE_T* erb_when_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_WHEN_NODE_T));
402
443
 
@@ -404,9 +445,9 @@ AST_ERB_WHEN_NODE_T* ast_erb_when_node_init(token_T* tag_opening, token_T* conte
404
445
 
405
446
  ast_node_init(&erb_when_node->base, AST_ERB_WHEN_NODE, start_position, end_position, errors, allocator);
406
447
 
407
- erb_when_node->tag_opening = token_copy(tag_opening, allocator);
408
- erb_when_node->content = token_copy(content, allocator);
409
- erb_when_node->tag_closing = token_copy(tag_closing, allocator);
448
+ erb_when_node->tag_opening = tag_opening;
449
+ erb_when_node->content = content;
450
+ erb_when_node->tag_closing = tag_closing;
410
451
  erb_when_node->then_keyword = then_keyword;
411
452
  erb_when_node->statements = statements;
412
453
 
@@ -420,9 +461,9 @@ AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* conte
420
461
 
421
462
  ast_node_init(&erb_case_node->base, AST_ERB_CASE_NODE, start_position, end_position, errors, allocator);
422
463
 
423
- erb_case_node->tag_opening = token_copy(tag_opening, allocator);
424
- erb_case_node->content = token_copy(content, allocator);
425
- erb_case_node->tag_closing = token_copy(tag_closing, allocator);
464
+ erb_case_node->tag_opening = tag_opening;
465
+ erb_case_node->content = content;
466
+ erb_case_node->tag_closing = tag_closing;
426
467
  erb_case_node->children = children;
427
468
  erb_case_node->prism_node = prism_node;
428
469
  erb_case_node->conditions = conditions;
@@ -439,9 +480,9 @@ AST_ERB_CASE_MATCH_NODE_T* ast_erb_case_match_node_init(token_T* tag_opening, to
439
480
 
440
481
  ast_node_init(&erb_case_match_node->base, AST_ERB_CASE_MATCH_NODE, start_position, end_position, errors, allocator);
441
482
 
442
- erb_case_match_node->tag_opening = token_copy(tag_opening, allocator);
443
- erb_case_match_node->content = token_copy(content, allocator);
444
- erb_case_match_node->tag_closing = token_copy(tag_closing, allocator);
483
+ erb_case_match_node->tag_opening = tag_opening;
484
+ erb_case_match_node->content = content;
485
+ erb_case_match_node->tag_closing = tag_closing;
445
486
  erb_case_match_node->children = children;
446
487
  erb_case_match_node->prism_node = prism_node;
447
488
  erb_case_match_node->conditions = conditions;
@@ -458,9 +499,9 @@ AST_ERB_WHILE_NODE_T* ast_erb_while_node_init(token_T* tag_opening, token_T* con
458
499
 
459
500
  ast_node_init(&erb_while_node->base, AST_ERB_WHILE_NODE, start_position, end_position, errors, allocator);
460
501
 
461
- erb_while_node->tag_opening = token_copy(tag_opening, allocator);
462
- erb_while_node->content = token_copy(content, allocator);
463
- erb_while_node->tag_closing = token_copy(tag_closing, allocator);
502
+ erb_while_node->tag_opening = tag_opening;
503
+ erb_while_node->content = content;
504
+ erb_while_node->tag_closing = tag_closing;
464
505
  erb_while_node->prism_node = prism_node;
465
506
  erb_while_node->statements = statements;
466
507
  erb_while_node->end_node = end_node;
@@ -475,9 +516,9 @@ AST_ERB_UNTIL_NODE_T* ast_erb_until_node_init(token_T* tag_opening, token_T* con
475
516
 
476
517
  ast_node_init(&erb_until_node->base, AST_ERB_UNTIL_NODE, start_position, end_position, errors, allocator);
477
518
 
478
- erb_until_node->tag_opening = token_copy(tag_opening, allocator);
479
- erb_until_node->content = token_copy(content, allocator);
480
- erb_until_node->tag_closing = token_copy(tag_closing, allocator);
519
+ erb_until_node->tag_opening = tag_opening;
520
+ erb_until_node->content = content;
521
+ erb_until_node->tag_closing = tag_closing;
481
522
  erb_until_node->prism_node = prism_node;
482
523
  erb_until_node->statements = statements;
483
524
  erb_until_node->end_node = end_node;
@@ -492,9 +533,9 @@ AST_ERB_FOR_NODE_T* ast_erb_for_node_init(token_T* tag_opening, token_T* content
492
533
 
493
534
  ast_node_init(&erb_for_node->base, AST_ERB_FOR_NODE, start_position, end_position, errors, allocator);
494
535
 
495
- erb_for_node->tag_opening = token_copy(tag_opening, allocator);
496
- erb_for_node->content = token_copy(content, allocator);
497
- erb_for_node->tag_closing = token_copy(tag_closing, allocator);
536
+ erb_for_node->tag_opening = tag_opening;
537
+ erb_for_node->content = content;
538
+ erb_for_node->tag_closing = tag_closing;
498
539
  erb_for_node->prism_node = prism_node;
499
540
  erb_for_node->statements = statements;
500
541
  erb_for_node->end_node = end_node;
@@ -509,9 +550,9 @@ AST_ERB_RESCUE_NODE_T* ast_erb_rescue_node_init(token_T* tag_opening, token_T* c
509
550
 
510
551
  ast_node_init(&erb_rescue_node->base, AST_ERB_RESCUE_NODE, start_position, end_position, errors, allocator);
511
552
 
512
- erb_rescue_node->tag_opening = token_copy(tag_opening, allocator);
513
- erb_rescue_node->content = token_copy(content, allocator);
514
- erb_rescue_node->tag_closing = token_copy(tag_closing, allocator);
553
+ erb_rescue_node->tag_opening = tag_opening;
554
+ erb_rescue_node->content = content;
555
+ erb_rescue_node->tag_closing = tag_closing;
515
556
  erb_rescue_node->statements = statements;
516
557
  erb_rescue_node->subsequent = subsequent;
517
558
 
@@ -525,9 +566,9 @@ AST_ERB_ENSURE_NODE_T* ast_erb_ensure_node_init(token_T* tag_opening, token_T* c
525
566
 
526
567
  ast_node_init(&erb_ensure_node->base, AST_ERB_ENSURE_NODE, start_position, end_position, errors, allocator);
527
568
 
528
- erb_ensure_node->tag_opening = token_copy(tag_opening, allocator);
529
- erb_ensure_node->content = token_copy(content, allocator);
530
- erb_ensure_node->tag_closing = token_copy(tag_closing, allocator);
569
+ erb_ensure_node->tag_opening = tag_opening;
570
+ erb_ensure_node->content = content;
571
+ erb_ensure_node->tag_closing = tag_closing;
531
572
  erb_ensure_node->statements = statements;
532
573
 
533
574
  return erb_ensure_node;
@@ -540,9 +581,9 @@ AST_ERB_BEGIN_NODE_T* ast_erb_begin_node_init(token_T* tag_opening, token_T* con
540
581
 
541
582
  ast_node_init(&erb_begin_node->base, AST_ERB_BEGIN_NODE, start_position, end_position, errors, allocator);
542
583
 
543
- erb_begin_node->tag_opening = token_copy(tag_opening, allocator);
544
- erb_begin_node->content = token_copy(content, allocator);
545
- erb_begin_node->tag_closing = token_copy(tag_closing, allocator);
584
+ erb_begin_node->tag_opening = tag_opening;
585
+ erb_begin_node->content = content;
586
+ erb_begin_node->tag_closing = tag_closing;
546
587
  erb_begin_node->prism_node = prism_node;
547
588
  erb_begin_node->statements = statements;
548
589
  erb_begin_node->rescue_clause = rescue_clause;
@@ -560,9 +601,9 @@ AST_ERB_UNLESS_NODE_T* ast_erb_unless_node_init(token_T* tag_opening, token_T* c
560
601
 
561
602
  ast_node_init(&erb_unless_node->base, AST_ERB_UNLESS_NODE, start_position, end_position, errors, allocator);
562
603
 
563
- erb_unless_node->tag_opening = token_copy(tag_opening, allocator);
564
- erb_unless_node->content = token_copy(content, allocator);
565
- erb_unless_node->tag_closing = token_copy(tag_closing, allocator);
604
+ erb_unless_node->tag_opening = tag_opening;
605
+ erb_unless_node->content = content;
606
+ erb_unless_node->tag_closing = tag_closing;
566
607
  erb_unless_node->then_keyword = then_keyword;
567
608
  erb_unless_node->prism_node = prism_node;
568
609
  erb_unless_node->statements = statements;
@@ -579,37 +620,39 @@ AST_RUBY_RENDER_LOCAL_NODE_T* ast_ruby_render_local_node_init(token_T* name, str
579
620
 
580
621
  ast_node_init(&ruby_render_local_node->base, AST_RUBY_RENDER_LOCAL_NODE, start_position, end_position, errors, allocator);
581
622
 
582
- ruby_render_local_node->name = token_copy(name, allocator);
623
+ ruby_render_local_node->name = name;
583
624
  ruby_render_local_node->value = value;
584
625
 
585
626
  return ruby_render_local_node;
586
627
  }
587
628
 
588
- AST_RUBY_RENDER_KEYWORDS_NODE_T* ast_ruby_render_keywords_node_init(token_T* partial, token_T* template_path, token_T* layout, token_T* file, token_T* inline_template, token_T* body, token_T* plain, token_T* html, token_T* renderable, token_T* collection, token_T* object, token_T* as_name, token_T* spacer_template, token_T* formats, token_T* variants, token_T* handlers, token_T* content_type, hb_array_T* locals, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
629
+ AST_RUBY_RENDER_KEYWORDS_NODE_T* ast_ruby_render_keywords_node_init(token_T* partial, token_T* template_path, token_T* layout, token_T* file, token_T* inline_template, token_T* body, token_T* plain, token_T* html, token_T* renderable, token_T* collection, token_T* object, token_T* as_name, token_T* spacer_template, token_T* formats, token_T* variants, token_T* handlers, token_T* content_type, hb_array_T* locals, hb_array_T* state, location_T* state_location, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
589
630
  AST_RUBY_RENDER_KEYWORDS_NODE_T* ruby_render_keywords_node = hb_allocator_alloc(allocator, sizeof(AST_RUBY_RENDER_KEYWORDS_NODE_T));
590
631
 
591
632
  if (!ruby_render_keywords_node) { return NULL; }
592
633
 
593
634
  ast_node_init(&ruby_render_keywords_node->base, AST_RUBY_RENDER_KEYWORDS_NODE, start_position, end_position, errors, allocator);
594
635
 
595
- ruby_render_keywords_node->partial = token_copy(partial, allocator);
596
- ruby_render_keywords_node->template_path = token_copy(template_path, allocator);
597
- ruby_render_keywords_node->layout = token_copy(layout, allocator);
598
- ruby_render_keywords_node->file = token_copy(file, allocator);
599
- ruby_render_keywords_node->inline_template = token_copy(inline_template, allocator);
600
- ruby_render_keywords_node->body = token_copy(body, allocator);
601
- ruby_render_keywords_node->plain = token_copy(plain, allocator);
602
- ruby_render_keywords_node->html = token_copy(html, allocator);
603
- ruby_render_keywords_node->renderable = token_copy(renderable, allocator);
604
- ruby_render_keywords_node->collection = token_copy(collection, allocator);
605
- ruby_render_keywords_node->object = token_copy(object, allocator);
606
- ruby_render_keywords_node->as_name = token_copy(as_name, allocator);
607
- ruby_render_keywords_node->spacer_template = token_copy(spacer_template, allocator);
608
- ruby_render_keywords_node->formats = token_copy(formats, allocator);
609
- ruby_render_keywords_node->variants = token_copy(variants, allocator);
610
- ruby_render_keywords_node->handlers = token_copy(handlers, allocator);
611
- ruby_render_keywords_node->content_type = token_copy(content_type, allocator);
636
+ ruby_render_keywords_node->partial = partial;
637
+ ruby_render_keywords_node->template_path = template_path;
638
+ ruby_render_keywords_node->layout = layout;
639
+ ruby_render_keywords_node->file = file;
640
+ ruby_render_keywords_node->inline_template = inline_template;
641
+ ruby_render_keywords_node->body = body;
642
+ ruby_render_keywords_node->plain = plain;
643
+ ruby_render_keywords_node->html = html;
644
+ ruby_render_keywords_node->renderable = renderable;
645
+ ruby_render_keywords_node->collection = collection;
646
+ ruby_render_keywords_node->object = object;
647
+ ruby_render_keywords_node->as_name = as_name;
648
+ ruby_render_keywords_node->spacer_template = spacer_template;
649
+ ruby_render_keywords_node->formats = formats;
650
+ ruby_render_keywords_node->variants = variants;
651
+ ruby_render_keywords_node->handlers = handlers;
652
+ ruby_render_keywords_node->content_type = content_type;
612
653
  ruby_render_keywords_node->locals = locals;
654
+ ruby_render_keywords_node->state = state;
655
+ ruby_render_keywords_node->state_location = state_location;
613
656
 
614
657
  return ruby_render_keywords_node;
615
658
  }
@@ -621,9 +664,9 @@ AST_ERB_RENDER_NODE_T* ast_erb_render_node_init(token_T* tag_opening, token_T* c
621
664
 
622
665
  ast_node_init(&erb_render_node->base, AST_ERB_RENDER_NODE, start_position, end_position, errors, allocator);
623
666
 
624
- erb_render_node->tag_opening = token_copy(tag_opening, allocator);
625
- erb_render_node->content = token_copy(content, allocator);
626
- erb_render_node->tag_closing = token_copy(tag_closing, allocator);
667
+ erb_render_node->tag_opening = tag_opening;
668
+ erb_render_node->content = content;
669
+ erb_render_node->tag_closing = tag_closing;
627
670
  erb_render_node->analyzed_ruby = analyzed_ruby;
628
671
  erb_render_node->prism_node = prism_node;
629
672
  erb_render_node->keywords = keywords;
@@ -644,7 +687,7 @@ AST_RUBY_PARAMETER_NODE_T* ast_ruby_parameter_node_init(token_T* name, struct AS
644
687
 
645
688
  ast_node_init(&ruby_parameter_node->base, AST_RUBY_PARAMETER_NODE, start_position, end_position, errors, allocator);
646
689
 
647
- ruby_parameter_node->name = token_copy(name, allocator);
690
+ ruby_parameter_node->name = name;
648
691
  ruby_parameter_node->default_value = default_value;
649
692
  ruby_parameter_node->kind = hb_string_copy(kind, allocator);
650
693
  ruby_parameter_node->required = required;
@@ -659,9 +702,9 @@ AST_ERB_STRICT_LOCALS_NODE_T* ast_erb_strict_locals_node_init(token_T* tag_openi
659
702
 
660
703
  ast_node_init(&erb_strict_locals_node->base, AST_ERB_STRICT_LOCALS_NODE, start_position, end_position, errors, allocator);
661
704
 
662
- erb_strict_locals_node->tag_opening = token_copy(tag_opening, allocator);
663
- erb_strict_locals_node->content = token_copy(content, allocator);
664
- erb_strict_locals_node->tag_closing = token_copy(tag_closing, allocator);
705
+ erb_strict_locals_node->tag_opening = tag_opening;
706
+ erb_strict_locals_node->content = content;
707
+ erb_strict_locals_node->tag_closing = tag_closing;
665
708
  erb_strict_locals_node->analyzed_ruby = analyzed_ruby;
666
709
  erb_strict_locals_node->prism_node = prism_node;
667
710
  erb_strict_locals_node->locals = locals;
@@ -669,16 +712,17 @@ AST_ERB_STRICT_LOCALS_NODE_T* ast_erb_strict_locals_node_init(token_T* tag_openi
669
712
  return erb_strict_locals_node;
670
713
  }
671
714
 
672
- AST_ERB_YIELD_NODE_T* ast_erb_yield_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
715
+ AST_ERB_YIELD_NODE_T* ast_erb_yield_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
673
716
  AST_ERB_YIELD_NODE_T* erb_yield_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_YIELD_NODE_T));
674
717
 
675
718
  if (!erb_yield_node) { return NULL; }
676
719
 
677
720
  ast_node_init(&erb_yield_node->base, AST_ERB_YIELD_NODE, start_position, end_position, errors, allocator);
678
721
 
679
- erb_yield_node->tag_opening = token_copy(tag_opening, allocator);
680
- erb_yield_node->content = token_copy(content, allocator);
681
- erb_yield_node->tag_closing = token_copy(tag_closing, allocator);
722
+ erb_yield_node->tag_opening = tag_opening;
723
+ erb_yield_node->content = content;
724
+ erb_yield_node->tag_closing = tag_closing;
725
+ erb_yield_node->prism_node = prism_node;
682
726
 
683
727
  return erb_yield_node;
684
728
  }
@@ -690,15 +734,76 @@ AST_ERB_IN_NODE_T* ast_erb_in_node_init(token_T* tag_opening, token_T* content,
690
734
 
691
735
  ast_node_init(&erb_in_node->base, AST_ERB_IN_NODE, start_position, end_position, errors, allocator);
692
736
 
693
- erb_in_node->tag_opening = token_copy(tag_opening, allocator);
694
- erb_in_node->content = token_copy(content, allocator);
695
- erb_in_node->tag_closing = token_copy(tag_closing, allocator);
737
+ erb_in_node->tag_opening = tag_opening;
738
+ erb_in_node->content = content;
739
+ erb_in_node->tag_closing = tag_closing;
696
740
  erb_in_node->then_keyword = then_keyword;
697
741
  erb_in_node->statements = statements;
698
742
 
699
743
  return erb_in_node;
700
744
  }
701
745
 
746
+ AST_HERB_DIRECTIVE_NODE_T* ast_herb_directive_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, token_T* key, token_T* arguments, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
747
+ AST_HERB_DIRECTIVE_NODE_T* herb_directive_node = hb_allocator_alloc(allocator, sizeof(AST_HERB_DIRECTIVE_NODE_T));
748
+
749
+ if (!herb_directive_node) { return NULL; }
750
+
751
+ ast_node_init(&herb_directive_node->base, AST_HERB_DIRECTIVE_NODE, start_position, end_position, errors, allocator);
752
+
753
+ herb_directive_node->tag_opening = tag_opening;
754
+ herb_directive_node->content = content;
755
+ herb_directive_node->tag_closing = tag_closing;
756
+ herb_directive_node->key = key;
757
+ herb_directive_node->arguments = arguments;
758
+
759
+ return herb_directive_node;
760
+ }
761
+
762
+ AST_HERB_STATE_DECLARATION_NODE_T* ast_herb_state_declaration_node_init(token_T* name, struct AST_RUBY_LITERAL_NODE_STRUCT* default_value, hb_string_T kind, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
763
+ AST_HERB_STATE_DECLARATION_NODE_T* herb_state_declaration_node = hb_allocator_alloc(allocator, sizeof(AST_HERB_STATE_DECLARATION_NODE_T));
764
+
765
+ if (!herb_state_declaration_node) { return NULL; }
766
+
767
+ ast_node_init(&herb_state_declaration_node->base, AST_HERB_STATE_DECLARATION_NODE, start_position, end_position, errors, allocator);
768
+
769
+ herb_state_declaration_node->name = name;
770
+ herb_state_declaration_node->default_value = default_value;
771
+ herb_state_declaration_node->kind = hb_string_copy(kind, allocator);
772
+
773
+ return herb_state_declaration_node;
774
+ }
775
+
776
+ AST_HERB_STATE_DIRECTIVE_NODE_T* ast_herb_state_directive_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, token_T* key, token_T* signature, hb_array_T* states, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
777
+ AST_HERB_STATE_DIRECTIVE_NODE_T* herb_state_directive_node = hb_allocator_alloc(allocator, sizeof(AST_HERB_STATE_DIRECTIVE_NODE_T));
778
+
779
+ if (!herb_state_directive_node) { return NULL; }
780
+
781
+ ast_node_init(&herb_state_directive_node->base, AST_HERB_STATE_DIRECTIVE_NODE, start_position, end_position, errors, allocator);
782
+
783
+ herb_state_directive_node->tag_opening = tag_opening;
784
+ herb_state_directive_node->content = content;
785
+ herb_state_directive_node->tag_closing = tag_closing;
786
+ herb_state_directive_node->key = key;
787
+ herb_state_directive_node->signature = signature;
788
+ herb_state_directive_node->states = states;
789
+
790
+ return herb_state_directive_node;
791
+ }
792
+
793
+ AST_ERB_COMMENT_NODE_T* ast_erb_comment_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
794
+ AST_ERB_COMMENT_NODE_T* erb_comment_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_COMMENT_NODE_T));
795
+
796
+ if (!erb_comment_node) { return NULL; }
797
+
798
+ ast_node_init(&erb_comment_node->base, AST_ERB_COMMENT_NODE, start_position, end_position, errors, allocator);
799
+
800
+ erb_comment_node->tag_opening = tag_opening;
801
+ erb_comment_node->content = content;
802
+ erb_comment_node->tag_closing = tag_closing;
803
+
804
+ return erb_comment_node;
805
+ }
806
+
702
807
  hb_string_T ast_node_type_to_string(AST_NODE_T* node) {
703
808
  switch (node->type) {
704
809
  case AST_DOCUMENT_NODE: return hb_string("AST_DOCUMENT_NODE");
@@ -720,6 +825,7 @@ hb_string_T ast_node_type_to_string(AST_NODE_T* node) {
720
825
  case AST_HTML_COMMENT_NODE: return hb_string("AST_HTML_COMMENT_NODE");
721
826
  case AST_HTML_DOCTYPE_NODE: return hb_string("AST_HTML_DOCTYPE_NODE");
722
827
  case AST_XML_DECLARATION_NODE: return hb_string("AST_XML_DECLARATION_NODE");
828
+ case AST_XML_PROCESSING_INSTRUCTION_NODE: return hb_string("AST_XML_PROCESSING_INSTRUCTION_NODE");
723
829
  case AST_CDATA_NODE: return hb_string("AST_CDATA_NODE");
724
830
  case AST_WHITESPACE_NODE: return hb_string("AST_WHITESPACE_NODE");
725
831
  case AST_ERB_CONTENT_NODE: return hb_string("AST_ERB_CONTENT_NODE");
@@ -727,6 +833,7 @@ hb_string_T ast_node_type_to_string(AST_NODE_T* node) {
727
833
  case AST_ERB_ELSE_NODE: return hb_string("AST_ERB_ELSE_NODE");
728
834
  case AST_ERB_IF_NODE: return hb_string("AST_ERB_IF_NODE");
729
835
  case AST_ERB_BLOCK_NODE: return hb_string("AST_ERB_BLOCK_NODE");
836
+ case AST_ERB_ITERATION_BLOCK_NODE: return hb_string("AST_ERB_ITERATION_BLOCK_NODE");
730
837
  case AST_ERB_WHEN_NODE: return hb_string("AST_ERB_WHEN_NODE");
731
838
  case AST_ERB_CASE_NODE: return hb_string("AST_ERB_CASE_NODE");
732
839
  case AST_ERB_CASE_MATCH_NODE: return hb_string("AST_ERB_CASE_MATCH_NODE");
@@ -744,6 +851,10 @@ hb_string_T ast_node_type_to_string(AST_NODE_T* node) {
744
851
  case AST_ERB_STRICT_LOCALS_NODE: return hb_string("AST_ERB_STRICT_LOCALS_NODE");
745
852
  case AST_ERB_YIELD_NODE: return hb_string("AST_ERB_YIELD_NODE");
746
853
  case AST_ERB_IN_NODE: return hb_string("AST_ERB_IN_NODE");
854
+ case AST_HERB_DIRECTIVE_NODE: return hb_string("AST_HERB_DIRECTIVE_NODE");
855
+ case AST_HERB_STATE_DECLARATION_NODE: return hb_string("AST_HERB_STATE_DECLARATION_NODE");
856
+ case AST_HERB_STATE_DIRECTIVE_NODE: return hb_string("AST_HERB_STATE_DIRECTIVE_NODE");
857
+ case AST_ERB_COMMENT_NODE: return hb_string("AST_ERB_COMMENT_NODE");
747
858
  }
748
859
 
749
860
  return hb_string("Unknown ast_node_type_T");
@@ -770,6 +881,7 @@ hb_string_T ast_node_human_type(AST_NODE_T* node) {
770
881
  case AST_HTML_COMMENT_NODE: return hb_string("HTMLCommentNode");
771
882
  case AST_HTML_DOCTYPE_NODE: return hb_string("HTMLDoctypeNode");
772
883
  case AST_XML_DECLARATION_NODE: return hb_string("XMLDeclarationNode");
884
+ case AST_XML_PROCESSING_INSTRUCTION_NODE: return hb_string("XMLProcessingInstructionNode");
773
885
  case AST_CDATA_NODE: return hb_string("CDATANode");
774
886
  case AST_WHITESPACE_NODE: return hb_string("WhitespaceNode");
775
887
  case AST_ERB_CONTENT_NODE: return hb_string("ERBContentNode");
@@ -777,6 +889,7 @@ hb_string_T ast_node_human_type(AST_NODE_T* node) {
777
889
  case AST_ERB_ELSE_NODE: return hb_string("ERBElseNode");
778
890
  case AST_ERB_IF_NODE: return hb_string("ERBIfNode");
779
891
  case AST_ERB_BLOCK_NODE: return hb_string("ERBBlockNode");
892
+ case AST_ERB_ITERATION_BLOCK_NODE: return hb_string("ERBIterationBlockNode");
780
893
  case AST_ERB_WHEN_NODE: return hb_string("ERBWhenNode");
781
894
  case AST_ERB_CASE_NODE: return hb_string("ERBCaseNode");
782
895
  case AST_ERB_CASE_MATCH_NODE: return hb_string("ERBCaseMatchNode");
@@ -794,6 +907,10 @@ hb_string_T ast_node_human_type(AST_NODE_T* node) {
794
907
  case AST_ERB_STRICT_LOCALS_NODE: return hb_string("ERBStrictLocalsNode");
795
908
  case AST_ERB_YIELD_NODE: return hb_string("ERBYieldNode");
796
909
  case AST_ERB_IN_NODE: return hb_string("ERBInNode");
910
+ case AST_HERB_DIRECTIVE_NODE: return hb_string("HerbDirectiveNode");
911
+ case AST_HERB_STATE_DECLARATION_NODE: return hb_string("HerbStateDeclarationNode");
912
+ case AST_HERB_STATE_DIRECTIVE_NODE: return hb_string("HerbStateDirectiveNode");
913
+ case AST_ERB_COMMENT_NODE: return hb_string("ERBCommentNode");
797
914
  }
798
915
 
799
916
  return hb_string("Unknown ast_node_type_T");
@@ -831,7 +948,7 @@ static void ast_free_document_node(AST_DOCUMENT_NODE_T* document_node, hb_alloca
831
948
  }
832
949
 
833
950
  static void ast_free_literal_node(AST_LITERAL_NODE_T* literal_node, hb_allocator_T* allocator) {
834
- if (literal_node->content.data != NULL) { hb_allocator_dealloc(allocator, literal_node->content.data); }
951
+ if (!hb_string_is_empty(literal_node->content)) { hb_allocator_dealloc(allocator, literal_node->content.data); }
835
952
 
836
953
  ast_free_base_node(&literal_node->base, allocator);
837
954
  }
@@ -904,7 +1021,7 @@ static void ast_free_html_element_node(AST_HTML_ELEMENT_NODE_T* html_element_nod
904
1021
  }
905
1022
 
906
1023
  static void ast_free_html_conditional_element_node(AST_HTML_CONDITIONAL_ELEMENT_NODE_T* html_conditional_element_node, hb_allocator_T* allocator) {
907
- if (html_conditional_element_node->condition.data != NULL) { hb_allocator_dealloc(allocator, html_conditional_element_node->condition.data); }
1024
+ if (!hb_string_is_empty(html_conditional_element_node->condition)) { hb_allocator_dealloc(allocator, html_conditional_element_node->condition.data); }
908
1025
  ast_node_free((AST_NODE_T*) html_conditional_element_node->open_conditional, allocator);
909
1026
  /* open_tag is a borrowed reference, not freed here (owned by another field) */
910
1027
  if (html_conditional_element_node->body != NULL) {
@@ -959,14 +1076,14 @@ static void ast_free_html_attribute_node(AST_HTML_ATTRIBUTE_NODE_T* html_attribu
959
1076
  }
960
1077
 
961
1078
  static void ast_free_ruby_literal_node(AST_RUBY_LITERAL_NODE_T* ruby_literal_node, hb_allocator_T* allocator) {
962
- if (ruby_literal_node->content.data != NULL) { hb_allocator_dealloc(allocator, ruby_literal_node->content.data); }
1079
+ if (!hb_string_is_empty(ruby_literal_node->content)) { hb_allocator_dealloc(allocator, ruby_literal_node->content.data); }
963
1080
 
964
1081
  ast_free_base_node(&ruby_literal_node->base, allocator);
965
1082
  }
966
1083
 
967
1084
  static void ast_free_ruby_html_attributes_splat_node(AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T* ruby_html_attributes_splat_node, hb_allocator_T* allocator) {
968
- if (ruby_html_attributes_splat_node->content.data != NULL) { hb_allocator_dealloc(allocator, ruby_html_attributes_splat_node->content.data); }
969
- if (ruby_html_attributes_splat_node->prefix.data != NULL) { hb_allocator_dealloc(allocator, ruby_html_attributes_splat_node->prefix.data); }
1085
+ if (!hb_string_is_empty(ruby_html_attributes_splat_node->content)) { hb_allocator_dealloc(allocator, ruby_html_attributes_splat_node->content.data); }
1086
+ if (!hb_string_is_empty(ruby_html_attributes_splat_node->prefix)) { hb_allocator_dealloc(allocator, ruby_html_attributes_splat_node->prefix.data); }
970
1087
 
971
1088
  ast_free_base_node(&ruby_html_attributes_splat_node->base, allocator);
972
1089
  }
@@ -989,7 +1106,7 @@ static void ast_free_erb_open_tag_node(AST_ERB_OPEN_TAG_NODE_T* erb_open_tag_nod
989
1106
  }
990
1107
 
991
1108
  static void ast_free_html_text_node(AST_HTML_TEXT_NODE_T* html_text_node, hb_allocator_T* allocator) {
992
- if (html_text_node->content.data != NULL) { hb_allocator_dealloc(allocator, html_text_node->content.data); }
1109
+ if (!hb_string_is_empty(html_text_node->content)) { hb_allocator_dealloc(allocator, html_text_node->content.data); }
993
1110
 
994
1111
  ast_free_base_node(&html_text_node->base, allocator);
995
1112
  }
@@ -1039,6 +1156,22 @@ static void ast_free_xml_declaration_node(AST_XML_DECLARATION_NODE_T* xml_declar
1039
1156
  ast_free_base_node(&xml_declaration_node->base, allocator);
1040
1157
  }
1041
1158
 
1159
+ static void ast_free_xml_processing_instruction_node(AST_XML_PROCESSING_INSTRUCTION_NODE_T* xml_processing_instruction_node, hb_allocator_T* allocator) {
1160
+ if (xml_processing_instruction_node->tag_opening != NULL) { token_free(xml_processing_instruction_node->tag_opening, allocator); }
1161
+ if (xml_processing_instruction_node->target != NULL) { token_free(xml_processing_instruction_node->target, allocator); }
1162
+ if (xml_processing_instruction_node->children != NULL) {
1163
+ for (size_t i = 0; i < hb_array_size(xml_processing_instruction_node->children); i++) {
1164
+ AST_NODE_T* child = hb_array_get(xml_processing_instruction_node->children, i);
1165
+ if (child) { ast_node_free(child, allocator); }
1166
+ }
1167
+
1168
+ hb_array_free(&xml_processing_instruction_node->children);
1169
+ }
1170
+ if (xml_processing_instruction_node->tag_closing != NULL) { token_free(xml_processing_instruction_node->tag_closing, allocator); }
1171
+
1172
+ ast_free_base_node(&xml_processing_instruction_node->base, allocator);
1173
+ }
1174
+
1042
1175
  static void ast_free_cdata_node(AST_CDATA_NODE_T* cdata_node, hb_allocator_T* allocator) {
1043
1176
  if (cdata_node->tag_opening != NULL) { token_free(cdata_node->tag_opening, allocator); }
1044
1177
  if (cdata_node->children != NULL) {
@@ -1145,6 +1278,47 @@ static void ast_free_erb_block_node(AST_ERB_BLOCK_NODE_T* erb_block_node, hb_all
1145
1278
  ast_free_base_node(&erb_block_node->base, allocator);
1146
1279
  }
1147
1280
 
1281
+ static void ast_free_erb_iteration_block_node(AST_ERB_ITERATION_BLOCK_NODE_T* erb_iteration_block_node, hb_allocator_T* allocator) {
1282
+ if (erb_iteration_block_node->tag_opening != NULL) { token_free(erb_iteration_block_node->tag_opening, allocator); }
1283
+ if (erb_iteration_block_node->content != NULL) { token_free(erb_iteration_block_node->content, allocator); }
1284
+ if (erb_iteration_block_node->tag_closing != NULL) { token_free(erb_iteration_block_node->tag_closing, allocator); }
1285
+ /* prism_node is a borrowed reference into the prism context, not freed here */
1286
+ if (erb_iteration_block_node->receiver != NULL) { token_free(erb_iteration_block_node->receiver, allocator); }
1287
+ if (erb_iteration_block_node->call_operator != NULL) { token_free(erb_iteration_block_node->call_operator, allocator); }
1288
+ if (erb_iteration_block_node->message != NULL) { token_free(erb_iteration_block_node->message, allocator); }
1289
+ if (erb_iteration_block_node->arguments != NULL) {
1290
+ for (size_t i = 0; i < hb_array_size(erb_iteration_block_node->arguments); i++) {
1291
+ AST_NODE_T* child = hb_array_get(erb_iteration_block_node->arguments, i);
1292
+ if (child) { ast_node_free(child, allocator); }
1293
+ }
1294
+
1295
+ hb_array_free(&erb_iteration_block_node->arguments);
1296
+ }
1297
+ if (erb_iteration_block_node->block_opening != NULL) { token_free(erb_iteration_block_node->block_opening, allocator); }
1298
+ if (erb_iteration_block_node->body != NULL) {
1299
+ for (size_t i = 0; i < hb_array_size(erb_iteration_block_node->body); i++) {
1300
+ AST_NODE_T* child = hb_array_get(erb_iteration_block_node->body, i);
1301
+ if (child) { ast_node_free(child, allocator); }
1302
+ }
1303
+
1304
+ hb_array_free(&erb_iteration_block_node->body);
1305
+ }
1306
+ if (erb_iteration_block_node->block_arguments != NULL) {
1307
+ for (size_t i = 0; i < hb_array_size(erb_iteration_block_node->block_arguments); i++) {
1308
+ AST_NODE_T* child = hb_array_get(erb_iteration_block_node->block_arguments, i);
1309
+ if (child) { ast_node_free(child, allocator); }
1310
+ }
1311
+
1312
+ hb_array_free(&erb_iteration_block_node->block_arguments);
1313
+ }
1314
+ ast_node_free((AST_NODE_T*) erb_iteration_block_node->rescue_clause, allocator);
1315
+ ast_node_free((AST_NODE_T*) erb_iteration_block_node->else_clause, allocator);
1316
+ ast_node_free((AST_NODE_T*) erb_iteration_block_node->ensure_clause, allocator);
1317
+ ast_node_free((AST_NODE_T*) erb_iteration_block_node->end_node, allocator);
1318
+
1319
+ ast_free_base_node(&erb_iteration_block_node->base, allocator);
1320
+ }
1321
+
1148
1322
  static void ast_free_erb_when_node(AST_ERB_WHEN_NODE_T* erb_when_node, hb_allocator_T* allocator) {
1149
1323
  if (erb_when_node->tag_opening != NULL) { token_free(erb_when_node->tag_opening, allocator); }
1150
1324
  if (erb_when_node->content != NULL) { token_free(erb_when_node->content, allocator); }
@@ -1377,6 +1551,15 @@ static void ast_free_ruby_render_keywords_node(AST_RUBY_RENDER_KEYWORDS_NODE_T*
1377
1551
 
1378
1552
  hb_array_free(&ruby_render_keywords_node->locals);
1379
1553
  }
1554
+ if (ruby_render_keywords_node->state != NULL) {
1555
+ for (size_t i = 0; i < hb_array_size(ruby_render_keywords_node->state); i++) {
1556
+ AST_NODE_T* child = hb_array_get(ruby_render_keywords_node->state, i);
1557
+ if (child) { ast_node_free(child, allocator); }
1558
+ }
1559
+
1560
+ hb_array_free(&ruby_render_keywords_node->state);
1561
+ }
1562
+ if (ruby_render_keywords_node->state_location != NULL) { hb_allocator_dealloc(allocator, ruby_render_keywords_node->state_location); }
1380
1563
 
1381
1564
  ast_free_base_node(&ruby_render_keywords_node->base, allocator);
1382
1565
  }
@@ -1417,7 +1600,7 @@ static void ast_free_erb_render_node(AST_ERB_RENDER_NODE_T* erb_render_node, hb_
1417
1600
  static void ast_free_ruby_parameter_node(AST_RUBY_PARAMETER_NODE_T* ruby_parameter_node, hb_allocator_T* allocator) {
1418
1601
  if (ruby_parameter_node->name != NULL) { token_free(ruby_parameter_node->name, allocator); }
1419
1602
  ast_node_free((AST_NODE_T*) ruby_parameter_node->default_value, allocator);
1420
- if (ruby_parameter_node->kind.data != NULL) { hb_allocator_dealloc(allocator, ruby_parameter_node->kind.data); }
1603
+ if (!hb_string_is_empty(ruby_parameter_node->kind)) { hb_allocator_dealloc(allocator, ruby_parameter_node->kind.data); }
1421
1604
 
1422
1605
  ast_free_base_node(&ruby_parameter_node->base, allocator);
1423
1606
  }
@@ -1446,6 +1629,7 @@ static void ast_free_erb_yield_node(AST_ERB_YIELD_NODE_T* erb_yield_node, hb_all
1446
1629
  if (erb_yield_node->tag_opening != NULL) { token_free(erb_yield_node->tag_opening, allocator); }
1447
1630
  if (erb_yield_node->content != NULL) { token_free(erb_yield_node->content, allocator); }
1448
1631
  if (erb_yield_node->tag_closing != NULL) { token_free(erb_yield_node->tag_closing, allocator); }
1632
+ /* prism_node is a borrowed reference into the prism context, not freed here */
1449
1633
 
1450
1634
  ast_free_base_node(&erb_yield_node->base, allocator);
1451
1635
  }
@@ -1467,6 +1651,617 @@ static void ast_free_erb_in_node(AST_ERB_IN_NODE_T* erb_in_node, hb_allocator_T*
1467
1651
  ast_free_base_node(&erb_in_node->base, allocator);
1468
1652
  }
1469
1653
 
1654
+ static void ast_free_herb_directive_node(AST_HERB_DIRECTIVE_NODE_T* herb_directive_node, hb_allocator_T* allocator) {
1655
+ if (herb_directive_node->tag_opening != NULL) { token_free(herb_directive_node->tag_opening, allocator); }
1656
+ if (herb_directive_node->content != NULL) { token_free(herb_directive_node->content, allocator); }
1657
+ if (herb_directive_node->tag_closing != NULL) { token_free(herb_directive_node->tag_closing, allocator); }
1658
+ if (herb_directive_node->key != NULL) { token_free(herb_directive_node->key, allocator); }
1659
+ if (herb_directive_node->arguments != NULL) { token_free(herb_directive_node->arguments, allocator); }
1660
+
1661
+ ast_free_base_node(&herb_directive_node->base, allocator);
1662
+ }
1663
+
1664
+ static void ast_free_herb_state_declaration_node(AST_HERB_STATE_DECLARATION_NODE_T* herb_state_declaration_node, hb_allocator_T* allocator) {
1665
+ if (herb_state_declaration_node->name != NULL) { token_free(herb_state_declaration_node->name, allocator); }
1666
+ ast_node_free((AST_NODE_T*) herb_state_declaration_node->default_value, allocator);
1667
+ if (!hb_string_is_empty(herb_state_declaration_node->kind)) { hb_allocator_dealloc(allocator, herb_state_declaration_node->kind.data); }
1668
+
1669
+ ast_free_base_node(&herb_state_declaration_node->base, allocator);
1670
+ }
1671
+
1672
+ static void ast_free_herb_state_directive_node(AST_HERB_STATE_DIRECTIVE_NODE_T* herb_state_directive_node, hb_allocator_T* allocator) {
1673
+ if (herb_state_directive_node->tag_opening != NULL) { token_free(herb_state_directive_node->tag_opening, allocator); }
1674
+ if (herb_state_directive_node->content != NULL) { token_free(herb_state_directive_node->content, allocator); }
1675
+ if (herb_state_directive_node->tag_closing != NULL) { token_free(herb_state_directive_node->tag_closing, allocator); }
1676
+ if (herb_state_directive_node->key != NULL) { token_free(herb_state_directive_node->key, allocator); }
1677
+ if (herb_state_directive_node->signature != NULL) { token_free(herb_state_directive_node->signature, allocator); }
1678
+ if (herb_state_directive_node->states != NULL) {
1679
+ for (size_t i = 0; i < hb_array_size(herb_state_directive_node->states); i++) {
1680
+ AST_NODE_T* child = hb_array_get(herb_state_directive_node->states, i);
1681
+ if (child) { ast_node_free(child, allocator); }
1682
+ }
1683
+
1684
+ hb_array_free(&herb_state_directive_node->states);
1685
+ }
1686
+
1687
+ ast_free_base_node(&herb_state_directive_node->base, allocator);
1688
+ }
1689
+
1690
+ static void ast_free_erb_comment_node(AST_ERB_COMMENT_NODE_T* erb_comment_node, hb_allocator_T* allocator) {
1691
+ if (erb_comment_node->tag_opening != NULL) { token_free(erb_comment_node->tag_opening, allocator); }
1692
+ if (erb_comment_node->content != NULL) { token_free(erb_comment_node->content, allocator); }
1693
+ if (erb_comment_node->tag_closing != NULL) { token_free(erb_comment_node->tag_closing, allocator); }
1694
+
1695
+ ast_free_base_node(&erb_comment_node->base, allocator);
1696
+ }
1697
+
1698
+ static void ast_rebase_token(token_T* token, const char* from, const char* to, size_t length) {
1699
+ if (token == NULL || token->value.data == NULL) { return; }
1700
+ if (token->value.data < from || token->value.data >= from + length) { return; }
1701
+
1702
+ token->value.data = (char*) to + (token->value.data - from);
1703
+ }
1704
+
1705
+ void ast_node_rebase_tokens(AST_NODE_T* node, const char* from, const char* to, size_t length) {
1706
+ if (!node) { return; }
1707
+
1708
+ switch (node->type) {
1709
+ case AST_DOCUMENT_NODE: {
1710
+ AST_DOCUMENT_NODE_T* typed = (AST_DOCUMENT_NODE_T*) node;
1711
+ if (typed->children != NULL) {
1712
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1713
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1714
+ }
1715
+ }
1716
+ break;
1717
+ }
1718
+ case AST_LITERAL_NODE: {
1719
+ break;
1720
+ }
1721
+ case AST_HTML_OPEN_TAG_NODE: {
1722
+ AST_HTML_OPEN_TAG_NODE_T* typed = (AST_HTML_OPEN_TAG_NODE_T*) node;
1723
+ ast_rebase_token(typed->tag_opening, from, to, length);
1724
+ ast_rebase_token(typed->tag_name, from, to, length);
1725
+ ast_rebase_token(typed->tag_closing, from, to, length);
1726
+ if (typed->children != NULL) {
1727
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1728
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1729
+ }
1730
+ }
1731
+ break;
1732
+ }
1733
+ case AST_HTML_CONDITIONAL_OPEN_TAG_NODE: {
1734
+ AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* typed = (AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T*) node;
1735
+ ast_node_rebase_tokens((AST_NODE_T*) typed->conditional, from, to, length);
1736
+ ast_rebase_token(typed->tag_name, from, to, length);
1737
+ break;
1738
+ }
1739
+ case AST_HTML_CLOSE_TAG_NODE: {
1740
+ AST_HTML_CLOSE_TAG_NODE_T* typed = (AST_HTML_CLOSE_TAG_NODE_T*) node;
1741
+ ast_rebase_token(typed->tag_opening, from, to, length);
1742
+ ast_rebase_token(typed->tag_name, from, to, length);
1743
+ if (typed->children != NULL) {
1744
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1745
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1746
+ }
1747
+ }
1748
+ ast_rebase_token(typed->tag_closing, from, to, length);
1749
+ break;
1750
+ }
1751
+ case AST_HTML_OMITTED_CLOSE_TAG_NODE: {
1752
+ AST_HTML_OMITTED_CLOSE_TAG_NODE_T* typed = (AST_HTML_OMITTED_CLOSE_TAG_NODE_T*) node;
1753
+ ast_rebase_token(typed->tag_name, from, to, length);
1754
+ break;
1755
+ }
1756
+ case AST_HTML_VIRTUAL_CLOSE_TAG_NODE: {
1757
+ AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T* typed = (AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T*) node;
1758
+ ast_rebase_token(typed->tag_name, from, to, length);
1759
+ break;
1760
+ }
1761
+ case AST_HTML_ELEMENT_NODE: {
1762
+ AST_HTML_ELEMENT_NODE_T* typed = (AST_HTML_ELEMENT_NODE_T*) node;
1763
+ ast_node_rebase_tokens((AST_NODE_T*) typed->open_tag, from, to, length);
1764
+ ast_rebase_token(typed->tag_name, from, to, length);
1765
+ if (typed->body != NULL) {
1766
+ for (size_t i = 0; i < hb_array_size(typed->body); i++) {
1767
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->body, i), from, to, length);
1768
+ }
1769
+ }
1770
+ ast_node_rebase_tokens((AST_NODE_T*) typed->close_tag, from, to, length);
1771
+ break;
1772
+ }
1773
+ case AST_HTML_CONDITIONAL_ELEMENT_NODE: {
1774
+ AST_HTML_CONDITIONAL_ELEMENT_NODE_T* typed = (AST_HTML_CONDITIONAL_ELEMENT_NODE_T*) node;
1775
+ ast_node_rebase_tokens((AST_NODE_T*) typed->open_conditional, from, to, length);
1776
+ if (typed->body != NULL) {
1777
+ for (size_t i = 0; i < hb_array_size(typed->body); i++) {
1778
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->body, i), from, to, length);
1779
+ }
1780
+ }
1781
+ ast_node_rebase_tokens((AST_NODE_T*) typed->close_conditional, from, to, length);
1782
+ ast_rebase_token(typed->tag_name, from, to, length);
1783
+ break;
1784
+ }
1785
+ case AST_HTML_ATTRIBUTE_VALUE_NODE: {
1786
+ AST_HTML_ATTRIBUTE_VALUE_NODE_T* typed = (AST_HTML_ATTRIBUTE_VALUE_NODE_T*) node;
1787
+ ast_rebase_token(typed->open_quote, from, to, length);
1788
+ if (typed->children != NULL) {
1789
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1790
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1791
+ }
1792
+ }
1793
+ ast_rebase_token(typed->close_quote, from, to, length);
1794
+ break;
1795
+ }
1796
+ case AST_HTML_ATTRIBUTE_NAME_NODE: {
1797
+ AST_HTML_ATTRIBUTE_NAME_NODE_T* typed = (AST_HTML_ATTRIBUTE_NAME_NODE_T*) node;
1798
+ if (typed->children != NULL) {
1799
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1800
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1801
+ }
1802
+ }
1803
+ break;
1804
+ }
1805
+ case AST_HTML_ATTRIBUTE_NODE: {
1806
+ AST_HTML_ATTRIBUTE_NODE_T* typed = (AST_HTML_ATTRIBUTE_NODE_T*) node;
1807
+ ast_node_rebase_tokens((AST_NODE_T*) typed->name, from, to, length);
1808
+ ast_rebase_token(typed->equals, from, to, length);
1809
+ ast_node_rebase_tokens((AST_NODE_T*) typed->value, from, to, length);
1810
+ break;
1811
+ }
1812
+ case AST_RUBY_LITERAL_NODE: {
1813
+ break;
1814
+ }
1815
+ case AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE: {
1816
+ break;
1817
+ }
1818
+ case AST_ERB_OPEN_TAG_NODE: {
1819
+ AST_ERB_OPEN_TAG_NODE_T* typed = (AST_ERB_OPEN_TAG_NODE_T*) node;
1820
+ ast_rebase_token(typed->tag_opening, from, to, length);
1821
+ ast_rebase_token(typed->content, from, to, length);
1822
+ ast_rebase_token(typed->tag_closing, from, to, length);
1823
+ ast_rebase_token(typed->tag_name, from, to, length);
1824
+ if (typed->children != NULL) {
1825
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1826
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1827
+ }
1828
+ }
1829
+ break;
1830
+ }
1831
+ case AST_HTML_TEXT_NODE: {
1832
+ break;
1833
+ }
1834
+ case AST_HTML_COMMENT_NODE: {
1835
+ AST_HTML_COMMENT_NODE_T* typed = (AST_HTML_COMMENT_NODE_T*) node;
1836
+ ast_rebase_token(typed->comment_start, from, to, length);
1837
+ if (typed->children != NULL) {
1838
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1839
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1840
+ }
1841
+ }
1842
+ ast_rebase_token(typed->comment_end, from, to, length);
1843
+ break;
1844
+ }
1845
+ case AST_HTML_DOCTYPE_NODE: {
1846
+ AST_HTML_DOCTYPE_NODE_T* typed = (AST_HTML_DOCTYPE_NODE_T*) node;
1847
+ ast_rebase_token(typed->tag_opening, from, to, length);
1848
+ if (typed->children != NULL) {
1849
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1850
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1851
+ }
1852
+ }
1853
+ ast_rebase_token(typed->tag_closing, from, to, length);
1854
+ break;
1855
+ }
1856
+ case AST_XML_DECLARATION_NODE: {
1857
+ AST_XML_DECLARATION_NODE_T* typed = (AST_XML_DECLARATION_NODE_T*) node;
1858
+ ast_rebase_token(typed->tag_opening, from, to, length);
1859
+ if (typed->children != NULL) {
1860
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1861
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1862
+ }
1863
+ }
1864
+ ast_rebase_token(typed->tag_closing, from, to, length);
1865
+ break;
1866
+ }
1867
+ case AST_XML_PROCESSING_INSTRUCTION_NODE: {
1868
+ AST_XML_PROCESSING_INSTRUCTION_NODE_T* typed = (AST_XML_PROCESSING_INSTRUCTION_NODE_T*) node;
1869
+ ast_rebase_token(typed->tag_opening, from, to, length);
1870
+ ast_rebase_token(typed->target, from, to, length);
1871
+ if (typed->children != NULL) {
1872
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1873
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1874
+ }
1875
+ }
1876
+ ast_rebase_token(typed->tag_closing, from, to, length);
1877
+ break;
1878
+ }
1879
+ case AST_CDATA_NODE: {
1880
+ AST_CDATA_NODE_T* typed = (AST_CDATA_NODE_T*) node;
1881
+ ast_rebase_token(typed->tag_opening, from, to, length);
1882
+ if (typed->children != NULL) {
1883
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1884
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1885
+ }
1886
+ }
1887
+ ast_rebase_token(typed->tag_closing, from, to, length);
1888
+ break;
1889
+ }
1890
+ case AST_WHITESPACE_NODE: {
1891
+ AST_WHITESPACE_NODE_T* typed = (AST_WHITESPACE_NODE_T*) node;
1892
+ ast_rebase_token(typed->value, from, to, length);
1893
+ break;
1894
+ }
1895
+ case AST_ERB_CONTENT_NODE: {
1896
+ AST_ERB_CONTENT_NODE_T* typed = (AST_ERB_CONTENT_NODE_T*) node;
1897
+ ast_rebase_token(typed->tag_opening, from, to, length);
1898
+ ast_rebase_token(typed->content, from, to, length);
1899
+ ast_rebase_token(typed->tag_closing, from, to, length);
1900
+ break;
1901
+ }
1902
+ case AST_ERB_END_NODE: {
1903
+ AST_ERB_END_NODE_T* typed = (AST_ERB_END_NODE_T*) node;
1904
+ ast_rebase_token(typed->tag_opening, from, to, length);
1905
+ ast_rebase_token(typed->content, from, to, length);
1906
+ ast_rebase_token(typed->tag_closing, from, to, length);
1907
+ break;
1908
+ }
1909
+ case AST_ERB_ELSE_NODE: {
1910
+ AST_ERB_ELSE_NODE_T* typed = (AST_ERB_ELSE_NODE_T*) node;
1911
+ ast_rebase_token(typed->tag_opening, from, to, length);
1912
+ ast_rebase_token(typed->content, from, to, length);
1913
+ ast_rebase_token(typed->tag_closing, from, to, length);
1914
+ if (typed->statements != NULL) {
1915
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
1916
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
1917
+ }
1918
+ }
1919
+ break;
1920
+ }
1921
+ case AST_ERB_IF_NODE: {
1922
+ AST_ERB_IF_NODE_T* typed = (AST_ERB_IF_NODE_T*) node;
1923
+ ast_rebase_token(typed->tag_opening, from, to, length);
1924
+ ast_rebase_token(typed->content, from, to, length);
1925
+ ast_rebase_token(typed->tag_closing, from, to, length);
1926
+ if (typed->statements != NULL) {
1927
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
1928
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
1929
+ }
1930
+ }
1931
+ ast_node_rebase_tokens((AST_NODE_T*) typed->subsequent, from, to, length);
1932
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
1933
+ break;
1934
+ }
1935
+ case AST_ERB_BLOCK_NODE: {
1936
+ AST_ERB_BLOCK_NODE_T* typed = (AST_ERB_BLOCK_NODE_T*) node;
1937
+ ast_rebase_token(typed->tag_opening, from, to, length);
1938
+ ast_rebase_token(typed->content, from, to, length);
1939
+ ast_rebase_token(typed->tag_closing, from, to, length);
1940
+ if (typed->body != NULL) {
1941
+ for (size_t i = 0; i < hb_array_size(typed->body); i++) {
1942
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->body, i), from, to, length);
1943
+ }
1944
+ }
1945
+ if (typed->block_arguments != NULL) {
1946
+ for (size_t i = 0; i < hb_array_size(typed->block_arguments); i++) {
1947
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->block_arguments, i), from, to, length);
1948
+ }
1949
+ }
1950
+ ast_node_rebase_tokens((AST_NODE_T*) typed->rescue_clause, from, to, length);
1951
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
1952
+ ast_node_rebase_tokens((AST_NODE_T*) typed->ensure_clause, from, to, length);
1953
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
1954
+ break;
1955
+ }
1956
+ case AST_ERB_ITERATION_BLOCK_NODE: {
1957
+ AST_ERB_ITERATION_BLOCK_NODE_T* typed = (AST_ERB_ITERATION_BLOCK_NODE_T*) node;
1958
+ ast_rebase_token(typed->tag_opening, from, to, length);
1959
+ ast_rebase_token(typed->content, from, to, length);
1960
+ ast_rebase_token(typed->tag_closing, from, to, length);
1961
+ ast_rebase_token(typed->receiver, from, to, length);
1962
+ ast_rebase_token(typed->call_operator, from, to, length);
1963
+ ast_rebase_token(typed->message, from, to, length);
1964
+ if (typed->arguments != NULL) {
1965
+ for (size_t i = 0; i < hb_array_size(typed->arguments); i++) {
1966
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->arguments, i), from, to, length);
1967
+ }
1968
+ }
1969
+ ast_rebase_token(typed->block_opening, from, to, length);
1970
+ if (typed->body != NULL) {
1971
+ for (size_t i = 0; i < hb_array_size(typed->body); i++) {
1972
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->body, i), from, to, length);
1973
+ }
1974
+ }
1975
+ if (typed->block_arguments != NULL) {
1976
+ for (size_t i = 0; i < hb_array_size(typed->block_arguments); i++) {
1977
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->block_arguments, i), from, to, length);
1978
+ }
1979
+ }
1980
+ ast_node_rebase_tokens((AST_NODE_T*) typed->rescue_clause, from, to, length);
1981
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
1982
+ ast_node_rebase_tokens((AST_NODE_T*) typed->ensure_clause, from, to, length);
1983
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
1984
+ break;
1985
+ }
1986
+ case AST_ERB_WHEN_NODE: {
1987
+ AST_ERB_WHEN_NODE_T* typed = (AST_ERB_WHEN_NODE_T*) node;
1988
+ ast_rebase_token(typed->tag_opening, from, to, length);
1989
+ ast_rebase_token(typed->content, from, to, length);
1990
+ ast_rebase_token(typed->tag_closing, from, to, length);
1991
+ if (typed->statements != NULL) {
1992
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
1993
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
1994
+ }
1995
+ }
1996
+ break;
1997
+ }
1998
+ case AST_ERB_CASE_NODE: {
1999
+ AST_ERB_CASE_NODE_T* typed = (AST_ERB_CASE_NODE_T*) node;
2000
+ ast_rebase_token(typed->tag_opening, from, to, length);
2001
+ ast_rebase_token(typed->content, from, to, length);
2002
+ ast_rebase_token(typed->tag_closing, from, to, length);
2003
+ if (typed->children != NULL) {
2004
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
2005
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
2006
+ }
2007
+ }
2008
+ if (typed->conditions != NULL) {
2009
+ for (size_t i = 0; i < hb_array_size(typed->conditions); i++) {
2010
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->conditions, i), from, to, length);
2011
+ }
2012
+ }
2013
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
2014
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2015
+ break;
2016
+ }
2017
+ case AST_ERB_CASE_MATCH_NODE: {
2018
+ AST_ERB_CASE_MATCH_NODE_T* typed = (AST_ERB_CASE_MATCH_NODE_T*) node;
2019
+ ast_rebase_token(typed->tag_opening, from, to, length);
2020
+ ast_rebase_token(typed->content, from, to, length);
2021
+ ast_rebase_token(typed->tag_closing, from, to, length);
2022
+ if (typed->children != NULL) {
2023
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
2024
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
2025
+ }
2026
+ }
2027
+ if (typed->conditions != NULL) {
2028
+ for (size_t i = 0; i < hb_array_size(typed->conditions); i++) {
2029
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->conditions, i), from, to, length);
2030
+ }
2031
+ }
2032
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
2033
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2034
+ break;
2035
+ }
2036
+ case AST_ERB_WHILE_NODE: {
2037
+ AST_ERB_WHILE_NODE_T* typed = (AST_ERB_WHILE_NODE_T*) node;
2038
+ ast_rebase_token(typed->tag_opening, from, to, length);
2039
+ ast_rebase_token(typed->content, from, to, length);
2040
+ ast_rebase_token(typed->tag_closing, from, to, length);
2041
+ if (typed->statements != NULL) {
2042
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2043
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2044
+ }
2045
+ }
2046
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2047
+ break;
2048
+ }
2049
+ case AST_ERB_UNTIL_NODE: {
2050
+ AST_ERB_UNTIL_NODE_T* typed = (AST_ERB_UNTIL_NODE_T*) node;
2051
+ ast_rebase_token(typed->tag_opening, from, to, length);
2052
+ ast_rebase_token(typed->content, from, to, length);
2053
+ ast_rebase_token(typed->tag_closing, from, to, length);
2054
+ if (typed->statements != NULL) {
2055
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2056
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2057
+ }
2058
+ }
2059
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2060
+ break;
2061
+ }
2062
+ case AST_ERB_FOR_NODE: {
2063
+ AST_ERB_FOR_NODE_T* typed = (AST_ERB_FOR_NODE_T*) node;
2064
+ ast_rebase_token(typed->tag_opening, from, to, length);
2065
+ ast_rebase_token(typed->content, from, to, length);
2066
+ ast_rebase_token(typed->tag_closing, from, to, length);
2067
+ if (typed->statements != NULL) {
2068
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2069
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2070
+ }
2071
+ }
2072
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2073
+ break;
2074
+ }
2075
+ case AST_ERB_RESCUE_NODE: {
2076
+ AST_ERB_RESCUE_NODE_T* typed = (AST_ERB_RESCUE_NODE_T*) node;
2077
+ ast_rebase_token(typed->tag_opening, from, to, length);
2078
+ ast_rebase_token(typed->content, from, to, length);
2079
+ ast_rebase_token(typed->tag_closing, from, to, length);
2080
+ if (typed->statements != NULL) {
2081
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2082
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2083
+ }
2084
+ }
2085
+ ast_node_rebase_tokens((AST_NODE_T*) typed->subsequent, from, to, length);
2086
+ break;
2087
+ }
2088
+ case AST_ERB_ENSURE_NODE: {
2089
+ AST_ERB_ENSURE_NODE_T* typed = (AST_ERB_ENSURE_NODE_T*) node;
2090
+ ast_rebase_token(typed->tag_opening, from, to, length);
2091
+ ast_rebase_token(typed->content, from, to, length);
2092
+ ast_rebase_token(typed->tag_closing, from, to, length);
2093
+ if (typed->statements != NULL) {
2094
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2095
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2096
+ }
2097
+ }
2098
+ break;
2099
+ }
2100
+ case AST_ERB_BEGIN_NODE: {
2101
+ AST_ERB_BEGIN_NODE_T* typed = (AST_ERB_BEGIN_NODE_T*) node;
2102
+ ast_rebase_token(typed->tag_opening, from, to, length);
2103
+ ast_rebase_token(typed->content, from, to, length);
2104
+ ast_rebase_token(typed->tag_closing, from, to, length);
2105
+ if (typed->statements != NULL) {
2106
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2107
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2108
+ }
2109
+ }
2110
+ ast_node_rebase_tokens((AST_NODE_T*) typed->rescue_clause, from, to, length);
2111
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
2112
+ ast_node_rebase_tokens((AST_NODE_T*) typed->ensure_clause, from, to, length);
2113
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2114
+ break;
2115
+ }
2116
+ case AST_ERB_UNLESS_NODE: {
2117
+ AST_ERB_UNLESS_NODE_T* typed = (AST_ERB_UNLESS_NODE_T*) node;
2118
+ ast_rebase_token(typed->tag_opening, from, to, length);
2119
+ ast_rebase_token(typed->content, from, to, length);
2120
+ ast_rebase_token(typed->tag_closing, from, to, length);
2121
+ if (typed->statements != NULL) {
2122
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2123
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2124
+ }
2125
+ }
2126
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
2127
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2128
+ break;
2129
+ }
2130
+ case AST_RUBY_RENDER_LOCAL_NODE: {
2131
+ AST_RUBY_RENDER_LOCAL_NODE_T* typed = (AST_RUBY_RENDER_LOCAL_NODE_T*) node;
2132
+ ast_rebase_token(typed->name, from, to, length);
2133
+ ast_node_rebase_tokens((AST_NODE_T*) typed->value, from, to, length);
2134
+ break;
2135
+ }
2136
+ case AST_RUBY_RENDER_KEYWORDS_NODE: {
2137
+ AST_RUBY_RENDER_KEYWORDS_NODE_T* typed = (AST_RUBY_RENDER_KEYWORDS_NODE_T*) node;
2138
+ ast_rebase_token(typed->partial, from, to, length);
2139
+ ast_rebase_token(typed->template_path, from, to, length);
2140
+ ast_rebase_token(typed->layout, from, to, length);
2141
+ ast_rebase_token(typed->file, from, to, length);
2142
+ ast_rebase_token(typed->inline_template, from, to, length);
2143
+ ast_rebase_token(typed->body, from, to, length);
2144
+ ast_rebase_token(typed->plain, from, to, length);
2145
+ ast_rebase_token(typed->html, from, to, length);
2146
+ ast_rebase_token(typed->renderable, from, to, length);
2147
+ ast_rebase_token(typed->collection, from, to, length);
2148
+ ast_rebase_token(typed->object, from, to, length);
2149
+ ast_rebase_token(typed->as_name, from, to, length);
2150
+ ast_rebase_token(typed->spacer_template, from, to, length);
2151
+ ast_rebase_token(typed->formats, from, to, length);
2152
+ ast_rebase_token(typed->variants, from, to, length);
2153
+ ast_rebase_token(typed->handlers, from, to, length);
2154
+ ast_rebase_token(typed->content_type, from, to, length);
2155
+ if (typed->locals != NULL) {
2156
+ for (size_t i = 0; i < hb_array_size(typed->locals); i++) {
2157
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->locals, i), from, to, length);
2158
+ }
2159
+ }
2160
+ if (typed->state != NULL) {
2161
+ for (size_t i = 0; i < hb_array_size(typed->state); i++) {
2162
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->state, i), from, to, length);
2163
+ }
2164
+ }
2165
+ break;
2166
+ }
2167
+ case AST_ERB_RENDER_NODE: {
2168
+ AST_ERB_RENDER_NODE_T* typed = (AST_ERB_RENDER_NODE_T*) node;
2169
+ ast_rebase_token(typed->tag_opening, from, to, length);
2170
+ ast_rebase_token(typed->content, from, to, length);
2171
+ ast_rebase_token(typed->tag_closing, from, to, length);
2172
+ ast_node_rebase_tokens((AST_NODE_T*) typed->keywords, from, to, length);
2173
+ if (typed->body != NULL) {
2174
+ for (size_t i = 0; i < hb_array_size(typed->body); i++) {
2175
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->body, i), from, to, length);
2176
+ }
2177
+ }
2178
+ if (typed->block_arguments != NULL) {
2179
+ for (size_t i = 0; i < hb_array_size(typed->block_arguments); i++) {
2180
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->block_arguments, i), from, to, length);
2181
+ }
2182
+ }
2183
+ ast_node_rebase_tokens((AST_NODE_T*) typed->rescue_clause, from, to, length);
2184
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
2185
+ ast_node_rebase_tokens((AST_NODE_T*) typed->ensure_clause, from, to, length);
2186
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2187
+ break;
2188
+ }
2189
+ case AST_RUBY_PARAMETER_NODE: {
2190
+ AST_RUBY_PARAMETER_NODE_T* typed = (AST_RUBY_PARAMETER_NODE_T*) node;
2191
+ ast_rebase_token(typed->name, from, to, length);
2192
+ ast_node_rebase_tokens((AST_NODE_T*) typed->default_value, from, to, length);
2193
+ break;
2194
+ }
2195
+ case AST_ERB_STRICT_LOCALS_NODE: {
2196
+ AST_ERB_STRICT_LOCALS_NODE_T* typed = (AST_ERB_STRICT_LOCALS_NODE_T*) node;
2197
+ ast_rebase_token(typed->tag_opening, from, to, length);
2198
+ ast_rebase_token(typed->content, from, to, length);
2199
+ ast_rebase_token(typed->tag_closing, from, to, length);
2200
+ if (typed->locals != NULL) {
2201
+ for (size_t i = 0; i < hb_array_size(typed->locals); i++) {
2202
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->locals, i), from, to, length);
2203
+ }
2204
+ }
2205
+ break;
2206
+ }
2207
+ case AST_ERB_YIELD_NODE: {
2208
+ AST_ERB_YIELD_NODE_T* typed = (AST_ERB_YIELD_NODE_T*) node;
2209
+ ast_rebase_token(typed->tag_opening, from, to, length);
2210
+ ast_rebase_token(typed->content, from, to, length);
2211
+ ast_rebase_token(typed->tag_closing, from, to, length);
2212
+ break;
2213
+ }
2214
+ case AST_ERB_IN_NODE: {
2215
+ AST_ERB_IN_NODE_T* typed = (AST_ERB_IN_NODE_T*) node;
2216
+ ast_rebase_token(typed->tag_opening, from, to, length);
2217
+ ast_rebase_token(typed->content, from, to, length);
2218
+ ast_rebase_token(typed->tag_closing, from, to, length);
2219
+ if (typed->statements != NULL) {
2220
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2221
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2222
+ }
2223
+ }
2224
+ break;
2225
+ }
2226
+ case AST_HERB_DIRECTIVE_NODE: {
2227
+ AST_HERB_DIRECTIVE_NODE_T* typed = (AST_HERB_DIRECTIVE_NODE_T*) node;
2228
+ ast_rebase_token(typed->tag_opening, from, to, length);
2229
+ ast_rebase_token(typed->content, from, to, length);
2230
+ ast_rebase_token(typed->tag_closing, from, to, length);
2231
+ ast_rebase_token(typed->key, from, to, length);
2232
+ ast_rebase_token(typed->arguments, from, to, length);
2233
+ break;
2234
+ }
2235
+ case AST_HERB_STATE_DECLARATION_NODE: {
2236
+ AST_HERB_STATE_DECLARATION_NODE_T* typed = (AST_HERB_STATE_DECLARATION_NODE_T*) node;
2237
+ ast_rebase_token(typed->name, from, to, length);
2238
+ ast_node_rebase_tokens((AST_NODE_T*) typed->default_value, from, to, length);
2239
+ break;
2240
+ }
2241
+ case AST_HERB_STATE_DIRECTIVE_NODE: {
2242
+ AST_HERB_STATE_DIRECTIVE_NODE_T* typed = (AST_HERB_STATE_DIRECTIVE_NODE_T*) node;
2243
+ ast_rebase_token(typed->tag_opening, from, to, length);
2244
+ ast_rebase_token(typed->content, from, to, length);
2245
+ ast_rebase_token(typed->tag_closing, from, to, length);
2246
+ ast_rebase_token(typed->key, from, to, length);
2247
+ ast_rebase_token(typed->signature, from, to, length);
2248
+ if (typed->states != NULL) {
2249
+ for (size_t i = 0; i < hb_array_size(typed->states); i++) {
2250
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->states, i), from, to, length);
2251
+ }
2252
+ }
2253
+ break;
2254
+ }
2255
+ case AST_ERB_COMMENT_NODE: {
2256
+ AST_ERB_COMMENT_NODE_T* typed = (AST_ERB_COMMENT_NODE_T*) node;
2257
+ ast_rebase_token(typed->tag_opening, from, to, length);
2258
+ ast_rebase_token(typed->content, from, to, length);
2259
+ ast_rebase_token(typed->tag_closing, from, to, length);
2260
+ break;
2261
+ }
2262
+ }
2263
+ }
2264
+
1470
2265
  void ast_node_free(AST_NODE_T* node, hb_allocator_T* allocator) {
1471
2266
  if (!node) { return; }
1472
2267
 
@@ -1490,6 +2285,7 @@ void ast_node_free(AST_NODE_T* node, hb_allocator_T* allocator) {
1490
2285
  case AST_HTML_COMMENT_NODE: ast_free_html_comment_node((AST_HTML_COMMENT_NODE_T*) node, allocator); break;
1491
2286
  case AST_HTML_DOCTYPE_NODE: ast_free_html_doctype_node((AST_HTML_DOCTYPE_NODE_T*) node, allocator); break;
1492
2287
  case AST_XML_DECLARATION_NODE: ast_free_xml_declaration_node((AST_XML_DECLARATION_NODE_T*) node, allocator); break;
2288
+ case AST_XML_PROCESSING_INSTRUCTION_NODE: ast_free_xml_processing_instruction_node((AST_XML_PROCESSING_INSTRUCTION_NODE_T*) node, allocator); break;
1493
2289
  case AST_CDATA_NODE: ast_free_cdata_node((AST_CDATA_NODE_T*) node, allocator); break;
1494
2290
  case AST_WHITESPACE_NODE: ast_free_whitespace_node((AST_WHITESPACE_NODE_T*) node, allocator); break;
1495
2291
  case AST_ERB_CONTENT_NODE: ast_free_erb_content_node((AST_ERB_CONTENT_NODE_T*) node, allocator); break;
@@ -1497,6 +2293,7 @@ void ast_node_free(AST_NODE_T* node, hb_allocator_T* allocator) {
1497
2293
  case AST_ERB_ELSE_NODE: ast_free_erb_else_node((AST_ERB_ELSE_NODE_T*) node, allocator); break;
1498
2294
  case AST_ERB_IF_NODE: ast_free_erb_if_node((AST_ERB_IF_NODE_T*) node, allocator); break;
1499
2295
  case AST_ERB_BLOCK_NODE: ast_free_erb_block_node((AST_ERB_BLOCK_NODE_T*) node, allocator); break;
2296
+ case AST_ERB_ITERATION_BLOCK_NODE: ast_free_erb_iteration_block_node((AST_ERB_ITERATION_BLOCK_NODE_T*) node, allocator); break;
1500
2297
  case AST_ERB_WHEN_NODE: ast_free_erb_when_node((AST_ERB_WHEN_NODE_T*) node, allocator); break;
1501
2298
  case AST_ERB_CASE_NODE: ast_free_erb_case_node((AST_ERB_CASE_NODE_T*) node, allocator); break;
1502
2299
  case AST_ERB_CASE_MATCH_NODE: ast_free_erb_case_match_node((AST_ERB_CASE_MATCH_NODE_T*) node, allocator); break;
@@ -1514,5 +2311,9 @@ void ast_node_free(AST_NODE_T* node, hb_allocator_T* allocator) {
1514
2311
  case AST_ERB_STRICT_LOCALS_NODE: ast_free_erb_strict_locals_node((AST_ERB_STRICT_LOCALS_NODE_T*) node, allocator); break;
1515
2312
  case AST_ERB_YIELD_NODE: ast_free_erb_yield_node((AST_ERB_YIELD_NODE_T*) node, allocator); break;
1516
2313
  case AST_ERB_IN_NODE: ast_free_erb_in_node((AST_ERB_IN_NODE_T*) node, allocator); break;
2314
+ case AST_HERB_DIRECTIVE_NODE: ast_free_herb_directive_node((AST_HERB_DIRECTIVE_NODE_T*) node, allocator); break;
2315
+ case AST_HERB_STATE_DECLARATION_NODE: ast_free_herb_state_declaration_node((AST_HERB_STATE_DECLARATION_NODE_T*) node, allocator); break;
2316
+ case AST_HERB_STATE_DIRECTIVE_NODE: ast_free_herb_state_directive_node((AST_HERB_STATE_DIRECTIVE_NODE_T*) node, allocator); break;
2317
+ case AST_ERB_COMMENT_NODE: ast_free_erb_comment_node((AST_ERB_COMMENT_NODE_T*) node, allocator); break;
1517
2318
  }
1518
2319
  }