herb 0.10.3-x86-linux-gnu → 0.11.0-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 (788) 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 +1240 -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 +826 -358
  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 +1342 -105
  331. data/lib/herb/backend.rb +73 -0
  332. data/lib/herb/bootstrap.rb +3 -7
  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 +175 -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 +346 -108
  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 +854 -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 +128 -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 +1326 -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 +2256 -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 -257
  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 +31 -18
  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 +662 -89
  487. data/sig/herb/backend.rbs +52 -0
  488. data/sig/herb/colors.rbs +3 -0
  489. data/sig/herb/configuration.rbs +27 -3
  490. data/sig/herb/dev/assets.rbs +27 -0
  491. data/sig/herb/dev/classifier.rbs +57 -0
  492. data/sig/herb/dev/embedded.rbs +21 -0
  493. data/sig/herb/dev/pipeline.rbs +118 -0
  494. data/sig/herb/dev/protocol.rbs +78 -0
  495. data/sig/herb/dev/runner.rbs +61 -23
  496. data/sig/herb/dev/server.rbs +49 -22
  497. data/sig/herb/dev/server_entry.rbs +46 -21
  498. data/sig/herb/dev/watcher.rbs +84 -0
  499. data/sig/herb/dev.rbs +58 -0
  500. data/sig/herb/diagnostic/formatter.rbs +28 -0
  501. data/sig/herb/diagnostic.rbs +88 -0
  502. data/sig/herb/diff/operation.rbs +36 -0
  503. data/sig/herb/diff/result.rbs +36 -0
  504. data/sig/herb/diff.rbs +6 -0
  505. data/sig/herb/engine/collector.rbs +48 -0
  506. data/sig/herb/engine/compiler.rbs +62 -23
  507. data/sig/herb/engine/component_tags/constant_resolver.rbs +19 -0
  508. data/sig/herb/engine/component_tags/partial_resolver.rbs +30 -0
  509. data/sig/herb/engine/component_tags/resolver.rbs +25 -0
  510. data/sig/herb/engine/component_tags/visitor.rbs +69 -0
  511. data/sig/herb/engine/css_inliner/inliner.rbs +65 -0
  512. data/sig/herb/engine/css_inliner/visitor.rbs +87 -0
  513. data/sig/herb/engine/errors.rbs +68 -0
  514. data/sig/herb/engine/helpers.rbs +28 -0
  515. data/sig/herb/engine/inline_render/inliner.rbs +39 -0
  516. data/sig/herb/engine/inline_render/visitor.rbs +104 -0
  517. data/sig/herb/engine/runtime/entry.rbs +43 -0
  518. data/sig/herb/engine/runtime/error_page.rbs +115 -0
  519. data/sig/herb/engine/runtime/html_safe_assertions.rbs +99 -0
  520. data/sig/herb/engine/runtime/journal/summary.rbs +172 -0
  521. data/sig/herb/engine/runtime/journal.rbs +126 -0
  522. data/sig/herb/engine/runtime/middleware.rbs +96 -0
  523. data/sig/herb/engine/runtime/observations.rbs +38 -0
  524. data/sig/herb/engine/runtime/report.rbs +97 -0
  525. data/sig/herb/engine/runtime/session.rbs +233 -0
  526. data/sig/herb/engine/runtime.rbs +14 -0
  527. data/sig/herb/engine/scoped_style/channel.rbs +45 -0
  528. data/sig/herb/engine/scoped_style/collector.rbs +45 -0
  529. data/sig/herb/engine/scoped_style/visitor.rbs +220 -0
  530. data/sig/herb/engine/slots/annotation.rbs +72 -0
  531. data/sig/herb/engine/slots/bindings.rbs +34 -0
  532. data/sig/herb/engine/slots/callee.rbs +62 -0
  533. data/sig/herb/engine/slots/component_definitions.rbs +19 -0
  534. data/sig/herb/engine/slots/components/async.rbs +20 -0
  535. data/sig/herb/engine/slots/components/base.rbs +60 -0
  536. data/sig/herb/engine/slots/components/deferred.rbs +29 -0
  537. data/sig/herb/engine/slots/components/fallback.rbs +21 -0
  538. data/sig/herb/engine/slots/components/fragment.rbs +34 -0
  539. data/sig/herb/engine/slots/components/lazy.rbs +20 -0
  540. data/sig/herb/engine/slots/components.rbs +30 -0
  541. data/sig/herb/engine/slots/dependencies/channel.rbs +51 -0
  542. data/sig/herb/engine/slots/dependencies.rbs +94 -0
  543. data/sig/herb/engine/slots/dynamics_compiler.rbs +349 -0
  544. data/sig/herb/engine/slots/identifier.rbs +19 -0
  545. data/sig/herb/engine/slots/manifest/channel.rbs +49 -0
  546. data/sig/herb/engine/slots/manifest/collector.rbs +45 -0
  547. data/sig/herb/engine/slots/markers.rbs +85 -0
  548. data/sig/herb/engine/slots/render_bindings.rbs +69 -0
  549. data/sig/herb/engine/slots/schema_compiler.rbs +62 -0
  550. data/sig/herb/engine/slots/state_anchor.rbs +41 -0
  551. data/sig/herb/engine/slots/state_compiler.rbs +258 -0
  552. data/sig/herb/engine/slots/state_directives.rbs +278 -0
  553. data/sig/herb/engine/slots/state_kinds.rbs +24 -0
  554. data/sig/herb/engine/slots/state_operators.rbs +19 -0
  555. data/sig/herb/engine/slots/state_overrides.rbs +33 -0
  556. data/sig/herb/engine/slots/state_predicates.rbs +16 -0
  557. data/sig/herb/engine/slots/state_transforms.rbs +15 -0
  558. data/sig/herb/engine/slots/statics.rbs +67 -0
  559. data/sig/herb/engine/slots/subtree.rbs +49 -0
  560. data/sig/herb/engine/slots/subtree_compiler.rbs +130 -0
  561. data/sig/herb/engine/slots/types.rbs +46 -0
  562. data/sig/herb/engine/slots/visitor.rbs +599 -0
  563. data/sig/herb/engine/validators/accessibility_validator.rbs +1 -1
  564. data/sig/herb/engine/validators/base.rbs +28 -0
  565. data/sig/herb/engine/validators/generator_template_validator.rbs +19 -0
  566. data/sig/herb/engine/validators/nesting_validator.rbs +1 -1
  567. data/sig/herb/engine/validators/render_validator.rbs +2 -6
  568. data/sig/herb/engine/validators/security_validator.rbs +1 -3
  569. data/sig/herb/engine/validators.rbs +21 -0
  570. data/sig/herb/engine/visitors/auto_close_omitted_tags_visitor.rbs +26 -0
  571. data/sig/herb/engine/visitors/content_for_visitor.rbs +52 -0
  572. data/sig/herb/engine/{debug_visitor.rbs → visitors/debug_visitor.rbs} +26 -15
  573. data/sig/herb/engine/visitors/html_safe_assertions_visitor.rbs +100 -0
  574. data/sig/herb/engine/visitors/instrumentation_visitor.rbs +111 -0
  575. data/sig/herb/engine/visitors/optimize_visitor.rbs +246 -0
  576. data/sig/herb/engine/visitors/remove_comments_visitor.rbs +66 -0
  577. data/sig/herb/engine/visitors/source_attribution_visitor.rbs +90 -0
  578. data/sig/herb/engine.rbs +47 -41
  579. data/sig/herb/ensure_installed.rbs +9 -0
  580. data/sig/herb/errors.rbs +293 -0
  581. data/sig/herb/fingerprint.rbs +37 -0
  582. data/sig/herb/html/elements.rbs +19 -0
  583. data/sig/herb/html/util.rbs +15 -1
  584. data/sig/herb/lex_result.rbs +0 -6
  585. data/sig/herb/locate.rbs +89 -0
  586. data/sig/herb/location.rbs +12 -0
  587. data/sig/herb/parse_result.rbs +10 -8
  588. data/sig/herb/parser_options.rbs +47 -21
  589. data/sig/herb/position.rbs +11 -0
  590. data/sig/herb/range.rbs +3 -0
  591. data/sig/herb/ruby_program.rbs +51 -0
  592. data/sig/herb/source_path.rbs +132 -0
  593. data/sig/herb/token.rbs +5 -2
  594. data/sig/herb/visitor/context/origin.rbs +51 -0
  595. data/sig/herb/visitor/context/replacements.rbs +39 -0
  596. data/sig/herb/visitor/context.rbs +83 -0
  597. data/sig/herb/visitor/context_aware.rbs +32 -0
  598. data/sig/herb/visitor/diagnostics.rbs +82 -0
  599. data/sig/herb/visitor/experimental.rbs +23 -0
  600. data/sig/herb/visitor/parser_option_requirements.rbs +76 -0
  601. data/sig/herb/visitor/stack.rbs +91 -0
  602. data/sig/herb/visitor.rbs +22 -0
  603. data/sig/herb/warnings.rbs +10 -0
  604. data/sig/herb.rbs +27 -10
  605. data/sig/serialized_ast_errors.rbs +58 -1
  606. data/sig/serialized_ast_nodes.rbs +58 -2
  607. data/src/analyze/action_view/attribute_extraction_helpers.c +73 -36
  608. data/src/analyze/action_view/generated_handlers.c +37 -1
  609. data/src/analyze/action_view/generated_handlers.h +2 -1
  610. data/src/analyze/action_view/helper_registry.c +1353 -58
  611. data/src/analyze/action_view/registry.c +10 -17
  612. data/src/analyze/action_view/stylesheet_link_tag.c +40 -0
  613. data/src/analyze/action_view/tag_helper_node_builders.c +57 -0
  614. data/src/analyze/action_view/tag_helpers.c +423 -93
  615. data/src/analyze/analyze.c +301 -64
  616. data/src/analyze/analyze_helpers.c +420 -23
  617. data/src/analyze/builders.c +79 -51
  618. data/src/analyze/conditional_elements.c +13 -8
  619. data/src/analyze/conditional_open_tags.c +11 -5
  620. data/src/analyze/control_type.c +16 -1
  621. data/src/analyze/herb_directives.c +701 -0
  622. data/src/analyze/invalid_structures.c +11 -7
  623. data/src/analyze/iteration_nodes.c +306 -0
  624. data/src/analyze/missing_end.c +116 -32
  625. data/src/analyze/parse_errors.c +8 -3
  626. data/src/analyze/postfix_conditionals.c +98 -63
  627. data/src/analyze/prism_annotate.c +13 -4
  628. data/src/analyze/render_nodes.c +345 -123
  629. data/src/analyze/strict_locals.c +30 -26
  630. data/src/analyze/ternary_conditionals.c +95 -70
  631. data/src/analyze/transform.c +43 -1
  632. data/src/ast/ast_node.c +3 -13
  633. data/src/ast/ast_nodes.c +911 -112
  634. data/src/ast/ast_pretty_print.c +161 -2
  635. data/src/diff/herb_diff.c +8 -0
  636. data/src/diff/herb_diff_attributes.c +1 -0
  637. data/src/diff/herb_diff_children.c +4 -3
  638. data/src/diff/herb_diff_helpers.c +7 -1
  639. data/src/diff/herb_diff_nodes.c +186 -71
  640. data/src/diff/herb_hash_tree.c +99 -1
  641. data/src/errors.c +1096 -128
  642. data/src/extract.c +30 -8
  643. data/src/herb.c +30 -11
  644. data/src/include/analyze/action_view/attribute_extraction_helpers.h +1 -1
  645. data/src/include/analyze/action_view/helper_registry.h +28 -4
  646. data/src/include/analyze/action_view/tag_helper_handler.h +1 -1
  647. data/src/include/analyze/action_view/tag_helper_node_builders.h +7 -0
  648. data/src/include/analyze/analyze.h +11 -0
  649. data/src/include/analyze/builders.h +16 -0
  650. data/src/include/analyze/helpers.h +23 -2
  651. data/src/include/analyze/herb_directive_kinds.h +41 -0
  652. data/src/include/analyze/herb_directives.h +14 -0
  653. data/src/include/analyze/iteration_nodes.h +11 -0
  654. data/src/include/analyze/prism_annotate.h +3 -3
  655. data/src/include/analyze/ternary_conditionals.h +2 -0
  656. data/src/include/ast/ast_node.h +1 -5
  657. data/src/include/ast/ast_nodes.h +76 -2
  658. data/src/include/ast/ast_pretty_print.h +1 -1
  659. data/src/include/diff/herb_diff.h +11 -0
  660. data/src/include/errors.h +156 -39
  661. data/src/include/extract.h +11 -0
  662. data/src/include/herb.h +6 -0
  663. data/src/include/lexer/erb_openers.h +29 -0
  664. data/src/include/lexer/lexer_peek_helpers.h +8 -1
  665. data/src/include/lexer/lexer_struct.h +4 -0
  666. data/src/include/lexer/token.h +3 -0
  667. data/src/include/lexer/token_struct.h +8 -6
  668. data/src/include/lib/hb_allocator.h +2 -1
  669. data/src/include/lib/hb_array.h +2 -0
  670. data/src/include/lib/hb_foreach.h +1 -1
  671. data/src/include/lib/hb_string.h +7 -0
  672. data/src/include/parser/dot_notation.h +1 -1
  673. data/src/include/parser/foreign_content_elements.h +32 -0
  674. data/src/include/parser/parser.h +16 -30
  675. data/src/include/parser/parser_helpers.h +13 -11
  676. data/src/include/parser/parser_options.h +41 -0
  677. data/src/include/prism/ruby_parser.h +6 -0
  678. data/src/include/util/html_elements.h +85 -0
  679. data/src/include/util/html_util.h +1 -0
  680. data/src/include/version.h +1 -1
  681. data/src/lexer/lexer_peek_helpers.c +15 -1
  682. data/src/lexer/token.c +83 -1
  683. data/src/lexer.c +196 -12
  684. data/src/lib/hb_allocator.c +2 -0
  685. data/src/lib/hb_array.c +26 -0
  686. data/src/lib/hb_string.c +26 -0
  687. data/src/main.c +1 -1
  688. data/src/parser/dot_notation.c +4 -3
  689. data/src/parser/match_tags.c +66 -1
  690. data/src/parser/parser_helpers.c +69 -37
  691. data/src/parser.c +606 -383
  692. data/src/parser_options_defaults.c +30 -0
  693. data/src/prism/prism_helpers.c +3 -0
  694. data/src/prism/ruby_parser.c +49 -0
  695. data/src/util/html_util.c +11 -58
  696. data/src/visitor.c +77 -1
  697. data/templates/ext/herb/error_helpers.c.erb +1 -1
  698. data/templates/ext/herb/nodes.c.erb +18 -13
  699. data/templates/ext/herb/nodes.h.erb +2 -1
  700. data/templates/ext/herb/parser_options_helpers.c.erb +69 -0
  701. data/templates/ext/herb/parser_options_helpers.h.erb +11 -0
  702. data/templates/java/nodes.c.erb +20 -16
  703. data/templates/java/nodes.h.erb +3 -2
  704. data/templates/java/org/herb/ParserOptions.java.erb +24 -0
  705. data/templates/java/org/herb/ast/HelperRegistry.java.erb +67 -31
  706. data/templates/java/org/herb/ast/HelperType.java.erb +29 -0
  707. data/templates/java/org/herb/ast/Nodes.java.erb +11 -7
  708. data/templates/java/parser_options_helpers.c.erb +45 -0
  709. data/templates/java/parser_options_helpers.h.erb +10 -0
  710. data/templates/javascript/packages/client/src/state-kinds.ts.erb +49 -0
  711. data/templates/javascript/packages/client/src/state-operators.ts.erb +15 -0
  712. data/templates/javascript/packages/client/src/state-predicates.ts.erb +27 -0
  713. data/templates/javascript/packages/client/src/state-transforms.ts.erb +19 -0
  714. data/templates/javascript/packages/core/src/action-view-helpers.ts.erb +47 -0
  715. data/templates/javascript/packages/core/src/built-in-components.ts.erb +67 -0
  716. data/templates/javascript/packages/core/src/errors.ts.erb +9 -3
  717. data/templates/javascript/packages/core/src/foreign-content-elements.ts.erb +18 -0
  718. data/templates/javascript/packages/core/src/html-constants.ts.erb +32 -0
  719. data/templates/javascript/packages/core/src/html-elements.ts.erb +41 -0
  720. data/templates/javascript/packages/core/src/node-type-guards.ts.erb +11 -7
  721. data/templates/javascript/packages/core/src/nodes.ts.erb +82 -19
  722. data/templates/javascript/packages/core/src/parser-options.ts.erb +41 -0
  723. data/templates/javascript/packages/core/src/visitor.ts.erb +1 -1
  724. data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +3 -3
  725. data/templates/javascript/packages/node/extension/nodes.cpp.erb +17 -12
  726. data/templates/javascript/packages/node/extension/nodes.h.erb +3 -3
  727. data/templates/javascript/packages/node/extension/parser_options_helpers.cpp.erb +41 -0
  728. data/templates/javascript/packages/node/extension/parser_options_helpers.h.erb +12 -0
  729. data/templates/lib/herb/action_view/helper_registry.rb.erb +77 -3
  730. data/templates/lib/herb/ast/nodes.rb.erb +16 -6
  731. data/templates/lib/herb/engine/slots/component_definitions.rb.erb +38 -0
  732. data/templates/lib/herb/engine/slots/state_kinds.rb.erb +37 -0
  733. data/templates/lib/herb/engine/slots/state_operators.rb.erb +26 -0
  734. data/templates/lib/herb/engine/slots/state_predicates.rb.erb +39 -0
  735. data/templates/lib/herb/engine/slots/state_transforms.rb.erb +27 -0
  736. data/templates/lib/herb/errors.rb.erb +34 -6
  737. data/templates/lib/herb/html/elements.rb.erb +12 -0
  738. data/templates/lib/herb/parser_options.rb.erb +32 -0
  739. data/templates/lib/herb/visitor.rb.erb +7 -1
  740. data/templates/rust/herb-printer/src/printer_visitor.rs.erb +14 -0
  741. data/templates/rust/src/action_view_helpers.rs.erb +38 -0
  742. data/templates/rust/src/ast/nodes.rs.erb +24 -31
  743. data/templates/rust/src/errors.rs.erb +1 -1
  744. data/templates/rust/src/nodes.rs.erb +58 -26
  745. data/templates/rust/src/parser_options.rs.erb +16 -0
  746. data/templates/rust/src/prism/generated_deserialize.rs.erb +109 -0
  747. data/templates/rust/src/prism/generated_prettyprint.rs.erb +153 -0
  748. data/templates/rust/src/union_types.rs.erb +7 -1
  749. data/templates/rust/src/visitor.rs.erb +1 -1
  750. data/templates/src/analyze/action_view/helper_registry.c.erb +22 -0
  751. data/templates/src/analyze/missing_end.c.erb +13 -5
  752. data/templates/src/ast/ast_nodes.c.erb +41 -2
  753. data/templates/src/diff/herb_diff_nodes.c.erb +44 -8
  754. data/templates/src/errors.c.erb +8 -3
  755. data/templates/src/include/analyze/action_view/helper_registry.h.erb +19 -0
  756. data/templates/src/include/analyze/herb_directive_kinds.h.erb +25 -0
  757. data/templates/src/include/errors.h.erb +3 -1
  758. data/templates/src/include/parser/foreign_content_elements.h.erb +23 -0
  759. data/templates/src/include/parser/parser_options.h.erb +21 -0
  760. data/templates/src/include/util/html_elements.h.erb +28 -0
  761. data/templates/src/parser_options_defaults.c.erb +9 -0
  762. data/templates/template.rb +564 -9
  763. data/templates/wasm/error_helpers.cpp.erb +4 -4
  764. data/templates/wasm/nodes.cpp.erb +12 -12
  765. data/templates/wasm/nodes.h.erb +3 -3
  766. data/templates/wasm/parser_options_helpers.cpp.erb +25 -0
  767. data/templates/wasm/parser_options_helpers.h.erb +12 -0
  768. metadata +306 -27
  769. data/config/action_view_helpers/actionview/form_helper/button.yml +0 -38
  770. data/config/action_view_helpers/actionview/form_helper/submit.yml +0 -35
  771. data/lib/herb/ast.rb +0 -7
  772. data/lib/herb/diff_operation.rb +0 -34
  773. data/lib/herb/diff_result.rb +0 -59
  774. data/lib/herb/engine/error_formatter.rb +0 -432
  775. data/lib/herb/engine/parser_error_overlay.rb +0 -773
  776. data/lib/herb/engine/validation_error_overlay.rb +0 -182
  777. data/lib/herb/engine/validation_errors.rb +0 -65
  778. data/lib/herb/engine/validator.rb +0 -80
  779. data/sig/herb/ast.rbs +0 -6
  780. data/sig/herb/diff_operation.rbs +0 -34
  781. data/sig/herb/diff_result.rbs +0 -34
  782. data/sig/herb/engine/debug.rbs +0 -38
  783. data/sig/herb/engine/error_formatter.rbs +0 -47
  784. data/sig/herb/engine/parser_error_overlay.rbs +0 -41
  785. data/sig/herb/engine/validation_error_overlay.rbs +0 -35
  786. data/sig/herb/engine/validation_errors.rbs +0 -45
  787. data/sig/herb/engine/validator.rbs +0 -41
  788. 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;
@@ -676,9 +719,9 @@ AST_ERB_YIELD_NODE_T* ast_erb_yield_node_init(token_T* tag_opening, token_T* con
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;
682
725
 
683
726
  return erb_yield_node;
684
727
  }
@@ -690,15 +733,76 @@ AST_ERB_IN_NODE_T* ast_erb_in_node_init(token_T* tag_opening, token_T* content,
690
733
 
691
734
  ast_node_init(&erb_in_node->base, AST_ERB_IN_NODE, start_position, end_position, errors, allocator);
692
735
 
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);
736
+ erb_in_node->tag_opening = tag_opening;
737
+ erb_in_node->content = content;
738
+ erb_in_node->tag_closing = tag_closing;
696
739
  erb_in_node->then_keyword = then_keyword;
697
740
  erb_in_node->statements = statements;
698
741
 
699
742
  return erb_in_node;
700
743
  }
701
744
 
745
+ 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) {
746
+ AST_HERB_DIRECTIVE_NODE_T* herb_directive_node = hb_allocator_alloc(allocator, sizeof(AST_HERB_DIRECTIVE_NODE_T));
747
+
748
+ if (!herb_directive_node) { return NULL; }
749
+
750
+ ast_node_init(&herb_directive_node->base, AST_HERB_DIRECTIVE_NODE, start_position, end_position, errors, allocator);
751
+
752
+ herb_directive_node->tag_opening = tag_opening;
753
+ herb_directive_node->content = content;
754
+ herb_directive_node->tag_closing = tag_closing;
755
+ herb_directive_node->key = key;
756
+ herb_directive_node->arguments = arguments;
757
+
758
+ return herb_directive_node;
759
+ }
760
+
761
+ 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) {
762
+ AST_HERB_STATE_DECLARATION_NODE_T* herb_state_declaration_node = hb_allocator_alloc(allocator, sizeof(AST_HERB_STATE_DECLARATION_NODE_T));
763
+
764
+ if (!herb_state_declaration_node) { return NULL; }
765
+
766
+ ast_node_init(&herb_state_declaration_node->base, AST_HERB_STATE_DECLARATION_NODE, start_position, end_position, errors, allocator);
767
+
768
+ herb_state_declaration_node->name = name;
769
+ herb_state_declaration_node->default_value = default_value;
770
+ herb_state_declaration_node->kind = hb_string_copy(kind, allocator);
771
+
772
+ return herb_state_declaration_node;
773
+ }
774
+
775
+ 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) {
776
+ AST_HERB_STATE_DIRECTIVE_NODE_T* herb_state_directive_node = hb_allocator_alloc(allocator, sizeof(AST_HERB_STATE_DIRECTIVE_NODE_T));
777
+
778
+ if (!herb_state_directive_node) { return NULL; }
779
+
780
+ ast_node_init(&herb_state_directive_node->base, AST_HERB_STATE_DIRECTIVE_NODE, start_position, end_position, errors, allocator);
781
+
782
+ herb_state_directive_node->tag_opening = tag_opening;
783
+ herb_state_directive_node->content = content;
784
+ herb_state_directive_node->tag_closing = tag_closing;
785
+ herb_state_directive_node->key = key;
786
+ herb_state_directive_node->signature = signature;
787
+ herb_state_directive_node->states = states;
788
+
789
+ return herb_state_directive_node;
790
+ }
791
+
792
+ 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) {
793
+ AST_ERB_COMMENT_NODE_T* erb_comment_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_COMMENT_NODE_T));
794
+
795
+ if (!erb_comment_node) { return NULL; }
796
+
797
+ ast_node_init(&erb_comment_node->base, AST_ERB_COMMENT_NODE, start_position, end_position, errors, allocator);
798
+
799
+ erb_comment_node->tag_opening = tag_opening;
800
+ erb_comment_node->content = content;
801
+ erb_comment_node->tag_closing = tag_closing;
802
+
803
+ return erb_comment_node;
804
+ }
805
+
702
806
  hb_string_T ast_node_type_to_string(AST_NODE_T* node) {
703
807
  switch (node->type) {
704
808
  case AST_DOCUMENT_NODE: return hb_string("AST_DOCUMENT_NODE");
@@ -720,6 +824,7 @@ hb_string_T ast_node_type_to_string(AST_NODE_T* node) {
720
824
  case AST_HTML_COMMENT_NODE: return hb_string("AST_HTML_COMMENT_NODE");
721
825
  case AST_HTML_DOCTYPE_NODE: return hb_string("AST_HTML_DOCTYPE_NODE");
722
826
  case AST_XML_DECLARATION_NODE: return hb_string("AST_XML_DECLARATION_NODE");
827
+ case AST_XML_PROCESSING_INSTRUCTION_NODE: return hb_string("AST_XML_PROCESSING_INSTRUCTION_NODE");
723
828
  case AST_CDATA_NODE: return hb_string("AST_CDATA_NODE");
724
829
  case AST_WHITESPACE_NODE: return hb_string("AST_WHITESPACE_NODE");
725
830
  case AST_ERB_CONTENT_NODE: return hb_string("AST_ERB_CONTENT_NODE");
@@ -727,6 +832,7 @@ hb_string_T ast_node_type_to_string(AST_NODE_T* node) {
727
832
  case AST_ERB_ELSE_NODE: return hb_string("AST_ERB_ELSE_NODE");
728
833
  case AST_ERB_IF_NODE: return hb_string("AST_ERB_IF_NODE");
729
834
  case AST_ERB_BLOCK_NODE: return hb_string("AST_ERB_BLOCK_NODE");
835
+ case AST_ERB_ITERATION_BLOCK_NODE: return hb_string("AST_ERB_ITERATION_BLOCK_NODE");
730
836
  case AST_ERB_WHEN_NODE: return hb_string("AST_ERB_WHEN_NODE");
731
837
  case AST_ERB_CASE_NODE: return hb_string("AST_ERB_CASE_NODE");
732
838
  case AST_ERB_CASE_MATCH_NODE: return hb_string("AST_ERB_CASE_MATCH_NODE");
@@ -744,6 +850,10 @@ hb_string_T ast_node_type_to_string(AST_NODE_T* node) {
744
850
  case AST_ERB_STRICT_LOCALS_NODE: return hb_string("AST_ERB_STRICT_LOCALS_NODE");
745
851
  case AST_ERB_YIELD_NODE: return hb_string("AST_ERB_YIELD_NODE");
746
852
  case AST_ERB_IN_NODE: return hb_string("AST_ERB_IN_NODE");
853
+ case AST_HERB_DIRECTIVE_NODE: return hb_string("AST_HERB_DIRECTIVE_NODE");
854
+ case AST_HERB_STATE_DECLARATION_NODE: return hb_string("AST_HERB_STATE_DECLARATION_NODE");
855
+ case AST_HERB_STATE_DIRECTIVE_NODE: return hb_string("AST_HERB_STATE_DIRECTIVE_NODE");
856
+ case AST_ERB_COMMENT_NODE: return hb_string("AST_ERB_COMMENT_NODE");
747
857
  }
748
858
 
749
859
  return hb_string("Unknown ast_node_type_T");
@@ -770,6 +880,7 @@ hb_string_T ast_node_human_type(AST_NODE_T* node) {
770
880
  case AST_HTML_COMMENT_NODE: return hb_string("HTMLCommentNode");
771
881
  case AST_HTML_DOCTYPE_NODE: return hb_string("HTMLDoctypeNode");
772
882
  case AST_XML_DECLARATION_NODE: return hb_string("XMLDeclarationNode");
883
+ case AST_XML_PROCESSING_INSTRUCTION_NODE: return hb_string("XMLProcessingInstructionNode");
773
884
  case AST_CDATA_NODE: return hb_string("CDATANode");
774
885
  case AST_WHITESPACE_NODE: return hb_string("WhitespaceNode");
775
886
  case AST_ERB_CONTENT_NODE: return hb_string("ERBContentNode");
@@ -777,6 +888,7 @@ hb_string_T ast_node_human_type(AST_NODE_T* node) {
777
888
  case AST_ERB_ELSE_NODE: return hb_string("ERBElseNode");
778
889
  case AST_ERB_IF_NODE: return hb_string("ERBIfNode");
779
890
  case AST_ERB_BLOCK_NODE: return hb_string("ERBBlockNode");
891
+ case AST_ERB_ITERATION_BLOCK_NODE: return hb_string("ERBIterationBlockNode");
780
892
  case AST_ERB_WHEN_NODE: return hb_string("ERBWhenNode");
781
893
  case AST_ERB_CASE_NODE: return hb_string("ERBCaseNode");
782
894
  case AST_ERB_CASE_MATCH_NODE: return hb_string("ERBCaseMatchNode");
@@ -794,6 +906,10 @@ hb_string_T ast_node_human_type(AST_NODE_T* node) {
794
906
  case AST_ERB_STRICT_LOCALS_NODE: return hb_string("ERBStrictLocalsNode");
795
907
  case AST_ERB_YIELD_NODE: return hb_string("ERBYieldNode");
796
908
  case AST_ERB_IN_NODE: return hb_string("ERBInNode");
909
+ case AST_HERB_DIRECTIVE_NODE: return hb_string("HerbDirectiveNode");
910
+ case AST_HERB_STATE_DECLARATION_NODE: return hb_string("HerbStateDeclarationNode");
911
+ case AST_HERB_STATE_DIRECTIVE_NODE: return hb_string("HerbStateDirectiveNode");
912
+ case AST_ERB_COMMENT_NODE: return hb_string("ERBCommentNode");
797
913
  }
798
914
 
799
915
  return hb_string("Unknown ast_node_type_T");
@@ -831,7 +947,7 @@ static void ast_free_document_node(AST_DOCUMENT_NODE_T* document_node, hb_alloca
831
947
  }
832
948
 
833
949
  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); }
950
+ if (!hb_string_is_empty(literal_node->content)) { hb_allocator_dealloc(allocator, literal_node->content.data); }
835
951
 
836
952
  ast_free_base_node(&literal_node->base, allocator);
837
953
  }
@@ -904,7 +1020,7 @@ static void ast_free_html_element_node(AST_HTML_ELEMENT_NODE_T* html_element_nod
904
1020
  }
905
1021
 
906
1022
  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); }
1023
+ if (!hb_string_is_empty(html_conditional_element_node->condition)) { hb_allocator_dealloc(allocator, html_conditional_element_node->condition.data); }
908
1024
  ast_node_free((AST_NODE_T*) html_conditional_element_node->open_conditional, allocator);
909
1025
  /* open_tag is a borrowed reference, not freed here (owned by another field) */
910
1026
  if (html_conditional_element_node->body != NULL) {
@@ -959,14 +1075,14 @@ static void ast_free_html_attribute_node(AST_HTML_ATTRIBUTE_NODE_T* html_attribu
959
1075
  }
960
1076
 
961
1077
  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); }
1078
+ if (!hb_string_is_empty(ruby_literal_node->content)) { hb_allocator_dealloc(allocator, ruby_literal_node->content.data); }
963
1079
 
964
1080
  ast_free_base_node(&ruby_literal_node->base, allocator);
965
1081
  }
966
1082
 
967
1083
  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); }
1084
+ if (!hb_string_is_empty(ruby_html_attributes_splat_node->content)) { hb_allocator_dealloc(allocator, ruby_html_attributes_splat_node->content.data); }
1085
+ if (!hb_string_is_empty(ruby_html_attributes_splat_node->prefix)) { hb_allocator_dealloc(allocator, ruby_html_attributes_splat_node->prefix.data); }
970
1086
 
971
1087
  ast_free_base_node(&ruby_html_attributes_splat_node->base, allocator);
972
1088
  }
@@ -989,7 +1105,7 @@ static void ast_free_erb_open_tag_node(AST_ERB_OPEN_TAG_NODE_T* erb_open_tag_nod
989
1105
  }
990
1106
 
991
1107
  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); }
1108
+ if (!hb_string_is_empty(html_text_node->content)) { hb_allocator_dealloc(allocator, html_text_node->content.data); }
993
1109
 
994
1110
  ast_free_base_node(&html_text_node->base, allocator);
995
1111
  }
@@ -1039,6 +1155,22 @@ static void ast_free_xml_declaration_node(AST_XML_DECLARATION_NODE_T* xml_declar
1039
1155
  ast_free_base_node(&xml_declaration_node->base, allocator);
1040
1156
  }
1041
1157
 
1158
+ static void ast_free_xml_processing_instruction_node(AST_XML_PROCESSING_INSTRUCTION_NODE_T* xml_processing_instruction_node, hb_allocator_T* allocator) {
1159
+ if (xml_processing_instruction_node->tag_opening != NULL) { token_free(xml_processing_instruction_node->tag_opening, allocator); }
1160
+ if (xml_processing_instruction_node->target != NULL) { token_free(xml_processing_instruction_node->target, allocator); }
1161
+ if (xml_processing_instruction_node->children != NULL) {
1162
+ for (size_t i = 0; i < hb_array_size(xml_processing_instruction_node->children); i++) {
1163
+ AST_NODE_T* child = hb_array_get(xml_processing_instruction_node->children, i);
1164
+ if (child) { ast_node_free(child, allocator); }
1165
+ }
1166
+
1167
+ hb_array_free(&xml_processing_instruction_node->children);
1168
+ }
1169
+ if (xml_processing_instruction_node->tag_closing != NULL) { token_free(xml_processing_instruction_node->tag_closing, allocator); }
1170
+
1171
+ ast_free_base_node(&xml_processing_instruction_node->base, allocator);
1172
+ }
1173
+
1042
1174
  static void ast_free_cdata_node(AST_CDATA_NODE_T* cdata_node, hb_allocator_T* allocator) {
1043
1175
  if (cdata_node->tag_opening != NULL) { token_free(cdata_node->tag_opening, allocator); }
1044
1176
  if (cdata_node->children != NULL) {
@@ -1145,6 +1277,47 @@ static void ast_free_erb_block_node(AST_ERB_BLOCK_NODE_T* erb_block_node, hb_all
1145
1277
  ast_free_base_node(&erb_block_node->base, allocator);
1146
1278
  }
1147
1279
 
1280
+ static void ast_free_erb_iteration_block_node(AST_ERB_ITERATION_BLOCK_NODE_T* erb_iteration_block_node, hb_allocator_T* allocator) {
1281
+ if (erb_iteration_block_node->tag_opening != NULL) { token_free(erb_iteration_block_node->tag_opening, allocator); }
1282
+ if (erb_iteration_block_node->content != NULL) { token_free(erb_iteration_block_node->content, allocator); }
1283
+ if (erb_iteration_block_node->tag_closing != NULL) { token_free(erb_iteration_block_node->tag_closing, allocator); }
1284
+ /* prism_node is a borrowed reference into the prism context, not freed here */
1285
+ if (erb_iteration_block_node->receiver != NULL) { token_free(erb_iteration_block_node->receiver, allocator); }
1286
+ if (erb_iteration_block_node->call_operator != NULL) { token_free(erb_iteration_block_node->call_operator, allocator); }
1287
+ if (erb_iteration_block_node->message != NULL) { token_free(erb_iteration_block_node->message, allocator); }
1288
+ if (erb_iteration_block_node->arguments != NULL) {
1289
+ for (size_t i = 0; i < hb_array_size(erb_iteration_block_node->arguments); i++) {
1290
+ AST_NODE_T* child = hb_array_get(erb_iteration_block_node->arguments, i);
1291
+ if (child) { ast_node_free(child, allocator); }
1292
+ }
1293
+
1294
+ hb_array_free(&erb_iteration_block_node->arguments);
1295
+ }
1296
+ if (erb_iteration_block_node->block_opening != NULL) { token_free(erb_iteration_block_node->block_opening, allocator); }
1297
+ if (erb_iteration_block_node->body != NULL) {
1298
+ for (size_t i = 0; i < hb_array_size(erb_iteration_block_node->body); i++) {
1299
+ AST_NODE_T* child = hb_array_get(erb_iteration_block_node->body, i);
1300
+ if (child) { ast_node_free(child, allocator); }
1301
+ }
1302
+
1303
+ hb_array_free(&erb_iteration_block_node->body);
1304
+ }
1305
+ if (erb_iteration_block_node->block_arguments != NULL) {
1306
+ for (size_t i = 0; i < hb_array_size(erb_iteration_block_node->block_arguments); i++) {
1307
+ AST_NODE_T* child = hb_array_get(erb_iteration_block_node->block_arguments, i);
1308
+ if (child) { ast_node_free(child, allocator); }
1309
+ }
1310
+
1311
+ hb_array_free(&erb_iteration_block_node->block_arguments);
1312
+ }
1313
+ ast_node_free((AST_NODE_T*) erb_iteration_block_node->rescue_clause, allocator);
1314
+ ast_node_free((AST_NODE_T*) erb_iteration_block_node->else_clause, allocator);
1315
+ ast_node_free((AST_NODE_T*) erb_iteration_block_node->ensure_clause, allocator);
1316
+ ast_node_free((AST_NODE_T*) erb_iteration_block_node->end_node, allocator);
1317
+
1318
+ ast_free_base_node(&erb_iteration_block_node->base, allocator);
1319
+ }
1320
+
1148
1321
  static void ast_free_erb_when_node(AST_ERB_WHEN_NODE_T* erb_when_node, hb_allocator_T* allocator) {
1149
1322
  if (erb_when_node->tag_opening != NULL) { token_free(erb_when_node->tag_opening, allocator); }
1150
1323
  if (erb_when_node->content != NULL) { token_free(erb_when_node->content, allocator); }
@@ -1377,6 +1550,15 @@ static void ast_free_ruby_render_keywords_node(AST_RUBY_RENDER_KEYWORDS_NODE_T*
1377
1550
 
1378
1551
  hb_array_free(&ruby_render_keywords_node->locals);
1379
1552
  }
1553
+ if (ruby_render_keywords_node->state != NULL) {
1554
+ for (size_t i = 0; i < hb_array_size(ruby_render_keywords_node->state); i++) {
1555
+ AST_NODE_T* child = hb_array_get(ruby_render_keywords_node->state, i);
1556
+ if (child) { ast_node_free(child, allocator); }
1557
+ }
1558
+
1559
+ hb_array_free(&ruby_render_keywords_node->state);
1560
+ }
1561
+ if (ruby_render_keywords_node->state_location != NULL) { hb_allocator_dealloc(allocator, ruby_render_keywords_node->state_location); }
1380
1562
 
1381
1563
  ast_free_base_node(&ruby_render_keywords_node->base, allocator);
1382
1564
  }
@@ -1417,7 +1599,7 @@ static void ast_free_erb_render_node(AST_ERB_RENDER_NODE_T* erb_render_node, hb_
1417
1599
  static void ast_free_ruby_parameter_node(AST_RUBY_PARAMETER_NODE_T* ruby_parameter_node, hb_allocator_T* allocator) {
1418
1600
  if (ruby_parameter_node->name != NULL) { token_free(ruby_parameter_node->name, allocator); }
1419
1601
  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); }
1602
+ if (!hb_string_is_empty(ruby_parameter_node->kind)) { hb_allocator_dealloc(allocator, ruby_parameter_node->kind.data); }
1421
1603
 
1422
1604
  ast_free_base_node(&ruby_parameter_node->base, allocator);
1423
1605
  }
@@ -1467,6 +1649,617 @@ static void ast_free_erb_in_node(AST_ERB_IN_NODE_T* erb_in_node, hb_allocator_T*
1467
1649
  ast_free_base_node(&erb_in_node->base, allocator);
1468
1650
  }
1469
1651
 
1652
+ static void ast_free_herb_directive_node(AST_HERB_DIRECTIVE_NODE_T* herb_directive_node, hb_allocator_T* allocator) {
1653
+ if (herb_directive_node->tag_opening != NULL) { token_free(herb_directive_node->tag_opening, allocator); }
1654
+ if (herb_directive_node->content != NULL) { token_free(herb_directive_node->content, allocator); }
1655
+ if (herb_directive_node->tag_closing != NULL) { token_free(herb_directive_node->tag_closing, allocator); }
1656
+ if (herb_directive_node->key != NULL) { token_free(herb_directive_node->key, allocator); }
1657
+ if (herb_directive_node->arguments != NULL) { token_free(herb_directive_node->arguments, allocator); }
1658
+
1659
+ ast_free_base_node(&herb_directive_node->base, allocator);
1660
+ }
1661
+
1662
+ static void ast_free_herb_state_declaration_node(AST_HERB_STATE_DECLARATION_NODE_T* herb_state_declaration_node, hb_allocator_T* allocator) {
1663
+ if (herb_state_declaration_node->name != NULL) { token_free(herb_state_declaration_node->name, allocator); }
1664
+ ast_node_free((AST_NODE_T*) herb_state_declaration_node->default_value, allocator);
1665
+ if (!hb_string_is_empty(herb_state_declaration_node->kind)) { hb_allocator_dealloc(allocator, herb_state_declaration_node->kind.data); }
1666
+
1667
+ ast_free_base_node(&herb_state_declaration_node->base, allocator);
1668
+ }
1669
+
1670
+ static void ast_free_herb_state_directive_node(AST_HERB_STATE_DIRECTIVE_NODE_T* herb_state_directive_node, hb_allocator_T* allocator) {
1671
+ if (herb_state_directive_node->tag_opening != NULL) { token_free(herb_state_directive_node->tag_opening, allocator); }
1672
+ if (herb_state_directive_node->content != NULL) { token_free(herb_state_directive_node->content, allocator); }
1673
+ if (herb_state_directive_node->tag_closing != NULL) { token_free(herb_state_directive_node->tag_closing, allocator); }
1674
+ if (herb_state_directive_node->key != NULL) { token_free(herb_state_directive_node->key, allocator); }
1675
+ if (herb_state_directive_node->signature != NULL) { token_free(herb_state_directive_node->signature, allocator); }
1676
+ if (herb_state_directive_node->states != NULL) {
1677
+ for (size_t i = 0; i < hb_array_size(herb_state_directive_node->states); i++) {
1678
+ AST_NODE_T* child = hb_array_get(herb_state_directive_node->states, i);
1679
+ if (child) { ast_node_free(child, allocator); }
1680
+ }
1681
+
1682
+ hb_array_free(&herb_state_directive_node->states);
1683
+ }
1684
+
1685
+ ast_free_base_node(&herb_state_directive_node->base, allocator);
1686
+ }
1687
+
1688
+ static void ast_free_erb_comment_node(AST_ERB_COMMENT_NODE_T* erb_comment_node, hb_allocator_T* allocator) {
1689
+ if (erb_comment_node->tag_opening != NULL) { token_free(erb_comment_node->tag_opening, allocator); }
1690
+ if (erb_comment_node->content != NULL) { token_free(erb_comment_node->content, allocator); }
1691
+ if (erb_comment_node->tag_closing != NULL) { token_free(erb_comment_node->tag_closing, allocator); }
1692
+
1693
+ ast_free_base_node(&erb_comment_node->base, allocator);
1694
+ }
1695
+
1696
+ static void ast_rebase_token(token_T* token, const char* from, const char* to, size_t length) {
1697
+ if (token == NULL || token->value.data == NULL) { return; }
1698
+ if (token->value.data < from || token->value.data >= from + length) { return; }
1699
+
1700
+ token->value.data = (char*) to + (token->value.data - from);
1701
+ }
1702
+
1703
+ void ast_node_rebase_tokens(AST_NODE_T* node, const char* from, const char* to, size_t length) {
1704
+ if (!node) { return; }
1705
+
1706
+ switch (node->type) {
1707
+ case AST_DOCUMENT_NODE: {
1708
+ AST_DOCUMENT_NODE_T* typed = (AST_DOCUMENT_NODE_T*) node;
1709
+ if (typed->children != NULL) {
1710
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1711
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1712
+ }
1713
+ }
1714
+ break;
1715
+ }
1716
+ case AST_LITERAL_NODE: {
1717
+ break;
1718
+ }
1719
+ case AST_HTML_OPEN_TAG_NODE: {
1720
+ AST_HTML_OPEN_TAG_NODE_T* typed = (AST_HTML_OPEN_TAG_NODE_T*) node;
1721
+ ast_rebase_token(typed->tag_opening, from, to, length);
1722
+ ast_rebase_token(typed->tag_name, from, to, length);
1723
+ ast_rebase_token(typed->tag_closing, from, to, length);
1724
+ if (typed->children != NULL) {
1725
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1726
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1727
+ }
1728
+ }
1729
+ break;
1730
+ }
1731
+ case AST_HTML_CONDITIONAL_OPEN_TAG_NODE: {
1732
+ AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* typed = (AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T*) node;
1733
+ ast_node_rebase_tokens((AST_NODE_T*) typed->conditional, from, to, length);
1734
+ ast_rebase_token(typed->tag_name, from, to, length);
1735
+ break;
1736
+ }
1737
+ case AST_HTML_CLOSE_TAG_NODE: {
1738
+ AST_HTML_CLOSE_TAG_NODE_T* typed = (AST_HTML_CLOSE_TAG_NODE_T*) node;
1739
+ ast_rebase_token(typed->tag_opening, from, to, length);
1740
+ ast_rebase_token(typed->tag_name, from, to, length);
1741
+ if (typed->children != NULL) {
1742
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1743
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1744
+ }
1745
+ }
1746
+ ast_rebase_token(typed->tag_closing, from, to, length);
1747
+ break;
1748
+ }
1749
+ case AST_HTML_OMITTED_CLOSE_TAG_NODE: {
1750
+ AST_HTML_OMITTED_CLOSE_TAG_NODE_T* typed = (AST_HTML_OMITTED_CLOSE_TAG_NODE_T*) node;
1751
+ ast_rebase_token(typed->tag_name, from, to, length);
1752
+ break;
1753
+ }
1754
+ case AST_HTML_VIRTUAL_CLOSE_TAG_NODE: {
1755
+ AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T* typed = (AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T*) node;
1756
+ ast_rebase_token(typed->tag_name, from, to, length);
1757
+ break;
1758
+ }
1759
+ case AST_HTML_ELEMENT_NODE: {
1760
+ AST_HTML_ELEMENT_NODE_T* typed = (AST_HTML_ELEMENT_NODE_T*) node;
1761
+ ast_node_rebase_tokens((AST_NODE_T*) typed->open_tag, from, to, length);
1762
+ ast_rebase_token(typed->tag_name, from, to, length);
1763
+ if (typed->body != NULL) {
1764
+ for (size_t i = 0; i < hb_array_size(typed->body); i++) {
1765
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->body, i), from, to, length);
1766
+ }
1767
+ }
1768
+ ast_node_rebase_tokens((AST_NODE_T*) typed->close_tag, from, to, length);
1769
+ break;
1770
+ }
1771
+ case AST_HTML_CONDITIONAL_ELEMENT_NODE: {
1772
+ AST_HTML_CONDITIONAL_ELEMENT_NODE_T* typed = (AST_HTML_CONDITIONAL_ELEMENT_NODE_T*) node;
1773
+ ast_node_rebase_tokens((AST_NODE_T*) typed->open_conditional, from, to, length);
1774
+ if (typed->body != NULL) {
1775
+ for (size_t i = 0; i < hb_array_size(typed->body); i++) {
1776
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->body, i), from, to, length);
1777
+ }
1778
+ }
1779
+ ast_node_rebase_tokens((AST_NODE_T*) typed->close_conditional, from, to, length);
1780
+ ast_rebase_token(typed->tag_name, from, to, length);
1781
+ break;
1782
+ }
1783
+ case AST_HTML_ATTRIBUTE_VALUE_NODE: {
1784
+ AST_HTML_ATTRIBUTE_VALUE_NODE_T* typed = (AST_HTML_ATTRIBUTE_VALUE_NODE_T*) node;
1785
+ ast_rebase_token(typed->open_quote, from, to, length);
1786
+ if (typed->children != NULL) {
1787
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1788
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1789
+ }
1790
+ }
1791
+ ast_rebase_token(typed->close_quote, from, to, length);
1792
+ break;
1793
+ }
1794
+ case AST_HTML_ATTRIBUTE_NAME_NODE: {
1795
+ AST_HTML_ATTRIBUTE_NAME_NODE_T* typed = (AST_HTML_ATTRIBUTE_NAME_NODE_T*) node;
1796
+ if (typed->children != NULL) {
1797
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1798
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1799
+ }
1800
+ }
1801
+ break;
1802
+ }
1803
+ case AST_HTML_ATTRIBUTE_NODE: {
1804
+ AST_HTML_ATTRIBUTE_NODE_T* typed = (AST_HTML_ATTRIBUTE_NODE_T*) node;
1805
+ ast_node_rebase_tokens((AST_NODE_T*) typed->name, from, to, length);
1806
+ ast_rebase_token(typed->equals, from, to, length);
1807
+ ast_node_rebase_tokens((AST_NODE_T*) typed->value, from, to, length);
1808
+ break;
1809
+ }
1810
+ case AST_RUBY_LITERAL_NODE: {
1811
+ break;
1812
+ }
1813
+ case AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE: {
1814
+ break;
1815
+ }
1816
+ case AST_ERB_OPEN_TAG_NODE: {
1817
+ AST_ERB_OPEN_TAG_NODE_T* typed = (AST_ERB_OPEN_TAG_NODE_T*) node;
1818
+ ast_rebase_token(typed->tag_opening, from, to, length);
1819
+ ast_rebase_token(typed->content, from, to, length);
1820
+ ast_rebase_token(typed->tag_closing, from, to, length);
1821
+ ast_rebase_token(typed->tag_name, from, to, length);
1822
+ if (typed->children != NULL) {
1823
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1824
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1825
+ }
1826
+ }
1827
+ break;
1828
+ }
1829
+ case AST_HTML_TEXT_NODE: {
1830
+ break;
1831
+ }
1832
+ case AST_HTML_COMMENT_NODE: {
1833
+ AST_HTML_COMMENT_NODE_T* typed = (AST_HTML_COMMENT_NODE_T*) node;
1834
+ ast_rebase_token(typed->comment_start, from, to, length);
1835
+ if (typed->children != NULL) {
1836
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1837
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1838
+ }
1839
+ }
1840
+ ast_rebase_token(typed->comment_end, from, to, length);
1841
+ break;
1842
+ }
1843
+ case AST_HTML_DOCTYPE_NODE: {
1844
+ AST_HTML_DOCTYPE_NODE_T* typed = (AST_HTML_DOCTYPE_NODE_T*) node;
1845
+ ast_rebase_token(typed->tag_opening, from, to, length);
1846
+ if (typed->children != NULL) {
1847
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1848
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1849
+ }
1850
+ }
1851
+ ast_rebase_token(typed->tag_closing, from, to, length);
1852
+ break;
1853
+ }
1854
+ case AST_XML_DECLARATION_NODE: {
1855
+ AST_XML_DECLARATION_NODE_T* typed = (AST_XML_DECLARATION_NODE_T*) node;
1856
+ ast_rebase_token(typed->tag_opening, from, to, length);
1857
+ if (typed->children != NULL) {
1858
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1859
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1860
+ }
1861
+ }
1862
+ ast_rebase_token(typed->tag_closing, from, to, length);
1863
+ break;
1864
+ }
1865
+ case AST_XML_PROCESSING_INSTRUCTION_NODE: {
1866
+ AST_XML_PROCESSING_INSTRUCTION_NODE_T* typed = (AST_XML_PROCESSING_INSTRUCTION_NODE_T*) node;
1867
+ ast_rebase_token(typed->tag_opening, from, to, length);
1868
+ ast_rebase_token(typed->target, from, to, length);
1869
+ if (typed->children != NULL) {
1870
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1871
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1872
+ }
1873
+ }
1874
+ ast_rebase_token(typed->tag_closing, from, to, length);
1875
+ break;
1876
+ }
1877
+ case AST_CDATA_NODE: {
1878
+ AST_CDATA_NODE_T* typed = (AST_CDATA_NODE_T*) node;
1879
+ ast_rebase_token(typed->tag_opening, from, to, length);
1880
+ if (typed->children != NULL) {
1881
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
1882
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
1883
+ }
1884
+ }
1885
+ ast_rebase_token(typed->tag_closing, from, to, length);
1886
+ break;
1887
+ }
1888
+ case AST_WHITESPACE_NODE: {
1889
+ AST_WHITESPACE_NODE_T* typed = (AST_WHITESPACE_NODE_T*) node;
1890
+ ast_rebase_token(typed->value, from, to, length);
1891
+ break;
1892
+ }
1893
+ case AST_ERB_CONTENT_NODE: {
1894
+ AST_ERB_CONTENT_NODE_T* typed = (AST_ERB_CONTENT_NODE_T*) node;
1895
+ ast_rebase_token(typed->tag_opening, from, to, length);
1896
+ ast_rebase_token(typed->content, from, to, length);
1897
+ ast_rebase_token(typed->tag_closing, from, to, length);
1898
+ break;
1899
+ }
1900
+ case AST_ERB_END_NODE: {
1901
+ AST_ERB_END_NODE_T* typed = (AST_ERB_END_NODE_T*) node;
1902
+ ast_rebase_token(typed->tag_opening, from, to, length);
1903
+ ast_rebase_token(typed->content, from, to, length);
1904
+ ast_rebase_token(typed->tag_closing, from, to, length);
1905
+ break;
1906
+ }
1907
+ case AST_ERB_ELSE_NODE: {
1908
+ AST_ERB_ELSE_NODE_T* typed = (AST_ERB_ELSE_NODE_T*) node;
1909
+ ast_rebase_token(typed->tag_opening, from, to, length);
1910
+ ast_rebase_token(typed->content, from, to, length);
1911
+ ast_rebase_token(typed->tag_closing, from, to, length);
1912
+ if (typed->statements != NULL) {
1913
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
1914
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
1915
+ }
1916
+ }
1917
+ break;
1918
+ }
1919
+ case AST_ERB_IF_NODE: {
1920
+ AST_ERB_IF_NODE_T* typed = (AST_ERB_IF_NODE_T*) node;
1921
+ ast_rebase_token(typed->tag_opening, from, to, length);
1922
+ ast_rebase_token(typed->content, from, to, length);
1923
+ ast_rebase_token(typed->tag_closing, from, to, length);
1924
+ if (typed->statements != NULL) {
1925
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
1926
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
1927
+ }
1928
+ }
1929
+ ast_node_rebase_tokens((AST_NODE_T*) typed->subsequent, from, to, length);
1930
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
1931
+ break;
1932
+ }
1933
+ case AST_ERB_BLOCK_NODE: {
1934
+ AST_ERB_BLOCK_NODE_T* typed = (AST_ERB_BLOCK_NODE_T*) node;
1935
+ ast_rebase_token(typed->tag_opening, from, to, length);
1936
+ ast_rebase_token(typed->content, from, to, length);
1937
+ ast_rebase_token(typed->tag_closing, from, to, length);
1938
+ if (typed->body != NULL) {
1939
+ for (size_t i = 0; i < hb_array_size(typed->body); i++) {
1940
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->body, i), from, to, length);
1941
+ }
1942
+ }
1943
+ if (typed->block_arguments != NULL) {
1944
+ for (size_t i = 0; i < hb_array_size(typed->block_arguments); i++) {
1945
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->block_arguments, i), from, to, length);
1946
+ }
1947
+ }
1948
+ ast_node_rebase_tokens((AST_NODE_T*) typed->rescue_clause, from, to, length);
1949
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
1950
+ ast_node_rebase_tokens((AST_NODE_T*) typed->ensure_clause, from, to, length);
1951
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
1952
+ break;
1953
+ }
1954
+ case AST_ERB_ITERATION_BLOCK_NODE: {
1955
+ AST_ERB_ITERATION_BLOCK_NODE_T* typed = (AST_ERB_ITERATION_BLOCK_NODE_T*) node;
1956
+ ast_rebase_token(typed->tag_opening, from, to, length);
1957
+ ast_rebase_token(typed->content, from, to, length);
1958
+ ast_rebase_token(typed->tag_closing, from, to, length);
1959
+ ast_rebase_token(typed->receiver, from, to, length);
1960
+ ast_rebase_token(typed->call_operator, from, to, length);
1961
+ ast_rebase_token(typed->message, from, to, length);
1962
+ if (typed->arguments != NULL) {
1963
+ for (size_t i = 0; i < hb_array_size(typed->arguments); i++) {
1964
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->arguments, i), from, to, length);
1965
+ }
1966
+ }
1967
+ ast_rebase_token(typed->block_opening, from, to, length);
1968
+ if (typed->body != NULL) {
1969
+ for (size_t i = 0; i < hb_array_size(typed->body); i++) {
1970
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->body, i), from, to, length);
1971
+ }
1972
+ }
1973
+ if (typed->block_arguments != NULL) {
1974
+ for (size_t i = 0; i < hb_array_size(typed->block_arguments); i++) {
1975
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->block_arguments, i), from, to, length);
1976
+ }
1977
+ }
1978
+ ast_node_rebase_tokens((AST_NODE_T*) typed->rescue_clause, from, to, length);
1979
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
1980
+ ast_node_rebase_tokens((AST_NODE_T*) typed->ensure_clause, from, to, length);
1981
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
1982
+ break;
1983
+ }
1984
+ case AST_ERB_WHEN_NODE: {
1985
+ AST_ERB_WHEN_NODE_T* typed = (AST_ERB_WHEN_NODE_T*) node;
1986
+ ast_rebase_token(typed->tag_opening, from, to, length);
1987
+ ast_rebase_token(typed->content, from, to, length);
1988
+ ast_rebase_token(typed->tag_closing, from, to, length);
1989
+ if (typed->statements != NULL) {
1990
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
1991
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
1992
+ }
1993
+ }
1994
+ break;
1995
+ }
1996
+ case AST_ERB_CASE_NODE: {
1997
+ AST_ERB_CASE_NODE_T* typed = (AST_ERB_CASE_NODE_T*) node;
1998
+ ast_rebase_token(typed->tag_opening, from, to, length);
1999
+ ast_rebase_token(typed->content, from, to, length);
2000
+ ast_rebase_token(typed->tag_closing, from, to, length);
2001
+ if (typed->children != NULL) {
2002
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
2003
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
2004
+ }
2005
+ }
2006
+ if (typed->conditions != NULL) {
2007
+ for (size_t i = 0; i < hb_array_size(typed->conditions); i++) {
2008
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->conditions, i), from, to, length);
2009
+ }
2010
+ }
2011
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
2012
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2013
+ break;
2014
+ }
2015
+ case AST_ERB_CASE_MATCH_NODE: {
2016
+ AST_ERB_CASE_MATCH_NODE_T* typed = (AST_ERB_CASE_MATCH_NODE_T*) node;
2017
+ ast_rebase_token(typed->tag_opening, from, to, length);
2018
+ ast_rebase_token(typed->content, from, to, length);
2019
+ ast_rebase_token(typed->tag_closing, from, to, length);
2020
+ if (typed->children != NULL) {
2021
+ for (size_t i = 0; i < hb_array_size(typed->children); i++) {
2022
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->children, i), from, to, length);
2023
+ }
2024
+ }
2025
+ if (typed->conditions != NULL) {
2026
+ for (size_t i = 0; i < hb_array_size(typed->conditions); i++) {
2027
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->conditions, i), from, to, length);
2028
+ }
2029
+ }
2030
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
2031
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2032
+ break;
2033
+ }
2034
+ case AST_ERB_WHILE_NODE: {
2035
+ AST_ERB_WHILE_NODE_T* typed = (AST_ERB_WHILE_NODE_T*) node;
2036
+ ast_rebase_token(typed->tag_opening, from, to, length);
2037
+ ast_rebase_token(typed->content, from, to, length);
2038
+ ast_rebase_token(typed->tag_closing, from, to, length);
2039
+ if (typed->statements != NULL) {
2040
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2041
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2042
+ }
2043
+ }
2044
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2045
+ break;
2046
+ }
2047
+ case AST_ERB_UNTIL_NODE: {
2048
+ AST_ERB_UNTIL_NODE_T* typed = (AST_ERB_UNTIL_NODE_T*) node;
2049
+ ast_rebase_token(typed->tag_opening, from, to, length);
2050
+ ast_rebase_token(typed->content, from, to, length);
2051
+ ast_rebase_token(typed->tag_closing, from, to, length);
2052
+ if (typed->statements != NULL) {
2053
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2054
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2055
+ }
2056
+ }
2057
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2058
+ break;
2059
+ }
2060
+ case AST_ERB_FOR_NODE: {
2061
+ AST_ERB_FOR_NODE_T* typed = (AST_ERB_FOR_NODE_T*) node;
2062
+ ast_rebase_token(typed->tag_opening, from, to, length);
2063
+ ast_rebase_token(typed->content, from, to, length);
2064
+ ast_rebase_token(typed->tag_closing, from, to, length);
2065
+ if (typed->statements != NULL) {
2066
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2067
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2068
+ }
2069
+ }
2070
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2071
+ break;
2072
+ }
2073
+ case AST_ERB_RESCUE_NODE: {
2074
+ AST_ERB_RESCUE_NODE_T* typed = (AST_ERB_RESCUE_NODE_T*) node;
2075
+ ast_rebase_token(typed->tag_opening, from, to, length);
2076
+ ast_rebase_token(typed->content, from, to, length);
2077
+ ast_rebase_token(typed->tag_closing, from, to, length);
2078
+ if (typed->statements != NULL) {
2079
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2080
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2081
+ }
2082
+ }
2083
+ ast_node_rebase_tokens((AST_NODE_T*) typed->subsequent, from, to, length);
2084
+ break;
2085
+ }
2086
+ case AST_ERB_ENSURE_NODE: {
2087
+ AST_ERB_ENSURE_NODE_T* typed = (AST_ERB_ENSURE_NODE_T*) node;
2088
+ ast_rebase_token(typed->tag_opening, from, to, length);
2089
+ ast_rebase_token(typed->content, from, to, length);
2090
+ ast_rebase_token(typed->tag_closing, from, to, length);
2091
+ if (typed->statements != NULL) {
2092
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2093
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2094
+ }
2095
+ }
2096
+ break;
2097
+ }
2098
+ case AST_ERB_BEGIN_NODE: {
2099
+ AST_ERB_BEGIN_NODE_T* typed = (AST_ERB_BEGIN_NODE_T*) node;
2100
+ ast_rebase_token(typed->tag_opening, from, to, length);
2101
+ ast_rebase_token(typed->content, from, to, length);
2102
+ ast_rebase_token(typed->tag_closing, from, to, length);
2103
+ if (typed->statements != NULL) {
2104
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2105
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2106
+ }
2107
+ }
2108
+ ast_node_rebase_tokens((AST_NODE_T*) typed->rescue_clause, from, to, length);
2109
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
2110
+ ast_node_rebase_tokens((AST_NODE_T*) typed->ensure_clause, from, to, length);
2111
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2112
+ break;
2113
+ }
2114
+ case AST_ERB_UNLESS_NODE: {
2115
+ AST_ERB_UNLESS_NODE_T* typed = (AST_ERB_UNLESS_NODE_T*) node;
2116
+ ast_rebase_token(typed->tag_opening, from, to, length);
2117
+ ast_rebase_token(typed->content, from, to, length);
2118
+ ast_rebase_token(typed->tag_closing, from, to, length);
2119
+ if (typed->statements != NULL) {
2120
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2121
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2122
+ }
2123
+ }
2124
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
2125
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2126
+ break;
2127
+ }
2128
+ case AST_RUBY_RENDER_LOCAL_NODE: {
2129
+ AST_RUBY_RENDER_LOCAL_NODE_T* typed = (AST_RUBY_RENDER_LOCAL_NODE_T*) node;
2130
+ ast_rebase_token(typed->name, from, to, length);
2131
+ ast_node_rebase_tokens((AST_NODE_T*) typed->value, from, to, length);
2132
+ break;
2133
+ }
2134
+ case AST_RUBY_RENDER_KEYWORDS_NODE: {
2135
+ AST_RUBY_RENDER_KEYWORDS_NODE_T* typed = (AST_RUBY_RENDER_KEYWORDS_NODE_T*) node;
2136
+ ast_rebase_token(typed->partial, from, to, length);
2137
+ ast_rebase_token(typed->template_path, from, to, length);
2138
+ ast_rebase_token(typed->layout, from, to, length);
2139
+ ast_rebase_token(typed->file, from, to, length);
2140
+ ast_rebase_token(typed->inline_template, from, to, length);
2141
+ ast_rebase_token(typed->body, from, to, length);
2142
+ ast_rebase_token(typed->plain, from, to, length);
2143
+ ast_rebase_token(typed->html, from, to, length);
2144
+ ast_rebase_token(typed->renderable, from, to, length);
2145
+ ast_rebase_token(typed->collection, from, to, length);
2146
+ ast_rebase_token(typed->object, from, to, length);
2147
+ ast_rebase_token(typed->as_name, from, to, length);
2148
+ ast_rebase_token(typed->spacer_template, from, to, length);
2149
+ ast_rebase_token(typed->formats, from, to, length);
2150
+ ast_rebase_token(typed->variants, from, to, length);
2151
+ ast_rebase_token(typed->handlers, from, to, length);
2152
+ ast_rebase_token(typed->content_type, from, to, length);
2153
+ if (typed->locals != NULL) {
2154
+ for (size_t i = 0; i < hb_array_size(typed->locals); i++) {
2155
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->locals, i), from, to, length);
2156
+ }
2157
+ }
2158
+ if (typed->state != NULL) {
2159
+ for (size_t i = 0; i < hb_array_size(typed->state); i++) {
2160
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->state, i), from, to, length);
2161
+ }
2162
+ }
2163
+ break;
2164
+ }
2165
+ case AST_ERB_RENDER_NODE: {
2166
+ AST_ERB_RENDER_NODE_T* typed = (AST_ERB_RENDER_NODE_T*) node;
2167
+ ast_rebase_token(typed->tag_opening, from, to, length);
2168
+ ast_rebase_token(typed->content, from, to, length);
2169
+ ast_rebase_token(typed->tag_closing, from, to, length);
2170
+ ast_node_rebase_tokens((AST_NODE_T*) typed->keywords, from, to, length);
2171
+ if (typed->body != NULL) {
2172
+ for (size_t i = 0; i < hb_array_size(typed->body); i++) {
2173
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->body, i), from, to, length);
2174
+ }
2175
+ }
2176
+ if (typed->block_arguments != NULL) {
2177
+ for (size_t i = 0; i < hb_array_size(typed->block_arguments); i++) {
2178
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->block_arguments, i), from, to, length);
2179
+ }
2180
+ }
2181
+ ast_node_rebase_tokens((AST_NODE_T*) typed->rescue_clause, from, to, length);
2182
+ ast_node_rebase_tokens((AST_NODE_T*) typed->else_clause, from, to, length);
2183
+ ast_node_rebase_tokens((AST_NODE_T*) typed->ensure_clause, from, to, length);
2184
+ ast_node_rebase_tokens((AST_NODE_T*) typed->end_node, from, to, length);
2185
+ break;
2186
+ }
2187
+ case AST_RUBY_PARAMETER_NODE: {
2188
+ AST_RUBY_PARAMETER_NODE_T* typed = (AST_RUBY_PARAMETER_NODE_T*) node;
2189
+ ast_rebase_token(typed->name, from, to, length);
2190
+ ast_node_rebase_tokens((AST_NODE_T*) typed->default_value, from, to, length);
2191
+ break;
2192
+ }
2193
+ case AST_ERB_STRICT_LOCALS_NODE: {
2194
+ AST_ERB_STRICT_LOCALS_NODE_T* typed = (AST_ERB_STRICT_LOCALS_NODE_T*) node;
2195
+ ast_rebase_token(typed->tag_opening, from, to, length);
2196
+ ast_rebase_token(typed->content, from, to, length);
2197
+ ast_rebase_token(typed->tag_closing, from, to, length);
2198
+ if (typed->locals != NULL) {
2199
+ for (size_t i = 0; i < hb_array_size(typed->locals); i++) {
2200
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->locals, i), from, to, length);
2201
+ }
2202
+ }
2203
+ break;
2204
+ }
2205
+ case AST_ERB_YIELD_NODE: {
2206
+ AST_ERB_YIELD_NODE_T* typed = (AST_ERB_YIELD_NODE_T*) node;
2207
+ ast_rebase_token(typed->tag_opening, from, to, length);
2208
+ ast_rebase_token(typed->content, from, to, length);
2209
+ ast_rebase_token(typed->tag_closing, from, to, length);
2210
+ break;
2211
+ }
2212
+ case AST_ERB_IN_NODE: {
2213
+ AST_ERB_IN_NODE_T* typed = (AST_ERB_IN_NODE_T*) node;
2214
+ ast_rebase_token(typed->tag_opening, from, to, length);
2215
+ ast_rebase_token(typed->content, from, to, length);
2216
+ ast_rebase_token(typed->tag_closing, from, to, length);
2217
+ if (typed->statements != NULL) {
2218
+ for (size_t i = 0; i < hb_array_size(typed->statements); i++) {
2219
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->statements, i), from, to, length);
2220
+ }
2221
+ }
2222
+ break;
2223
+ }
2224
+ case AST_HERB_DIRECTIVE_NODE: {
2225
+ AST_HERB_DIRECTIVE_NODE_T* typed = (AST_HERB_DIRECTIVE_NODE_T*) node;
2226
+ ast_rebase_token(typed->tag_opening, from, to, length);
2227
+ ast_rebase_token(typed->content, from, to, length);
2228
+ ast_rebase_token(typed->tag_closing, from, to, length);
2229
+ ast_rebase_token(typed->key, from, to, length);
2230
+ ast_rebase_token(typed->arguments, from, to, length);
2231
+ break;
2232
+ }
2233
+ case AST_HERB_STATE_DECLARATION_NODE: {
2234
+ AST_HERB_STATE_DECLARATION_NODE_T* typed = (AST_HERB_STATE_DECLARATION_NODE_T*) node;
2235
+ ast_rebase_token(typed->name, from, to, length);
2236
+ ast_node_rebase_tokens((AST_NODE_T*) typed->default_value, from, to, length);
2237
+ break;
2238
+ }
2239
+ case AST_HERB_STATE_DIRECTIVE_NODE: {
2240
+ AST_HERB_STATE_DIRECTIVE_NODE_T* typed = (AST_HERB_STATE_DIRECTIVE_NODE_T*) node;
2241
+ ast_rebase_token(typed->tag_opening, from, to, length);
2242
+ ast_rebase_token(typed->content, from, to, length);
2243
+ ast_rebase_token(typed->tag_closing, from, to, length);
2244
+ ast_rebase_token(typed->key, from, to, length);
2245
+ ast_rebase_token(typed->signature, from, to, length);
2246
+ if (typed->states != NULL) {
2247
+ for (size_t i = 0; i < hb_array_size(typed->states); i++) {
2248
+ ast_node_rebase_tokens((AST_NODE_T*) hb_array_get(typed->states, i), from, to, length);
2249
+ }
2250
+ }
2251
+ break;
2252
+ }
2253
+ case AST_ERB_COMMENT_NODE: {
2254
+ AST_ERB_COMMENT_NODE_T* typed = (AST_ERB_COMMENT_NODE_T*) node;
2255
+ ast_rebase_token(typed->tag_opening, from, to, length);
2256
+ ast_rebase_token(typed->content, from, to, length);
2257
+ ast_rebase_token(typed->tag_closing, from, to, length);
2258
+ break;
2259
+ }
2260
+ }
2261
+ }
2262
+
1470
2263
  void ast_node_free(AST_NODE_T* node, hb_allocator_T* allocator) {
1471
2264
  if (!node) { return; }
1472
2265
 
@@ -1490,6 +2283,7 @@ void ast_node_free(AST_NODE_T* node, hb_allocator_T* allocator) {
1490
2283
  case AST_HTML_COMMENT_NODE: ast_free_html_comment_node((AST_HTML_COMMENT_NODE_T*) node, allocator); break;
1491
2284
  case AST_HTML_DOCTYPE_NODE: ast_free_html_doctype_node((AST_HTML_DOCTYPE_NODE_T*) node, allocator); break;
1492
2285
  case AST_XML_DECLARATION_NODE: ast_free_xml_declaration_node((AST_XML_DECLARATION_NODE_T*) node, allocator); break;
2286
+ case AST_XML_PROCESSING_INSTRUCTION_NODE: ast_free_xml_processing_instruction_node((AST_XML_PROCESSING_INSTRUCTION_NODE_T*) node, allocator); break;
1493
2287
  case AST_CDATA_NODE: ast_free_cdata_node((AST_CDATA_NODE_T*) node, allocator); break;
1494
2288
  case AST_WHITESPACE_NODE: ast_free_whitespace_node((AST_WHITESPACE_NODE_T*) node, allocator); break;
1495
2289
  case AST_ERB_CONTENT_NODE: ast_free_erb_content_node((AST_ERB_CONTENT_NODE_T*) node, allocator); break;
@@ -1497,6 +2291,7 @@ void ast_node_free(AST_NODE_T* node, hb_allocator_T* allocator) {
1497
2291
  case AST_ERB_ELSE_NODE: ast_free_erb_else_node((AST_ERB_ELSE_NODE_T*) node, allocator); break;
1498
2292
  case AST_ERB_IF_NODE: ast_free_erb_if_node((AST_ERB_IF_NODE_T*) node, allocator); break;
1499
2293
  case AST_ERB_BLOCK_NODE: ast_free_erb_block_node((AST_ERB_BLOCK_NODE_T*) node, allocator); break;
2294
+ case AST_ERB_ITERATION_BLOCK_NODE: ast_free_erb_iteration_block_node((AST_ERB_ITERATION_BLOCK_NODE_T*) node, allocator); break;
1500
2295
  case AST_ERB_WHEN_NODE: ast_free_erb_when_node((AST_ERB_WHEN_NODE_T*) node, allocator); break;
1501
2296
  case AST_ERB_CASE_NODE: ast_free_erb_case_node((AST_ERB_CASE_NODE_T*) node, allocator); break;
1502
2297
  case AST_ERB_CASE_MATCH_NODE: ast_free_erb_case_match_node((AST_ERB_CASE_MATCH_NODE_T*) node, allocator); break;
@@ -1514,5 +2309,9 @@ void ast_node_free(AST_NODE_T* node, hb_allocator_T* allocator) {
1514
2309
  case AST_ERB_STRICT_LOCALS_NODE: ast_free_erb_strict_locals_node((AST_ERB_STRICT_LOCALS_NODE_T*) node, allocator); break;
1515
2310
  case AST_ERB_YIELD_NODE: ast_free_erb_yield_node((AST_ERB_YIELD_NODE_T*) node, allocator); break;
1516
2311
  case AST_ERB_IN_NODE: ast_free_erb_in_node((AST_ERB_IN_NODE_T*) node, allocator); break;
2312
+ case AST_HERB_DIRECTIVE_NODE: ast_free_herb_directive_node((AST_HERB_DIRECTIVE_NODE_T*) node, allocator); break;
2313
+ case AST_HERB_STATE_DECLARATION_NODE: ast_free_herb_state_declaration_node((AST_HERB_STATE_DECLARATION_NODE_T*) node, allocator); break;
2314
+ case AST_HERB_STATE_DIRECTIVE_NODE: ast_free_herb_state_directive_node((AST_HERB_STATE_DIRECTIVE_NODE_T*) node, allocator); break;
2315
+ case AST_ERB_COMMENT_NODE: ast_free_erb_comment_node((AST_ERB_COMMENT_NODE_T*) node, allocator); break;
1517
2316
  }
1518
2317
  }