herb 0.10.4 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +16 -6
- data/README.md +36 -119
- data/Rakefile +2 -11
- data/config/action_view_helpers/actioncable/action_cable_helper/action_cable_meta_tag.yml +12 -8
- data/config/action_view_helpers/actionpack/content_security_policy/content_security_policy?.yml +9 -6
- data/config/action_view_helpers/actionpack/content_security_policy/content_security_policy_nonce.yml +9 -6
- data/config/action_view_helpers/actionpack/polymorphic_routes/polymorphic_path.yml +20 -12
- data/config/action_view_helpers/actionpack/polymorphic_routes/polymorphic_url.yml +30 -18
- data/config/action_view_helpers/actionpack/request_forgery_protection/form_authenticity_token.yml +15 -9
- data/config/action_view_helpers/actionpack/request_forgery_protection/protect_against_forgery?.yml +9 -6
- data/config/action_view_helpers/actiontext/content_helper/render_action_text_content.yml +15 -9
- data/config/action_view_helpers/actiontext/content_helper/sanitize_action_text_content.yml +15 -9
- data/config/action_view_helpers/actiontext/tag_helper/rich_textarea_tag.yml +34 -22
- data/config/action_view_helpers/actionview/active_model_helper/error_message.yml +9 -6
- data/config/action_view_helpers/actionview/active_model_helper/error_wrapping.yml +9 -6
- data/config/action_view_helpers/actionview/active_model_helper/object.yml +9 -6
- data/config/action_view_helpers/actionview/asset_tag_helper/apply_stylesheet_media_default.yml +9 -6
- data/config/action_view_helpers/actionview/asset_tag_helper/audio_tag.yml +40 -27
- data/config/action_view_helpers/actionview/asset_tag_helper/auto_discovery_link_tag.yml +37 -23
- data/config/action_view_helpers/actionview/asset_tag_helper/auto_include_nonce.yml +9 -6
- data/config/action_view_helpers/actionview/asset_tag_helper/auto_include_nonce_for_scripts.yml +9 -6
- data/config/action_view_helpers/actionview/asset_tag_helper/auto_include_nonce_for_styles.yml +9 -6
- data/config/action_view_helpers/actionview/asset_tag_helper/favicon_link_tag.yml +32 -22
- data/config/action_view_helpers/actionview/asset_tag_helper/image_decoding.yml +9 -6
- data/config/action_view_helpers/actionview/asset_tag_helper/image_loading.yml +9 -6
- data/config/action_view_helpers/actionview/asset_tag_helper/image_tag.yml +67 -46
- data/config/action_view_helpers/actionview/asset_tag_helper/javascript_include_tag.yml +58 -39
- data/config/action_view_helpers/actionview/asset_tag_helper/picture_tag.yml +22 -14
- data/config/action_view_helpers/actionview/asset_tag_helper/preload_link_tag.yml +45 -30
- data/config/action_view_helpers/actionview/asset_tag_helper/preload_links_header.yml +9 -6
- data/config/action_view_helpers/actionview/asset_tag_helper/stylesheet_link_tag.yml +49 -30
- data/config/action_view_helpers/actionview/asset_tag_helper/video_tag.yml +53 -35
- data/config/action_view_helpers/actionview/asset_url_helper/asset_path.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/asset_url.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/audio_path.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/audio_url.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/compute_asset_extname.yml +9 -6
- data/config/action_view_helpers/actionview/asset_url_helper/compute_asset_host.yml +9 -6
- data/config/action_view_helpers/actionview/asset_url_helper/compute_asset_path.yml +9 -6
- data/config/action_view_helpers/actionview/asset_url_helper/font_path.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/font_url.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/image_path.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/image_url.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/javascript_path.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/javascript_url.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/public_compute_asset_path.yml +9 -6
- data/config/action_view_helpers/actionview/asset_url_helper/stylesheet_path.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/stylesheet_url.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/video_path.yml +16 -10
- data/config/action_view_helpers/actionview/asset_url_helper/video_url.yml +16 -10
- data/config/action_view_helpers/actionview/atom_feed_helper/atom_feed.yml +52 -27
- data/config/action_view_helpers/actionview/cache_helper/cache.yml +25 -15
- data/config/action_view_helpers/actionview/cache_helper/cache_fragment_name.yml +9 -6
- data/config/action_view_helpers/actionview/cache_helper/cache_if.yml +20 -12
- data/config/action_view_helpers/actionview/cache_helper/cache_unless.yml +20 -12
- data/config/action_view_helpers/actionview/cache_helper/caching_predicate.yml +9 -6
- data/config/action_view_helpers/actionview/cache_helper/digest_path_from_template.yml +9 -6
- data/config/action_view_helpers/actionview/cache_helper/fragment_for.yml +9 -6
- data/config/action_view_helpers/actionview/cache_helper/fragment_name_with_digest.yml +9 -6
- data/config/action_view_helpers/actionview/cache_helper/read_fragment_for.yml +9 -6
- data/config/action_view_helpers/actionview/cache_helper/uncacheable.yml +9 -6
- data/config/action_view_helpers/actionview/cache_helper/write_fragment_for.yml +9 -6
- data/config/action_view_helpers/actionview/capture_helper/capture.yml +9 -6
- data/config/action_view_helpers/actionview/capture_helper/content_for.yml +20 -12
- data/config/action_view_helpers/actionview/capture_helper/content_for_predicate.yml +15 -9
- data/config/action_view_helpers/actionview/capture_helper/provide.yml +15 -9
- data/config/action_view_helpers/actionview/capture_helper/with_output_buffer.yml +9 -6
- data/config/action_view_helpers/actionview/content_exfiltration_prevention_helper/prepend_content_exfiltration_prevention.yml +9 -6
- data/config/action_view_helpers/actionview/content_exfiltration_prevention_helper/prevent_content_exfiltration.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/action_name.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/assign_controller.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/controller.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/controller_name.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/controller_path.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/cookies.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/flash.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/headers.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/logger.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/params.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/request.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/request_forgery_protection_token.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/response.yml +9 -6
- data/config/action_view_helpers/actionview/controller_helper/session.yml +9 -6
- data/config/action_view_helpers/actionview/csp_helper/csp_meta_tag.yml +18 -11
- data/config/action_view_helpers/actionview/csrf_helper/csrf_meta_tags.yml +16 -10
- data/config/action_view_helpers/actionview/date_helper/date_select.yml +85 -51
- data/config/action_view_helpers/actionview/date_helper/datetime_select.yml +65 -39
- data/config/action_view_helpers/actionview/date_helper/distance_of_time_in_words.yml +30 -18
- data/config/action_view_helpers/actionview/date_helper/relative_time_in_words.yml +35 -21
- data/config/action_view_helpers/actionview/date_helper/select_date.yml +50 -30
- data/config/action_view_helpers/actionview/date_helper/select_datetime.yml +65 -39
- data/config/action_view_helpers/actionview/date_helper/select_day.yml +40 -24
- data/config/action_view_helpers/actionview/date_helper/select_hour.yml +50 -30
- data/config/action_view_helpers/actionview/date_helper/select_minute.yml +40 -24
- data/config/action_view_helpers/actionview/date_helper/select_month.yml +60 -36
- data/config/action_view_helpers/actionview/date_helper/select_second.yml +35 -21
- data/config/action_view_helpers/actionview/date_helper/select_time.yml +55 -33
- data/config/action_view_helpers/actionview/date_helper/select_year.yml +45 -27
- data/config/action_view_helpers/actionview/date_helper/time_ago_in_words.yml +21 -13
- data/config/action_view_helpers/actionview/date_helper/time_select.yml +60 -36
- data/config/action_view_helpers/actionview/date_helper/time_tag.yml +32 -20
- data/config/action_view_helpers/actionview/debug_helper/debug.yml +15 -9
- data/config/action_view_helpers/actionview/form_builder/button.yml +60 -0
- data/config/action_view_helpers/actionview/form_builder/submit.yml +48 -0
- data/config/action_view_helpers/actionview/form_helper/apply_form_for_options.yml +9 -6
- data/config/action_view_helpers/actionview/form_helper/checkbox.yml +41 -25
- data/config/action_view_helpers/actionview/form_helper/color_field.yml +25 -15
- data/config/action_view_helpers/actionview/form_helper/date_field.yml +35 -21
- data/config/action_view_helpers/actionview/form_helper/datetime_field.yml +41 -25
- data/config/action_view_helpers/actionview/form_helper/email_field.yml +25 -15
- data/config/action_view_helpers/actionview/form_helper/emitted_hidden_id.yml +9 -6
- data/config/action_view_helpers/actionview/form_helper/fields.yml +37 -18
- data/config/action_view_helpers/actionview/form_helper/fields_for.yml +33 -15
- data/config/action_view_helpers/actionview/form_helper/file_field.yml +45 -27
- data/config/action_view_helpers/actionview/form_helper/form_for.yml +45 -24
- data/config/action_view_helpers/actionview/form_helper/form_with.yml +56 -30
- data/config/action_view_helpers/actionview/form_helper/form_with_generates_ids.yml +9 -6
- data/config/action_view_helpers/actionview/form_helper/form_with_generates_remote_forms.yml +9 -6
- data/config/action_view_helpers/actionview/form_helper/hidden_field.yml +25 -15
- data/config/action_view_helpers/actionview/form_helper/label.yml +52 -27
- data/config/action_view_helpers/actionview/form_helper/month_field.yml +25 -15
- data/config/action_view_helpers/actionview/form_helper/multipart.yml +9 -6
- data/config/action_view_helpers/actionview/form_helper/multiple_file_field_include_hidden.yml +9 -6
- data/config/action_view_helpers/actionview/form_helper/number_field.yml +45 -27
- data/config/action_view_helpers/actionview/form_helper/password_field.yml +25 -15
- data/config/action_view_helpers/actionview/form_helper/radio_button.yml +30 -18
- data/config/action_view_helpers/actionview/form_helper/range_field.yml +45 -27
- data/config/action_view_helpers/actionview/form_helper/search_field.yml +25 -15
- data/config/action_view_helpers/actionview/form_helper/telephone_field.yml +26 -16
- data/config/action_view_helpers/actionview/form_helper/text_field.yml +25 -15
- data/config/action_view_helpers/actionview/form_helper/textarea.yml +31 -19
- data/config/action_view_helpers/actionview/form_helper/time_field.yml +40 -24
- data/config/action_view_helpers/actionview/form_helper/url_field.yml +25 -15
- data/config/action_view_helpers/actionview/form_helper/week_field.yml +25 -15
- data/config/action_view_helpers/actionview/form_options_helper/collection_checkboxes.yml +58 -31
- data/config/action_view_helpers/actionview/form_options_helper/collection_radio_buttons.yml +57 -30
- data/config/action_view_helpers/actionview/form_options_helper/collection_select.yml +65 -39
- data/config/action_view_helpers/actionview/form_options_helper/grouped_collection_select.yml +65 -39
- data/config/action_view_helpers/actionview/form_options_helper/grouped_options_for_select.yml +35 -21
- data/config/action_view_helpers/actionview/form_options_helper/option_groups_from_collection_for_select.yml +40 -24
- data/config/action_view_helpers/actionview/form_options_helper/options_for_select.yml +20 -12
- data/config/action_view_helpers/actionview/form_options_helper/options_from_collection_for_select.yml +30 -18
- data/config/action_view_helpers/actionview/form_options_helper/select.yml +60 -36
- data/config/action_view_helpers/actionview/form_options_helper/time_zone_options_for_select.yml +25 -15
- data/config/action_view_helpers/actionview/form_options_helper/time_zone_select.yml +50 -30
- data/config/action_view_helpers/actionview/form_options_helper/weekday_options_for_select.yml +30 -18
- data/config/action_view_helpers/actionview/form_options_helper/weekday_select.yml +30 -18
- data/config/action_view_helpers/actionview/form_tag_helper/button_tag.yml +39 -21
- data/config/action_view_helpers/actionview/form_tag_helper/checkbox_tag.yml +33 -21
- data/config/action_view_helpers/actionview/form_tag_helper/color_field_tag.yml +26 -17
- data/config/action_view_helpers/actionview/form_tag_helper/date_field_tag.yml +27 -17
- data/config/action_view_helpers/actionview/form_tag_helper/datetime_field_tag.yml +28 -18
- data/config/action_view_helpers/actionview/form_tag_helper/default_enforce_utf8.yml +9 -6
- data/config/action_view_helpers/actionview/form_tag_helper/email_field_tag.yml +27 -17
- data/config/action_view_helpers/actionview/form_tag_helper/embed_authenticity_token_in_remote_forms.yml +9 -6
- data/config/action_view_helpers/actionview/form_tag_helper/field_id.yml +30 -18
- data/config/action_view_helpers/actionview/form_tag_helper/field_name.yml +30 -18
- data/config/action_view_helpers/actionview/form_tag_helper/field_set_tag.yml +23 -15
- data/config/action_view_helpers/actionview/form_tag_helper/file_field_tag.yml +35 -22
- data/config/action_view_helpers/actionview/form_tag_helper/form_tag.yml +38 -24
- data/config/action_view_helpers/actionview/form_tag_helper/hidden_field_tag.yml +27 -17
- data/config/action_view_helpers/actionview/form_tag_helper/image_submit_tag.yml +31 -21
- data/config/action_view_helpers/actionview/form_tag_helper/label_tag.yml +33 -17
- data/config/action_view_helpers/actionview/form_tag_helper/month_field_tag.yml +27 -17
- data/config/action_view_helpers/actionview/form_tag_helper/number_field_tag.yml +47 -29
- data/config/action_view_helpers/actionview/form_tag_helper/password_field_tag.yml +27 -17
- data/config/action_view_helpers/actionview/form_tag_helper/radio_button_tag.yml +32 -20
- data/config/action_view_helpers/actionview/form_tag_helper/range_field_tag.yml +47 -29
- data/config/action_view_helpers/actionview/form_tag_helper/search_field_tag.yml +27 -17
- data/config/action_view_helpers/actionview/form_tag_helper/select_tag.yml +47 -29
- data/config/action_view_helpers/actionview/form_tag_helper/submit_tag.yml +33 -21
- data/config/action_view_helpers/actionview/form_tag_helper/telephone_field_tag.yml +28 -18
- data/config/action_view_helpers/actionview/form_tag_helper/text_field_tag.yml +27 -17
- data/config/action_view_helpers/actionview/form_tag_helper/textarea_tag.yml +31 -20
- data/config/action_view_helpers/actionview/form_tag_helper/time_field_tag.yml +27 -17
- data/config/action_view_helpers/actionview/form_tag_helper/url_field_tag.yml +27 -17
- data/config/action_view_helpers/actionview/form_tag_helper/utf8_enforcer_tag.yml +9 -6
- data/config/action_view_helpers/actionview/form_tag_helper/week_field_tag.yml +28 -18
- data/config/action_view_helpers/actionview/javascript_helper/escape_javascript.yml +16 -10
- data/config/action_view_helpers/actionview/javascript_helper/javascript_cdata_section.yml +9 -6
- data/config/action_view_helpers/actionview/javascript_helper/javascript_tag.yml +41 -27
- data/config/action_view_helpers/actionview/number_helper/number_to_currency.yml +29 -18
- data/config/action_view_helpers/actionview/number_helper/number_to_human.yml +25 -15
- data/config/action_view_helpers/actionview/number_helper/number_to_human_size.yml +20 -12
- data/config/action_view_helpers/actionview/number_helper/number_to_percentage.yml +20 -12
- data/config/action_view_helpers/actionview/number_helper/number_to_phone.yml +33 -20
- data/config/action_view_helpers/actionview/number_helper/number_with_delimiter.yml +21 -13
- data/config/action_view_helpers/actionview/number_helper/number_with_precision.yml +25 -15
- data/config/action_view_helpers/actionview/output_safety_helper/raw.yml +15 -9
- data/config/action_view_helpers/actionview/output_safety_helper/safe_join.yml +20 -12
- data/config/action_view_helpers/actionview/output_safety_helper/to_sentence.yml +24 -15
- data/config/action_view_helpers/actionview/record_identifier/dom_class.yml +20 -12
- data/config/action_view_helpers/actionview/record_identifier/dom_id.yml +20 -12
- data/config/action_view_helpers/actionview/record_identifier/dom_target.yml +15 -9
- data/config/action_view_helpers/actionview/record_identifier/model_name_from_record_or_class.yml +9 -6
- data/config/action_view_helpers/actionview/rendering_helper/render.yml +108 -22
- data/config/action_view_helpers/actionview/sanitize_helper/sanitize.yml +25 -15
- data/config/action_view_helpers/actionview/sanitize_helper/sanitize_css.yml +15 -9
- data/config/action_view_helpers/actionview/sanitize_helper/sanitizer_vendor.yml +9 -6
- data/config/action_view_helpers/actionview/sanitize_helper/strip_links.yml +15 -9
- data/config/action_view_helpers/actionview/sanitize_helper/strip_tags.yml +15 -9
- data/config/action_view_helpers/actionview/tag_helper/cdata_section.yml +15 -9
- data/config/action_view_helpers/actionview/tag_helper/content_tag.yml +59 -38
- data/config/action_view_helpers/actionview/tag_helper/escape_once.yml +15 -9
- data/config/action_view_helpers/actionview/tag_helper/tag.yml +54 -31
- data/config/action_view_helpers/actionview/tag_helper/token_list.yml +16 -10
- data/config/action_view_helpers/actionview/text_helper/concat.yml +15 -9
- data/config/action_view_helpers/actionview/text_helper/current_cycle.yml +15 -9
- data/config/action_view_helpers/actionview/text_helper/cycle.yml +23 -14
- data/config/action_view_helpers/actionview/text_helper/excerpt.yml +33 -20
- data/config/action_view_helpers/actionview/text_helper/highlight.yml +37 -18
- data/config/action_view_helpers/actionview/text_helper/pluralize.yml +30 -18
- data/config/action_view_helpers/actionview/text_helper/reset_cycle.yml +15 -9
- data/config/action_view_helpers/actionview/text_helper/safe_concat.yml +9 -6
- data/config/action_view_helpers/actionview/text_helper/simple_format.yml +33 -20
- data/config/action_view_helpers/actionview/text_helper/truncate.yml +38 -23
- data/config/action_view_helpers/actionview/text_helper/word_wrap.yml +25 -15
- data/config/action_view_helpers/actionview/translation_helper/debug_missing_translation.yml +9 -6
- data/config/action_view_helpers/actionview/translation_helper/localize.yml +26 -16
- data/config/action_view_helpers/actionview/translation_helper/translate.yml +31 -19
- data/config/action_view_helpers/actionview/url_helper/button_to.yml +57 -33
- data/config/action_view_helpers/actionview/url_helper/button_to_generates_button_tag.yml +9 -6
- data/config/action_view_helpers/actionview/url_helper/current_page?.yml +25 -15
- data/config/action_view_helpers/actionview/url_helper/link_to.yml +76 -53
- data/config/action_view_helpers/actionview/url_helper/link_to_if.yml +54 -20
- data/config/action_view_helpers/actionview/url_helper/link_to_unless.yml +54 -20
- data/config/action_view_helpers/actionview/url_helper/link_to_unless_current.yml +49 -17
- data/config/action_view_helpers/actionview/url_helper/mail_to.yml +60 -34
- data/config/action_view_helpers/actionview/url_helper/phone_to.yml +40 -22
- data/config/action_view_helpers/actionview/url_helper/sms_to.yml +45 -25
- data/config/action_view_helpers/actionview/url_helper/url_for.yml +15 -9
- data/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_import_module_tag.yml +32 -0
- data/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_module_preload_tags.yml +39 -0
- data/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_importmap_tags.yml +35 -0
- data/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_inline_importmap_tag.yml +32 -0
- data/config/action_view_helpers/importmap-rails/importmap_tags_helper/javascript_module_preload_tag.yml +35 -0
- data/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_cache.yml +9 -6
- data/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_cache_tag.yml +12 -8
- data/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_preview.yml +9 -6
- data/config/action_view_helpers/turbo-rails/drive_helper/turbo_exempts_page_from_preview_tag.yml +12 -8
- data/config/action_view_helpers/turbo-rails/drive_helper/turbo_page_requires_reload.yml +9 -6
- data/config/action_view_helpers/turbo-rails/drive_helper/turbo_page_requires_reload_tag.yml +12 -8
- data/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_method_tag.yml +17 -11
- data/config/action_view_helpers/turbo-rails/drive_helper/turbo_refresh_scroll_tag.yml +17 -11
- data/config/action_view_helpers/turbo-rails/drive_helper/turbo_refreshes_with.yml +20 -12
- data/config/action_view_helpers/turbo-rails/frames_helper/turbo_frame_tag.yml +54 -33
- data/config/action_view_helpers/turbo-rails/includes_helper/turbo_include_tags.yml +9 -6
- data/config/action_view_helpers/turbo-rails/streams_action_helper/turbo_stream_action_tag.yml +32 -20
- data/config/action_view_helpers/turbo-rails/streams_action_helper/turbo_stream_refresh_tag.yml +18 -11
- data/config/action_view_helpers/turbo-rails/streams_helper/turbo_stream.yml +9 -6
- data/config/action_view_helpers/turbo-rails/streams_helper/turbo_stream_from.yml +28 -18
- data/config/html_elements.yml +597 -0
- data/config/options.yml +1 -0
- data/config/slots/components.yml +52 -0
- data/config/state/kind.yml +61 -0
- data/config/state/operators.yml +27 -0
- data/config/state/predicates.yml +39 -0
- data/config/state/transforms.yml +18 -0
- data/config/view_context_methods/actionview/base/annotate_rendered_view_with_filenames.yml +4 -4
- data/config/view_context_methods/actionview/base/assign.yml +4 -4
- data/config/view_context_methods/actionview/base/assigns.yml +4 -4
- data/config/view_context_methods/actionview/base/automatically_disable_submit_tag.yml +4 -4
- data/config/view_context_methods/actionview/base/compiled_method_container.yml +4 -4
- data/config/view_context_methods/actionview/base/config.yml +4 -4
- data/config/view_context_methods/actionview/base/default_form_builder.yml +4 -4
- data/config/view_context_methods/actionview/base/default_formats.yml +4 -4
- data/config/view_context_methods/actionview/base/field_error_proc.yml +4 -4
- data/config/view_context_methods/actionview/base/formats.yml +4 -4
- data/config/view_context_methods/actionview/base/in_rendering_context.yml +4 -4
- data/config/view_context_methods/actionview/base/locale.yml +4 -4
- data/config/view_context_methods/actionview/base/lookup_context.yml +4 -4
- data/config/view_context_methods/actionview/base/output_buffer.yml +4 -4
- data/config/view_context_methods/actionview/base/prefix_partial_path_with_controller_namespace.yml +4 -4
- data/config/view_context_methods/actionview/base/remove_hidden_field_autocomplete.yml +4 -4
- data/config/view_context_methods/actionview/base/streaming_completion_on_exception.yml +4 -4
- data/config/view_context_methods/actionview/base/view_flow.yml +4 -4
- data/config/view_context_methods/actionview/base/view_paths.yml +4 -4
- data/config/view_context_methods/actionview/base/view_renderer.yml +4 -4
- data/config/view_context_methods/actionview/template/local_assigns.yml +4 -4
- data/config/view_context_methods/activemodel/conversion/convert_to_model.yml +4 -4
- data/config/view_context_methods/activesupport/benchmarkable/benchmark.yml +4 -4
- data/config.yml +1240 -790
- data/exe/herb +2 -0
- data/ext/herb/error_helpers.c +355 -17
- data/ext/herb/error_helpers.h +1 -1
- data/ext/herb/extconf.rb +4 -2
- data/ext/herb/extension.c +137 -89
- data/ext/herb/extension_helpers.c +81 -42
- data/ext/herb/extension_helpers.h +4 -1
- data/ext/herb/nodes.c +826 -358
- data/ext/herb/nodes.h +3 -2
- data/ext/herb/parser_options_helpers.c +151 -0
- data/ext/herb/parser_options_helpers.h +14 -0
- data/herb.gemspec +2 -2
- data/lib/herb/action_view/helper_registry.rb +1358 -62
- data/lib/herb/analysis/partial_declaration.rb +140 -0
- data/lib/herb/analysis/partial_index.rb +189 -0
- data/lib/herb/analysis/partial_resolution.rb +161 -0
- data/lib/herb/analysis/partial_resolver.rb +144 -0
- data/lib/herb/analysis/project_index.rb +152 -0
- data/lib/herb/{action_view → analysis}/render_analyzer.rb +287 -77
- data/lib/herb/analysis/render_graph/ancestor_chain.rb +27 -0
- data/lib/herb/analysis/render_graph/builder.rb +376 -0
- data/lib/herb/analysis/render_graph/call_frame.rb +9 -0
- data/lib/herb/analysis/render_graph/call_site_location.rb +23 -0
- data/lib/herb/analysis/render_graph/inferred_signature.rb +21 -0
- data/lib/herb/analysis/render_graph/partial_call_site.rb +40 -0
- data/lib/herb/analysis/render_graph/partial_context.rb +46 -0
- data/lib/herb/analysis/render_graph/template_roots.rb +31 -0
- data/lib/herb/analysis/render_graph.rb +285 -0
- data/lib/herb/analysis/ruby_locals_index/local.rb +25 -0
- data/lib/herb/analysis/ruby_locals_index/named_reference.rb +22 -0
- data/lib/herb/analysis/ruby_locals_index/offset_table.rb +44 -0
- data/lib/herb/analysis/ruby_locals_index/reference_collector.rb +80 -0
- data/lib/herb/analysis/ruby_locals_index/state_locals.rb +49 -0
- data/lib/herb/analysis/ruby_locals_index.rb +165 -0
- data/lib/herb/analysis/ruby_reference.rb +67 -0
- data/lib/herb/analysis/template_dependencies/dependency_collector.rb +179 -0
- data/lib/herb/analysis/template_dependencies/node_dependency_collector.rb +309 -0
- data/lib/herb/analysis/template_dependencies.rb +562 -0
- data/lib/herb/ast/erb_render_node.rb +26 -94
- data/lib/herb/ast/helpers.rb +90 -10
- data/lib/herb/ast/herb_directive_node.rb +18 -0
- data/lib/herb/ast/node.rb +32 -2
- data/lib/herb/ast/nodes.rb +1342 -105
- data/lib/herb/backend.rb +73 -0
- data/lib/herb/bootstrap.rb +3 -7
- data/lib/herb/cli.rb +550 -32
- data/lib/herb/colors.rb +14 -0
- data/lib/herb/configuration.rb +71 -35
- data/lib/herb/defaults.yml +2 -1
- data/lib/herb/dev/assets.rb +57 -0
- data/lib/herb/dev/classifier.rb +84 -0
- data/lib/herb/dev/embedded.rb +27 -0
- data/lib/herb/dev/pipeline.rb +305 -0
- data/lib/herb/dev/protocol.rb +221 -0
- data/lib/herb/dev/runner.rb +175 -175
- data/lib/herb/dev/server.rb +89 -26
- data/lib/herb/dev/server_entry.rb +41 -6
- data/lib/herb/dev/watcher.rb +181 -0
- data/lib/herb/dev.rb +163 -0
- data/lib/herb/diagnostic/formatter.rb +88 -0
- data/lib/herb/diagnostic.rb +172 -0
- data/lib/herb/diff/operation.rb +36 -0
- data/lib/herb/diff/result.rb +62 -0
- data/lib/herb/diff.rb +10 -0
- data/lib/herb/engine/collector.rb +62 -0
- data/lib/herb/engine/compiler.rb +346 -108
- data/lib/herb/engine/component_tags/constant_resolver.rb +28 -0
- data/lib/herb/engine/component_tags/partial_resolver.rb +54 -0
- data/lib/herb/engine/component_tags/resolver.rb +32 -0
- data/lib/herb/engine/component_tags/visitor.rb +231 -0
- data/lib/herb/engine/css_inliner/inliner.rb +101 -0
- data/lib/herb/engine/css_inliner/visitor.rb +174 -0
- data/lib/herb/engine/errors.rb +122 -0
- data/lib/herb/engine/helpers.rb +82 -0
- data/lib/herb/engine/inline_render/inliner.rb +122 -0
- data/lib/herb/engine/inline_render/visitor.rb +267 -0
- data/lib/herb/engine/runtime/entry.rb +62 -0
- data/lib/herb/engine/runtime/error_page.rb +362 -0
- data/lib/herb/engine/runtime/html_safe_assertions.rb +217 -0
- data/lib/herb/engine/runtime/journal/summary.rb +227 -0
- data/lib/herb/engine/runtime/journal.rb +379 -0
- data/lib/herb/engine/runtime/middleware.rb +212 -0
- data/lib/herb/engine/runtime/observations.rb +73 -0
- data/lib/herb/engine/runtime/report.rb +204 -0
- data/lib/herb/engine/runtime/session.rb +437 -0
- data/lib/herb/engine/runtime.rb +21 -0
- data/lib/herb/engine/scoped_style/channel.rb +66 -0
- data/lib/herb/engine/scoped_style/collector.rb +74 -0
- data/lib/herb/engine/scoped_style/visitor.rb +533 -0
- data/lib/herb/engine/slots/annotation.rb +98 -0
- data/lib/herb/engine/slots/bindings.rb +61 -0
- data/lib/herb/engine/slots/callee.rb +118 -0
- data/lib/herb/engine/slots/component_definitions.rb +67 -0
- data/lib/herb/engine/slots/components/async.rb +24 -0
- data/lib/herb/engine/slots/components/base.rb +132 -0
- data/lib/herb/engine/slots/components/deferred.rb +81 -0
- data/lib/herb/engine/slots/components/fallback.rb +27 -0
- data/lib/herb/engine/slots/components/fragment.rb +99 -0
- data/lib/herb/engine/slots/components/lazy.rb +24 -0
- data/lib/herb/engine/slots/components.rb +52 -0
- data/lib/herb/engine/slots/dependencies/channel.rb +72 -0
- data/lib/herb/engine/slots/dependencies.rb +269 -0
- data/lib/herb/engine/slots/dynamics_compiler.rb +854 -0
- data/lib/herb/engine/slots/identifier.rb +35 -0
- data/lib/herb/engine/slots/manifest/channel.rb +74 -0
- data/lib/herb/engine/slots/manifest/collector.rb +75 -0
- data/lib/herb/engine/slots/markers.rb +128 -0
- data/lib/herb/engine/slots/render_bindings.rb +141 -0
- data/lib/herb/engine/slots/schema_compiler.rb +94 -0
- data/lib/herb/engine/slots/state_anchor.rb +94 -0
- data/lib/herb/engine/slots/state_compiler.rb +1326 -0
- data/lib/herb/engine/slots/state_directives.rb +854 -0
- data/lib/herb/engine/slots/state_kinds.rb +54 -0
- data/lib/herb/engine/slots/state_operators.rb +36 -0
- data/lib/herb/engine/slots/state_overrides.rb +79 -0
- data/lib/herb/engine/slots/state_predicates.rb +65 -0
- data/lib/herb/engine/slots/state_transforms.rb +42 -0
- data/lib/herb/engine/slots/statics.rb +185 -0
- data/lib/herb/engine/slots/subtree.rb +82 -0
- data/lib/herb/engine/slots/subtree_compiler.rb +255 -0
- data/lib/herb/engine/slots/types.rb +42 -0
- data/lib/herb/engine/slots/visitor.rb +2256 -0
- data/lib/herb/engine/validators/accessibility_validator.rb +3 -3
- data/lib/herb/engine/validators/base.rb +36 -0
- data/lib/herb/engine/validators/generator_template_validator.rb +39 -0
- data/lib/herb/engine/validators/nesting_validator.rb +3 -3
- data/lib/herb/engine/validators/render_validator.rb +13 -33
- data/lib/herb/engine/validators/security_validator.rb +3 -17
- data/lib/herb/engine/validators.rb +43 -0
- data/lib/herb/engine/visitors/auto_close_omitted_tags_visitor.rb +48 -0
- data/lib/herb/engine/visitors/content_for_visitor.rb +127 -0
- data/lib/herb/engine/{debug_visitor.rb → visitors/debug_visitor.rb} +121 -93
- data/lib/herb/engine/visitors/html_safe_assertions_visitor.rb +281 -0
- data/lib/herb/engine/visitors/instrumentation_visitor.rb +290 -0
- data/lib/herb/engine/visitors/optimize_visitor.rb +728 -0
- data/lib/herb/engine/visitors/remove_comments_visitor.rb +106 -0
- data/lib/herb/engine/visitors/source_attribution_visitor.rb +177 -0
- data/lib/herb/engine.rb +218 -257
- data/lib/herb/ensure_installed.rb +43 -0
- data/lib/herb/errors.rb +646 -157
- data/lib/herb/fingerprint.rb +82 -0
- data/lib/herb/html/elements.rb +18 -0
- data/lib/herb/html/util.rb +21 -2
- data/lib/herb/lex_result.rb +0 -10
- data/lib/herb/locate.rb +163 -0
- data/lib/herb/location.rb +20 -0
- data/lib/herb/parse_result.rb +17 -11
- data/lib/herb/parser_options.rb +65 -46
- data/lib/herb/position.rb +19 -0
- data/lib/herb/prism_inspect.rb +1 -4
- data/lib/herb/project.rb +28 -15
- data/lib/herb/range.rb +5 -0
- data/lib/herb/result.rb +2 -2
- data/lib/herb/ruby_program.rb +110 -0
- data/lib/herb/source_path.rb +232 -0
- data/lib/herb/token.rb +14 -3
- data/lib/herb/version.rb +1 -1
- data/lib/herb/visitor/context/origin.rb +52 -0
- data/lib/herb/visitor/context/replacements.rb +59 -0
- data/lib/herb/visitor/context.rb +169 -0
- data/lib/herb/visitor/context_aware.rb +45 -0
- data/lib/herb/visitor/diagnostics.rb +148 -0
- data/lib/herb/visitor/experimental.rb +33 -0
- data/lib/herb/visitor/parser_option_requirements.rb +151 -0
- data/lib/herb/visitor/stack.rb +192 -0
- data/lib/herb/visitor.rb +47 -1
- data/lib/herb/warnings.rb +25 -0
- data/lib/herb.rb +74 -63
- data/sig/herb/action_view/helper_registry.rbs +82 -10
- data/sig/herb/analysis/partial_declaration.rbs +80 -0
- data/sig/herb/analysis/partial_index.rbs +66 -0
- data/sig/herb/analysis/partial_resolution.rbs +57 -0
- data/sig/herb/analysis/partial_resolver.rbs +76 -0
- data/sig/herb/analysis/project_index.rbs +57 -0
- data/sig/herb/{action_view → analysis}/render_analyzer.rbs +25 -4
- data/sig/herb/analysis/render_graph/ancestor_chain.rbs +22 -0
- data/sig/herb/analysis/render_graph/builder.rbs +180 -0
- data/sig/herb/analysis/render_graph/call_frame.rbs +26 -0
- data/sig/herb/analysis/render_graph/call_site_location.rbs +28 -0
- data/sig/herb/analysis/render_graph/inferred_signature.rbs +27 -0
- data/sig/herb/analysis/render_graph/partial_call_site.rbs +36 -0
- data/sig/herb/analysis/render_graph/partial_context.rbs +31 -0
- data/sig/herb/analysis/render_graph/template_roots.rbs +32 -0
- data/sig/herb/analysis/render_graph.rbs +83 -0
- data/sig/herb/analysis/ruby_locals_index/local.rbs +21 -0
- data/sig/herb/analysis/ruby_locals_index/named_reference.rbs +20 -0
- data/sig/herb/analysis/ruby_locals_index/offset_table.rbs +26 -0
- data/sig/herb/analysis/ruby_locals_index/reference_collector.rbs +40 -0
- data/sig/herb/analysis/ruby_locals_index/state_locals.rbs +19 -0
- data/sig/herb/analysis/ruby_locals_index.rbs +62 -0
- data/sig/herb/analysis/ruby_reference.rbs +28 -0
- data/sig/herb/analysis/template_dependencies/dependency_collector.rbs +52 -0
- data/sig/herb/analysis/template_dependencies/node_dependency_collector.rbs +81 -0
- data/sig/herb/analysis/template_dependencies.rbs +125 -0
- data/sig/herb/ast/erb_render_node.rbs +10 -2
- data/sig/herb/ast/helpers.rbs +31 -1
- data/sig/herb/ast/herb_directive_node.rbs +13 -0
- data/sig/herb/ast/node.rbs +9 -0
- data/sig/herb/ast/nodes.rbs +662 -89
- data/sig/herb/backend.rbs +52 -0
- data/sig/herb/colors.rbs +3 -0
- data/sig/herb/configuration.rbs +27 -3
- data/sig/herb/dev/assets.rbs +27 -0
- data/sig/herb/dev/classifier.rbs +57 -0
- data/sig/herb/dev/embedded.rbs +21 -0
- data/sig/herb/dev/pipeline.rbs +118 -0
- data/sig/herb/dev/protocol.rbs +78 -0
- data/sig/herb/dev/runner.rbs +61 -23
- data/sig/herb/dev/server.rbs +49 -22
- data/sig/herb/dev/server_entry.rbs +46 -21
- data/sig/herb/dev/watcher.rbs +84 -0
- data/sig/herb/dev.rbs +58 -0
- data/sig/herb/diagnostic/formatter.rbs +28 -0
- data/sig/herb/diagnostic.rbs +88 -0
- data/sig/herb/diff/operation.rbs +36 -0
- data/sig/herb/diff/result.rbs +36 -0
- data/sig/herb/diff.rbs +6 -0
- data/sig/herb/engine/collector.rbs +48 -0
- data/sig/herb/engine/compiler.rbs +62 -23
- data/sig/herb/engine/component_tags/constant_resolver.rbs +19 -0
- data/sig/herb/engine/component_tags/partial_resolver.rbs +30 -0
- data/sig/herb/engine/component_tags/resolver.rbs +25 -0
- data/sig/herb/engine/component_tags/visitor.rbs +69 -0
- data/sig/herb/engine/css_inliner/inliner.rbs +65 -0
- data/sig/herb/engine/css_inliner/visitor.rbs +87 -0
- data/sig/herb/engine/errors.rbs +68 -0
- data/sig/herb/engine/helpers.rbs +28 -0
- data/sig/herb/engine/inline_render/inliner.rbs +39 -0
- data/sig/herb/engine/inline_render/visitor.rbs +104 -0
- data/sig/herb/engine/runtime/entry.rbs +43 -0
- data/sig/herb/engine/runtime/error_page.rbs +115 -0
- data/sig/herb/engine/runtime/html_safe_assertions.rbs +99 -0
- data/sig/herb/engine/runtime/journal/summary.rbs +172 -0
- data/sig/herb/engine/runtime/journal.rbs +126 -0
- data/sig/herb/engine/runtime/middleware.rbs +96 -0
- data/sig/herb/engine/runtime/observations.rbs +38 -0
- data/sig/herb/engine/runtime/report.rbs +97 -0
- data/sig/herb/engine/runtime/session.rbs +233 -0
- data/sig/herb/engine/runtime.rbs +14 -0
- data/sig/herb/engine/scoped_style/channel.rbs +45 -0
- data/sig/herb/engine/scoped_style/collector.rbs +45 -0
- data/sig/herb/engine/scoped_style/visitor.rbs +220 -0
- data/sig/herb/engine/slots/annotation.rbs +72 -0
- data/sig/herb/engine/slots/bindings.rbs +34 -0
- data/sig/herb/engine/slots/callee.rbs +62 -0
- data/sig/herb/engine/slots/component_definitions.rbs +19 -0
- data/sig/herb/engine/slots/components/async.rbs +20 -0
- data/sig/herb/engine/slots/components/base.rbs +60 -0
- data/sig/herb/engine/slots/components/deferred.rbs +29 -0
- data/sig/herb/engine/slots/components/fallback.rbs +21 -0
- data/sig/herb/engine/slots/components/fragment.rbs +34 -0
- data/sig/herb/engine/slots/components/lazy.rbs +20 -0
- data/sig/herb/engine/slots/components.rbs +30 -0
- data/sig/herb/engine/slots/dependencies/channel.rbs +51 -0
- data/sig/herb/engine/slots/dependencies.rbs +94 -0
- data/sig/herb/engine/slots/dynamics_compiler.rbs +349 -0
- data/sig/herb/engine/slots/identifier.rbs +19 -0
- data/sig/herb/engine/slots/manifest/channel.rbs +49 -0
- data/sig/herb/engine/slots/manifest/collector.rbs +45 -0
- data/sig/herb/engine/slots/markers.rbs +85 -0
- data/sig/herb/engine/slots/render_bindings.rbs +69 -0
- data/sig/herb/engine/slots/schema_compiler.rbs +62 -0
- data/sig/herb/engine/slots/state_anchor.rbs +41 -0
- data/sig/herb/engine/slots/state_compiler.rbs +258 -0
- data/sig/herb/engine/slots/state_directives.rbs +278 -0
- data/sig/herb/engine/slots/state_kinds.rbs +24 -0
- data/sig/herb/engine/slots/state_operators.rbs +19 -0
- data/sig/herb/engine/slots/state_overrides.rbs +33 -0
- data/sig/herb/engine/slots/state_predicates.rbs +16 -0
- data/sig/herb/engine/slots/state_transforms.rbs +15 -0
- data/sig/herb/engine/slots/statics.rbs +67 -0
- data/sig/herb/engine/slots/subtree.rbs +49 -0
- data/sig/herb/engine/slots/subtree_compiler.rbs +130 -0
- data/sig/herb/engine/slots/types.rbs +46 -0
- data/sig/herb/engine/slots/visitor.rbs +599 -0
- data/sig/herb/engine/validators/accessibility_validator.rbs +1 -1
- data/sig/herb/engine/validators/base.rbs +28 -0
- data/sig/herb/engine/validators/generator_template_validator.rbs +19 -0
- data/sig/herb/engine/validators/nesting_validator.rbs +1 -1
- data/sig/herb/engine/validators/render_validator.rbs +2 -6
- data/sig/herb/engine/validators/security_validator.rbs +1 -3
- data/sig/herb/engine/validators.rbs +21 -0
- data/sig/herb/engine/visitors/auto_close_omitted_tags_visitor.rbs +26 -0
- data/sig/herb/engine/visitors/content_for_visitor.rbs +52 -0
- data/sig/herb/engine/{debug_visitor.rbs → visitors/debug_visitor.rbs} +26 -15
- data/sig/herb/engine/visitors/html_safe_assertions_visitor.rbs +100 -0
- data/sig/herb/engine/visitors/instrumentation_visitor.rbs +111 -0
- data/sig/herb/engine/visitors/optimize_visitor.rbs +246 -0
- data/sig/herb/engine/visitors/remove_comments_visitor.rbs +66 -0
- data/sig/herb/engine/visitors/source_attribution_visitor.rbs +90 -0
- data/sig/herb/engine.rbs +47 -41
- data/sig/herb/ensure_installed.rbs +9 -0
- data/sig/herb/errors.rbs +293 -0
- data/sig/herb/fingerprint.rbs +37 -0
- data/sig/herb/html/elements.rbs +19 -0
- data/sig/herb/html/util.rbs +15 -1
- data/sig/herb/lex_result.rbs +0 -6
- data/sig/herb/locate.rbs +89 -0
- data/sig/herb/location.rbs +12 -0
- data/sig/herb/parse_result.rbs +10 -8
- data/sig/herb/parser_options.rbs +47 -21
- data/sig/herb/position.rbs +11 -0
- data/sig/herb/range.rbs +3 -0
- data/sig/herb/ruby_program.rbs +51 -0
- data/sig/herb/source_path.rbs +132 -0
- data/sig/herb/token.rbs +5 -2
- data/sig/herb/visitor/context/origin.rbs +51 -0
- data/sig/herb/visitor/context/replacements.rbs +39 -0
- data/sig/herb/visitor/context.rbs +83 -0
- data/sig/herb/visitor/context_aware.rbs +32 -0
- data/sig/herb/visitor/diagnostics.rbs +82 -0
- data/sig/herb/visitor/experimental.rbs +23 -0
- data/sig/herb/visitor/parser_option_requirements.rbs +76 -0
- data/sig/herb/visitor/stack.rbs +91 -0
- data/sig/herb/visitor.rbs +22 -0
- data/sig/herb/warnings.rbs +10 -0
- data/sig/herb.rbs +27 -10
- data/sig/serialized_ast_errors.rbs +58 -1
- data/sig/serialized_ast_nodes.rbs +58 -2
- data/src/analyze/action_view/attribute_extraction_helpers.c +73 -36
- data/src/analyze/action_view/generated_handlers.c +37 -1
- data/src/analyze/action_view/generated_handlers.h +2 -1
- data/src/analyze/action_view/helper_registry.c +1353 -58
- data/src/analyze/action_view/registry.c +10 -17
- data/src/analyze/action_view/stylesheet_link_tag.c +40 -0
- data/src/analyze/action_view/tag_helper_node_builders.c +57 -0
- data/src/analyze/action_view/tag_helpers.c +423 -93
- data/src/analyze/analyze.c +301 -64
- data/src/analyze/analyze_helpers.c +420 -23
- data/src/analyze/builders.c +79 -51
- data/src/analyze/conditional_elements.c +13 -8
- data/src/analyze/conditional_open_tags.c +11 -5
- data/src/analyze/control_type.c +16 -1
- data/src/analyze/herb_directives.c +701 -0
- data/src/analyze/invalid_structures.c +11 -7
- data/src/analyze/iteration_nodes.c +306 -0
- data/src/analyze/missing_end.c +116 -32
- data/src/analyze/parse_errors.c +8 -3
- data/src/analyze/postfix_conditionals.c +98 -63
- data/src/analyze/prism_annotate.c +13 -4
- data/src/analyze/render_nodes.c +345 -123
- data/src/analyze/strict_locals.c +30 -26
- data/src/analyze/ternary_conditionals.c +95 -70
- data/src/analyze/transform.c +43 -1
- data/src/ast/ast_node.c +3 -13
- data/src/ast/ast_nodes.c +911 -112
- data/src/ast/ast_pretty_print.c +161 -2
- data/src/diff/herb_diff.c +8 -0
- data/src/diff/herb_diff_attributes.c +1 -0
- data/src/diff/herb_diff_children.c +4 -3
- data/src/diff/herb_diff_helpers.c +7 -1
- data/src/diff/herb_diff_nodes.c +186 -71
- data/src/diff/herb_hash_tree.c +99 -1
- data/src/errors.c +1096 -128
- data/src/extract.c +30 -8
- data/src/herb.c +30 -11
- data/src/include/analyze/action_view/attribute_extraction_helpers.h +1 -1
- data/src/include/analyze/action_view/helper_registry.h +28 -4
- data/src/include/analyze/action_view/tag_helper_handler.h +1 -1
- data/src/include/analyze/action_view/tag_helper_node_builders.h +7 -0
- data/src/include/analyze/analyze.h +11 -0
- data/src/include/analyze/builders.h +16 -0
- data/src/include/analyze/helpers.h +23 -2
- data/src/include/analyze/herb_directive_kinds.h +41 -0
- data/src/include/analyze/herb_directives.h +14 -0
- data/src/include/analyze/iteration_nodes.h +11 -0
- data/src/include/analyze/prism_annotate.h +3 -3
- data/src/include/analyze/ternary_conditionals.h +2 -0
- data/src/include/ast/ast_node.h +1 -5
- data/src/include/ast/ast_nodes.h +76 -2
- data/src/include/ast/ast_pretty_print.h +1 -1
- data/src/include/diff/herb_diff.h +11 -0
- data/src/include/errors.h +156 -39
- data/src/include/extract.h +11 -0
- data/src/include/herb.h +6 -0
- data/src/include/lexer/erb_openers.h +29 -0
- data/src/include/lexer/lexer_peek_helpers.h +8 -1
- data/src/include/lexer/lexer_struct.h +4 -0
- data/src/include/lexer/token.h +3 -0
- data/src/include/lexer/token_struct.h +8 -6
- data/src/include/lib/hb_allocator.h +2 -1
- data/src/include/lib/hb_array.h +2 -0
- data/src/include/lib/hb_foreach.h +1 -1
- data/src/include/lib/hb_string.h +7 -0
- data/src/include/parser/dot_notation.h +1 -1
- data/src/include/parser/foreign_content_elements.h +32 -0
- data/src/include/parser/parser.h +16 -30
- data/src/include/parser/parser_helpers.h +13 -11
- data/src/include/parser/parser_options.h +41 -0
- data/src/include/prism/ruby_parser.h +6 -0
- data/src/include/util/html_elements.h +85 -0
- data/src/include/util/html_util.h +1 -0
- data/src/include/version.h +1 -1
- data/src/lexer/lexer_peek_helpers.c +15 -1
- data/src/lexer/token.c +83 -1
- data/src/lexer.c +196 -12
- data/src/lib/hb_allocator.c +2 -0
- data/src/lib/hb_array.c +26 -0
- data/src/lib/hb_string.c +26 -0
- data/src/main.c +1 -1
- data/src/parser/dot_notation.c +4 -3
- data/src/parser/match_tags.c +66 -1
- data/src/parser/parser_helpers.c +69 -37
- data/src/parser.c +606 -383
- data/src/parser_options_defaults.c +30 -0
- data/src/prism/prism_helpers.c +3 -0
- data/src/prism/ruby_parser.c +49 -0
- data/src/util/html_util.c +11 -58
- data/src/visitor.c +77 -1
- data/templates/ext/herb/error_helpers.c.erb +1 -1
- data/templates/ext/herb/nodes.c.erb +18 -13
- data/templates/ext/herb/nodes.h.erb +2 -1
- data/templates/ext/herb/parser_options_helpers.c.erb +69 -0
- data/templates/ext/herb/parser_options_helpers.h.erb +11 -0
- data/templates/java/nodes.c.erb +20 -16
- data/templates/java/nodes.h.erb +3 -2
- data/templates/java/org/herb/ParserOptions.java.erb +24 -0
- data/templates/java/org/herb/ast/HelperRegistry.java.erb +67 -31
- data/templates/java/org/herb/ast/HelperType.java.erb +29 -0
- data/templates/java/org/herb/ast/Nodes.java.erb +11 -7
- data/templates/java/parser_options_helpers.c.erb +45 -0
- data/templates/java/parser_options_helpers.h.erb +10 -0
- data/templates/javascript/packages/client/src/state-kinds.ts.erb +49 -0
- data/templates/javascript/packages/client/src/state-operators.ts.erb +15 -0
- data/templates/javascript/packages/client/src/state-predicates.ts.erb +27 -0
- data/templates/javascript/packages/client/src/state-transforms.ts.erb +19 -0
- data/templates/javascript/packages/core/src/action-view-helpers.ts.erb +47 -0
- data/templates/javascript/packages/core/src/built-in-components.ts.erb +67 -0
- data/templates/javascript/packages/core/src/errors.ts.erb +9 -3
- data/templates/javascript/packages/core/src/foreign-content-elements.ts.erb +18 -0
- data/templates/javascript/packages/core/src/html-constants.ts.erb +32 -0
- data/templates/javascript/packages/core/src/html-elements.ts.erb +41 -0
- data/templates/javascript/packages/core/src/node-type-guards.ts.erb +11 -7
- data/templates/javascript/packages/core/src/nodes.ts.erb +82 -19
- data/templates/javascript/packages/core/src/parser-options.ts.erb +41 -0
- data/templates/javascript/packages/core/src/visitor.ts.erb +1 -1
- data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +3 -3
- data/templates/javascript/packages/node/extension/nodes.cpp.erb +17 -12
- data/templates/javascript/packages/node/extension/nodes.h.erb +3 -3
- data/templates/javascript/packages/node/extension/parser_options_helpers.cpp.erb +41 -0
- data/templates/javascript/packages/node/extension/parser_options_helpers.h.erb +12 -0
- data/templates/lib/herb/action_view/helper_registry.rb.erb +77 -3
- data/templates/lib/herb/ast/nodes.rb.erb +16 -6
- data/templates/lib/herb/engine/slots/component_definitions.rb.erb +38 -0
- data/templates/lib/herb/engine/slots/state_kinds.rb.erb +37 -0
- data/templates/lib/herb/engine/slots/state_operators.rb.erb +26 -0
- data/templates/lib/herb/engine/slots/state_predicates.rb.erb +39 -0
- data/templates/lib/herb/engine/slots/state_transforms.rb.erb +27 -0
- data/templates/lib/herb/errors.rb.erb +34 -6
- data/templates/lib/herb/html/elements.rb.erb +12 -0
- data/templates/lib/herb/parser_options.rb.erb +32 -0
- data/templates/lib/herb/visitor.rb.erb +7 -1
- data/templates/rust/herb-printer/src/printer_visitor.rs.erb +14 -0
- data/templates/rust/src/action_view_helpers.rs.erb +38 -0
- data/templates/rust/src/ast/nodes.rs.erb +24 -31
- data/templates/rust/src/errors.rs.erb +1 -1
- data/templates/rust/src/nodes.rs.erb +58 -26
- data/templates/rust/src/parser_options.rs.erb +16 -0
- data/templates/rust/src/prism/generated_deserialize.rs.erb +109 -0
- data/templates/rust/src/prism/generated_prettyprint.rs.erb +153 -0
- data/templates/rust/src/union_types.rs.erb +7 -1
- data/templates/rust/src/visitor.rs.erb +1 -1
- data/templates/src/analyze/action_view/helper_registry.c.erb +22 -0
- data/templates/src/analyze/missing_end.c.erb +13 -5
- data/templates/src/ast/ast_nodes.c.erb +41 -2
- data/templates/src/diff/herb_diff_nodes.c.erb +44 -8
- data/templates/src/errors.c.erb +8 -3
- data/templates/src/include/analyze/action_view/helper_registry.h.erb +19 -0
- data/templates/src/include/analyze/herb_directive_kinds.h.erb +25 -0
- data/templates/src/include/errors.h.erb +3 -1
- data/templates/src/include/parser/foreign_content_elements.h.erb +23 -0
- data/templates/src/include/parser/parser_options.h.erb +21 -0
- data/templates/src/include/util/html_elements.h.erb +28 -0
- data/templates/src/parser_options_defaults.c.erb +9 -0
- data/templates/template.rb +564 -9
- data/templates/wasm/error_helpers.cpp.erb +4 -4
- data/templates/wasm/nodes.cpp.erb +12 -12
- data/templates/wasm/nodes.h.erb +3 -3
- data/templates/wasm/parser_options_helpers.cpp.erb +25 -0
- data/templates/wasm/parser_options_helpers.h.erb +12 -0
- metadata +306 -27
- data/config/action_view_helpers/actionview/form_helper/button.yml +0 -38
- data/config/action_view_helpers/actionview/form_helper/submit.yml +0 -35
- data/lib/herb/ast.rb +0 -7
- data/lib/herb/diff_operation.rb +0 -34
- data/lib/herb/diff_result.rb +0 -59
- data/lib/herb/engine/error_formatter.rb +0 -432
- data/lib/herb/engine/parser_error_overlay.rb +0 -773
- data/lib/herb/engine/validation_error_overlay.rb +0 -182
- data/lib/herb/engine/validation_errors.rb +0 -65
- data/lib/herb/engine/validator.rb +0 -80
- data/sig/herb/ast.rbs +0 -6
- data/sig/herb/diff_operation.rbs +0 -34
- data/sig/herb/diff_result.rbs +0 -34
- data/sig/herb/engine/debug.rbs +0 -38
- data/sig/herb/engine/error_formatter.rbs +0 -47
- data/sig/herb/engine/parser_error_overlay.rbs +0 -41
- data/sig/herb/engine/validation_error_overlay.rbs +0 -35
- data/sig/herb/engine/validation_errors.rbs +0 -45
- data/sig/herb/engine/validator.rbs +0 -41
- data/sig/herb_c_extension.rbs +0 -10
data/lib/herb/ast/nodes.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# typed: true
|
|
3
3
|
|
|
4
4
|
# NOTE: This file is generated by the templates/template.rb script and should not be
|
|
5
|
-
# modified manually. See
|
|
5
|
+
# modified manually. See templates/lib/herb/ast/nodes.rb.erb
|
|
6
6
|
|
|
7
7
|
require_relative "../prism_inspect"
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@ module Herb
|
|
|
20
20
|
attr_reader :prism_context #: nil
|
|
21
21
|
attr_reader :prism_node #: String?
|
|
22
22
|
|
|
23
|
-
#: (String, Location, Array[Herb::Errors::Error], Array[Herb::AST::Node], nil, String) -> void
|
|
23
|
+
#: (String, Location, Array[Herb::Errors::Error], Array[Herb::AST::Node], nil, String?) -> void
|
|
24
24
|
def initialize(type, location, errors, children, prism_context, prism_node)
|
|
25
25
|
super(type, location, errors)
|
|
26
26
|
@children = children
|
|
@@ -28,6 +28,16 @@ module Herb
|
|
|
28
28
|
@prism_node = prism_node
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
#: () -> String
|
|
32
|
+
def self.type
|
|
33
|
+
"AST_DOCUMENT_NODE"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
#: (?children: Array[Herb::AST::Node], ?prism_context: nil, ?prism_node: String?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> DocumentNode
|
|
37
|
+
def self.build(children: [], prism_context: nil, prism_node: nil, location: Location.zero, errors: [])
|
|
38
|
+
new(type, location, errors, children, prism_context, prism_node)
|
|
39
|
+
end
|
|
40
|
+
|
|
31
41
|
#: () -> Prism::node?
|
|
32
42
|
def deserialized_prism_node
|
|
33
43
|
prism_node = @prism_node
|
|
@@ -77,7 +87,9 @@ module Herb
|
|
|
77
87
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
78
88
|
output = +""
|
|
79
89
|
|
|
80
|
-
|
|
90
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
91
|
+
|
|
92
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
81
93
|
output += "\n"
|
|
82
94
|
|
|
83
95
|
if depth >= depth_limit
|
|
@@ -111,12 +123,22 @@ module Herb
|
|
|
111
123
|
|
|
112
124
|
attr_reader :content #: String?
|
|
113
125
|
|
|
114
|
-
#: (String, Location, Array[Herb::Errors::Error], String) -> void
|
|
126
|
+
#: (String, Location, Array[Herb::Errors::Error], String?) -> void
|
|
115
127
|
def initialize(type, location, errors, content)
|
|
116
128
|
super(type, location, errors)
|
|
117
129
|
@content = content&.force_encoding("utf-8")
|
|
118
130
|
end
|
|
119
131
|
|
|
132
|
+
#: () -> String
|
|
133
|
+
def self.type
|
|
134
|
+
"AST_LITERAL_NODE"
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
#: (?content: String?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> LiteralNode
|
|
138
|
+
def self.build(content: nil, location: Location.zero, errors: [])
|
|
139
|
+
new(type, location, errors, content)
|
|
140
|
+
end
|
|
141
|
+
|
|
120
142
|
#: () -> serialized_literal_node
|
|
121
143
|
def to_hash
|
|
122
144
|
super.merge({
|
|
@@ -148,7 +170,9 @@ module Herb
|
|
|
148
170
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
149
171
|
output = +""
|
|
150
172
|
|
|
151
|
-
|
|
173
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
174
|
+
|
|
175
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
152
176
|
output += "\n"
|
|
153
177
|
|
|
154
178
|
if depth >= depth_limit
|
|
@@ -182,7 +206,7 @@ module Herb
|
|
|
182
206
|
attr_reader :children #: Array[Herb::AST::Node]
|
|
183
207
|
attr_reader :is_void #: bool
|
|
184
208
|
|
|
185
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
209
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Array[Herb::AST::Node], bool) -> void
|
|
186
210
|
def initialize(type, location, errors, tag_opening, tag_name, tag_closing, children, is_void)
|
|
187
211
|
super(type, location, errors)
|
|
188
212
|
@tag_opening = tag_opening
|
|
@@ -192,6 +216,16 @@ module Herb
|
|
|
192
216
|
@is_void = is_void
|
|
193
217
|
end
|
|
194
218
|
|
|
219
|
+
#: () -> String
|
|
220
|
+
def self.type
|
|
221
|
+
"AST_HTML_OPEN_TAG_NODE"
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
#: (?tag_opening: Herb::Token?, ?tag_name: Herb::Token?, ?tag_closing: Herb::Token?, ?children: Array[Herb::AST::Node], ?is_void: bool, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLOpenTagNode
|
|
225
|
+
def self.build(tag_opening: nil, tag_name: nil, tag_closing: nil, children: [], is_void: false, location: Location.zero, errors: [])
|
|
226
|
+
new(type, location, errors, tag_opening, tag_name, tag_closing, children, is_void)
|
|
227
|
+
end
|
|
228
|
+
|
|
195
229
|
#: () -> serialized_html_open_tag_node
|
|
196
230
|
def to_hash
|
|
197
231
|
super.merge({
|
|
@@ -227,7 +261,9 @@ module Herb
|
|
|
227
261
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
228
262
|
output = +""
|
|
229
263
|
|
|
230
|
-
|
|
264
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
265
|
+
|
|
266
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
231
267
|
output += "\n"
|
|
232
268
|
|
|
233
269
|
if depth >= depth_limit
|
|
@@ -270,7 +306,7 @@ module Herb
|
|
|
270
306
|
attr_reader :tag_name #: Herb::Token?
|
|
271
307
|
attr_reader :is_void #: bool
|
|
272
308
|
|
|
273
|
-
#: (String, Location, Array[Herb::Errors::Error], (Herb::AST::ERBIfNode | Herb::AST::ERBUnlessNode)
|
|
309
|
+
#: (String, Location, Array[Herb::Errors::Error], (Herb::AST::ERBIfNode | Herb::AST::ERBUnlessNode)?, Herb::Token?, bool) -> void
|
|
274
310
|
def initialize(type, location, errors, conditional, tag_name, is_void)
|
|
275
311
|
super(type, location, errors)
|
|
276
312
|
@conditional = conditional
|
|
@@ -278,6 +314,16 @@ module Herb
|
|
|
278
314
|
@is_void = is_void
|
|
279
315
|
end
|
|
280
316
|
|
|
317
|
+
#: () -> String
|
|
318
|
+
def self.type
|
|
319
|
+
"AST_HTML_CONDITIONAL_OPEN_TAG_NODE"
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
#: (?conditional: (Herb::AST::ERBIfNode | Herb::AST::ERBUnlessNode)?, ?tag_name: Herb::Token?, ?is_void: bool, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLConditionalOpenTagNode
|
|
323
|
+
def self.build(conditional: nil, tag_name: nil, is_void: false, location: Location.zero, errors: [])
|
|
324
|
+
new(type, location, errors, conditional, tag_name, is_void)
|
|
325
|
+
end
|
|
326
|
+
|
|
281
327
|
#: () -> serialized_html_conditional_open_tag_node
|
|
282
328
|
def to_hash
|
|
283
329
|
super.merge({
|
|
@@ -311,7 +357,9 @@ module Herb
|
|
|
311
357
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
312
358
|
output = +""
|
|
313
359
|
|
|
314
|
-
|
|
360
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
361
|
+
|
|
362
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
315
363
|
output += "\n"
|
|
316
364
|
|
|
317
365
|
if depth >= depth_limit
|
|
@@ -356,7 +404,7 @@ module Herb
|
|
|
356
404
|
attr_reader :children #: Array[Herb::AST::WhitespaceNode]?
|
|
357
405
|
attr_reader :tag_closing #: Herb::Token?
|
|
358
406
|
|
|
359
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
407
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Array[Herb::AST::WhitespaceNode]?, Herb::Token?) -> void
|
|
360
408
|
def initialize(type, location, errors, tag_opening, tag_name, children, tag_closing)
|
|
361
409
|
super(type, location, errors)
|
|
362
410
|
@tag_opening = tag_opening
|
|
@@ -365,6 +413,16 @@ module Herb
|
|
|
365
413
|
@tag_closing = tag_closing
|
|
366
414
|
end
|
|
367
415
|
|
|
416
|
+
#: () -> String
|
|
417
|
+
def self.type
|
|
418
|
+
"AST_HTML_CLOSE_TAG_NODE"
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
#: (?tag_opening: Herb::Token?, ?tag_name: Herb::Token?, ?children: Array[Herb::AST::WhitespaceNode]?, ?tag_closing: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLCloseTagNode
|
|
422
|
+
def self.build(tag_opening: nil, tag_name: nil, children: [], tag_closing: nil, location: Location.zero, errors: [])
|
|
423
|
+
new(type, location, errors, tag_opening, tag_name, children, tag_closing)
|
|
424
|
+
end
|
|
425
|
+
|
|
368
426
|
#: () -> serialized_html_close_tag_node
|
|
369
427
|
def to_hash
|
|
370
428
|
super.merge({
|
|
@@ -399,7 +457,9 @@ module Herb
|
|
|
399
457
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
400
458
|
output = +""
|
|
401
459
|
|
|
402
|
-
|
|
460
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
461
|
+
|
|
462
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
403
463
|
output += "\n"
|
|
404
464
|
|
|
405
465
|
if depth >= depth_limit
|
|
@@ -435,12 +495,22 @@ module Herb
|
|
|
435
495
|
|
|
436
496
|
attr_reader :tag_name #: Herb::Token?
|
|
437
497
|
|
|
438
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token) -> void
|
|
498
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?) -> void
|
|
439
499
|
def initialize(type, location, errors, tag_name)
|
|
440
500
|
super(type, location, errors)
|
|
441
501
|
@tag_name = tag_name
|
|
442
502
|
end
|
|
443
503
|
|
|
504
|
+
#: () -> String
|
|
505
|
+
def self.type
|
|
506
|
+
"AST_HTML_OMITTED_CLOSE_TAG_NODE"
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
#: (?tag_name: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLOmittedCloseTagNode
|
|
510
|
+
def self.build(tag_name: nil, location: Location.zero, errors: [])
|
|
511
|
+
new(type, location, errors, tag_name)
|
|
512
|
+
end
|
|
513
|
+
|
|
444
514
|
#: () -> serialized_html_omitted_close_tag_node
|
|
445
515
|
def to_hash
|
|
446
516
|
super.merge({
|
|
@@ -472,7 +542,9 @@ module Herb
|
|
|
472
542
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
473
543
|
output = +""
|
|
474
544
|
|
|
475
|
-
|
|
545
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
546
|
+
|
|
547
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
476
548
|
output += "\n"
|
|
477
549
|
|
|
478
550
|
if depth >= depth_limit
|
|
@@ -500,12 +572,22 @@ module Herb
|
|
|
500
572
|
|
|
501
573
|
attr_reader :tag_name #: Herb::Token?
|
|
502
574
|
|
|
503
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token) -> void
|
|
575
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?) -> void
|
|
504
576
|
def initialize(type, location, errors, tag_name)
|
|
505
577
|
super(type, location, errors)
|
|
506
578
|
@tag_name = tag_name
|
|
507
579
|
end
|
|
508
580
|
|
|
581
|
+
#: () -> String
|
|
582
|
+
def self.type
|
|
583
|
+
"AST_HTML_VIRTUAL_CLOSE_TAG_NODE"
|
|
584
|
+
end
|
|
585
|
+
|
|
586
|
+
#: (?tag_name: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLVirtualCloseTagNode
|
|
587
|
+
def self.build(tag_name: nil, location: Location.zero, errors: [])
|
|
588
|
+
new(type, location, errors, tag_name)
|
|
589
|
+
end
|
|
590
|
+
|
|
509
591
|
#: () -> serialized_html_virtual_close_tag_node
|
|
510
592
|
def to_hash
|
|
511
593
|
super.merge({
|
|
@@ -537,7 +619,9 @@ module Herb
|
|
|
537
619
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
538
620
|
output = +""
|
|
539
621
|
|
|
540
|
-
|
|
622
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
623
|
+
|
|
624
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
541
625
|
output += "\n"
|
|
542
626
|
|
|
543
627
|
if depth >= depth_limit
|
|
@@ -571,11 +655,11 @@ module Herb
|
|
|
571
655
|
attr_reader :open_tag #: (Herb::AST::HTMLOpenTagNode | Herb::AST::HTMLConditionalOpenTagNode | Herb::AST::ERBOpenTagNode)?
|
|
572
656
|
attr_reader :tag_name #: Herb::Token?
|
|
573
657
|
attr_reader :body #: Array[Herb::AST::Node]
|
|
574
|
-
|
|
658
|
+
attr_accessor :close_tag #: (Herb::AST::HTMLCloseTagNode | Herb::AST::HTMLOmittedCloseTagNode | Herb::AST::HTMLVirtualCloseTagNode | Herb::AST::ERBEndNode)?
|
|
575
659
|
attr_reader :is_void #: bool
|
|
576
660
|
attr_reader :element_source #: String?
|
|
577
661
|
|
|
578
|
-
#: (String, Location, Array[Herb::Errors::Error], (Herb::AST::HTMLOpenTagNode | Herb::AST::HTMLConditionalOpenTagNode | Herb::AST::ERBOpenTagNode)
|
|
662
|
+
#: (String, Location, Array[Herb::Errors::Error], (Herb::AST::HTMLOpenTagNode | Herb::AST::HTMLConditionalOpenTagNode | Herb::AST::ERBOpenTagNode)?, Herb::Token?, Array[Herb::AST::Node], (Herb::AST::HTMLCloseTagNode | Herb::AST::HTMLOmittedCloseTagNode | Herb::AST::HTMLVirtualCloseTagNode | Herb::AST::ERBEndNode)?, bool, String?) -> void
|
|
579
663
|
def initialize(type, location, errors, open_tag, tag_name, body, close_tag, is_void, element_source)
|
|
580
664
|
super(type, location, errors)
|
|
581
665
|
@open_tag = open_tag
|
|
@@ -586,6 +670,16 @@ module Herb
|
|
|
586
670
|
@element_source = element_source
|
|
587
671
|
end
|
|
588
672
|
|
|
673
|
+
#: () -> String
|
|
674
|
+
def self.type
|
|
675
|
+
"AST_HTML_ELEMENT_NODE"
|
|
676
|
+
end
|
|
677
|
+
|
|
678
|
+
#: (?open_tag: (Herb::AST::HTMLOpenTagNode | Herb::AST::HTMLConditionalOpenTagNode | Herb::AST::ERBOpenTagNode)?, ?tag_name: Herb::Token?, ?body: Array[Herb::AST::Node], ?close_tag: (Herb::AST::HTMLCloseTagNode | Herb::AST::HTMLOmittedCloseTagNode | Herb::AST::HTMLVirtualCloseTagNode | Herb::AST::ERBEndNode)?, ?is_void: bool, ?element_source: String?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLElementNode
|
|
679
|
+
def self.build(open_tag: nil, tag_name: nil, body: [], close_tag: nil, is_void: false, element_source: nil, location: Location.zero, errors: [])
|
|
680
|
+
new(type, location, errors, open_tag, tag_name, body, close_tag, is_void, element_source)
|
|
681
|
+
end
|
|
682
|
+
|
|
589
683
|
#: () -> serialized_html_element_node
|
|
590
684
|
def to_hash
|
|
591
685
|
super.merge({
|
|
@@ -622,7 +716,9 @@ module Herb
|
|
|
622
716
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
623
717
|
output = +""
|
|
624
718
|
|
|
625
|
-
|
|
719
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
720
|
+
|
|
721
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
626
722
|
output += "\n"
|
|
627
723
|
|
|
628
724
|
if depth >= depth_limit
|
|
@@ -686,7 +782,7 @@ module Herb
|
|
|
686
782
|
attr_reader :tag_name #: Herb::Token?
|
|
687
783
|
attr_reader :element_source #: String?
|
|
688
784
|
|
|
689
|
-
#: (String, Location, Array[Herb::Errors::Error], String
|
|
785
|
+
#: (String, Location, Array[Herb::Errors::Error], String?, (Herb::AST::ERBIfNode | Herb::AST::ERBUnlessNode)?, Herb::AST::HTMLOpenTagNode?, Array[Herb::AST::Node], (Herb::AST::HTMLCloseTagNode | Herb::AST::HTMLOmittedCloseTagNode)?, (Herb::AST::ERBIfNode | Herb::AST::ERBUnlessNode)?, Herb::Token?, String?) -> void
|
|
690
786
|
def initialize(type, location, errors, condition, open_conditional, open_tag, body, close_tag, close_conditional, tag_name, element_source)
|
|
691
787
|
super(type, location, errors)
|
|
692
788
|
@condition = condition&.force_encoding("utf-8")
|
|
@@ -699,6 +795,16 @@ module Herb
|
|
|
699
795
|
@element_source = element_source
|
|
700
796
|
end
|
|
701
797
|
|
|
798
|
+
#: () -> String
|
|
799
|
+
def self.type
|
|
800
|
+
"AST_HTML_CONDITIONAL_ELEMENT_NODE"
|
|
801
|
+
end
|
|
802
|
+
|
|
803
|
+
#: (?condition: String?, ?open_conditional: (Herb::AST::ERBIfNode | Herb::AST::ERBUnlessNode)?, ?open_tag: Herb::AST::HTMLOpenTagNode?, ?body: Array[Herb::AST::Node], ?close_tag: (Herb::AST::HTMLCloseTagNode | Herb::AST::HTMLOmittedCloseTagNode)?, ?close_conditional: (Herb::AST::ERBIfNode | Herb::AST::ERBUnlessNode)?, ?tag_name: Herb::Token?, ?element_source: String?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLConditionalElementNode
|
|
804
|
+
def self.build(condition: nil, open_conditional: nil, open_tag: nil, body: [], close_tag: nil, close_conditional: nil, tag_name: nil, element_source: nil, location: Location.zero, errors: [])
|
|
805
|
+
new(type, location, errors, condition, open_conditional, open_tag, body, close_tag, close_conditional, tag_name, element_source)
|
|
806
|
+
end
|
|
807
|
+
|
|
702
808
|
#: () -> serialized_html_conditional_element_node
|
|
703
809
|
def to_hash
|
|
704
810
|
super.merge({
|
|
@@ -737,7 +843,9 @@ module Herb
|
|
|
737
843
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
738
844
|
output = +""
|
|
739
845
|
|
|
740
|
-
|
|
846
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
847
|
+
|
|
848
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
741
849
|
output += "\n"
|
|
742
850
|
|
|
743
851
|
if depth >= depth_limit
|
|
@@ -807,7 +915,7 @@ module Herb
|
|
|
807
915
|
attr_reader :close_quote #: Herb::Token?
|
|
808
916
|
attr_reader :quoted #: bool
|
|
809
917
|
|
|
810
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
918
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Array[Herb::AST::Node], Herb::Token?, bool) -> void
|
|
811
919
|
def initialize(type, location, errors, open_quote, children, close_quote, quoted)
|
|
812
920
|
super(type, location, errors)
|
|
813
921
|
@open_quote = open_quote
|
|
@@ -816,6 +924,16 @@ module Herb
|
|
|
816
924
|
@quoted = quoted
|
|
817
925
|
end
|
|
818
926
|
|
|
927
|
+
#: () -> String
|
|
928
|
+
def self.type
|
|
929
|
+
"AST_HTML_ATTRIBUTE_VALUE_NODE"
|
|
930
|
+
end
|
|
931
|
+
|
|
932
|
+
#: (?open_quote: Herb::Token?, ?children: Array[Herb::AST::Node], ?close_quote: Herb::Token?, ?quoted: bool, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLAttributeValueNode
|
|
933
|
+
def self.build(open_quote: nil, children: [], close_quote: nil, quoted: false, location: Location.zero, errors: [])
|
|
934
|
+
new(type, location, errors, open_quote, children, close_quote, quoted)
|
|
935
|
+
end
|
|
936
|
+
|
|
819
937
|
#: () -> serialized_html_attribute_value_node
|
|
820
938
|
def to_hash
|
|
821
939
|
super.merge({
|
|
@@ -850,7 +968,9 @@ module Herb
|
|
|
850
968
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
851
969
|
output = +""
|
|
852
970
|
|
|
853
|
-
|
|
971
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
972
|
+
|
|
973
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
854
974
|
output += "\n"
|
|
855
975
|
|
|
856
976
|
if depth >= depth_limit
|
|
@@ -879,19 +999,29 @@ module Herb
|
|
|
879
999
|
end
|
|
880
1000
|
|
|
881
1001
|
#: type serialized_html_attribute_name_node = {
|
|
882
|
-
#| children: Array[(Herb::AST::LiteralNode | Herb::AST::ERBContentNode)]?,
|
|
1002
|
+
#| children: Array[(Herb::AST::LiteralNode | Herb::AST::ERBContentNode | Herb::AST::ERBCommentNode)]?,
|
|
883
1003
|
#| }
|
|
884
1004
|
class HTMLAttributeNameNode < Node
|
|
885
1005
|
include Colors
|
|
886
1006
|
|
|
887
|
-
attr_reader :children #: Array[(Herb::AST::LiteralNode | Herb::AST::ERBContentNode)]?
|
|
1007
|
+
attr_reader :children #: Array[(Herb::AST::LiteralNode | Herb::AST::ERBContentNode | Herb::AST::ERBCommentNode)]?
|
|
888
1008
|
|
|
889
|
-
#: (String, Location, Array[Herb::Errors::Error], Array[(Herb::AST::LiteralNode | Herb::AST::ERBContentNode)]) -> void
|
|
1009
|
+
#: (String, Location, Array[Herb::Errors::Error], Array[(Herb::AST::LiteralNode | Herb::AST::ERBContentNode | Herb::AST::ERBCommentNode)]?) -> void
|
|
890
1010
|
def initialize(type, location, errors, children)
|
|
891
1011
|
super(type, location, errors)
|
|
892
1012
|
@children = children
|
|
893
1013
|
end
|
|
894
1014
|
|
|
1015
|
+
#: () -> String
|
|
1016
|
+
def self.type
|
|
1017
|
+
"AST_HTML_ATTRIBUTE_NAME_NODE"
|
|
1018
|
+
end
|
|
1019
|
+
|
|
1020
|
+
#: (?children: Array[(Herb::AST::LiteralNode | Herb::AST::ERBContentNode | Herb::AST::ERBCommentNode)]?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLAttributeNameNode
|
|
1021
|
+
def self.build(children: [], location: Location.zero, errors: [])
|
|
1022
|
+
new(type, location, errors, children)
|
|
1023
|
+
end
|
|
1024
|
+
|
|
895
1025
|
#: () -> serialized_html_attribute_name_node
|
|
896
1026
|
def to_hash
|
|
897
1027
|
super.merge({
|
|
@@ -923,7 +1053,9 @@ module Herb
|
|
|
923
1053
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
924
1054
|
output = +""
|
|
925
1055
|
|
|
926
|
-
|
|
1056
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1057
|
+
|
|
1058
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
927
1059
|
output += "\n"
|
|
928
1060
|
|
|
929
1061
|
if depth >= depth_limit
|
|
@@ -954,7 +1086,7 @@ module Herb
|
|
|
954
1086
|
attr_reader :equals #: Herb::Token?
|
|
955
1087
|
attr_reader :value #: Herb::AST::HTMLAttributeValueNode?
|
|
956
1088
|
|
|
957
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::AST::HTMLAttributeNameNode
|
|
1089
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::AST::HTMLAttributeNameNode?, Herb::Token?, Herb::AST::HTMLAttributeValueNode?) -> void
|
|
958
1090
|
def initialize(type, location, errors, name, equals, value)
|
|
959
1091
|
super(type, location, errors)
|
|
960
1092
|
@name = name
|
|
@@ -962,6 +1094,16 @@ module Herb
|
|
|
962
1094
|
@value = value
|
|
963
1095
|
end
|
|
964
1096
|
|
|
1097
|
+
#: () -> String
|
|
1098
|
+
def self.type
|
|
1099
|
+
"AST_HTML_ATTRIBUTE_NODE"
|
|
1100
|
+
end
|
|
1101
|
+
|
|
1102
|
+
#: (?name: Herb::AST::HTMLAttributeNameNode?, ?equals: Herb::Token?, ?value: Herb::AST::HTMLAttributeValueNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLAttributeNode
|
|
1103
|
+
def self.build(name: nil, equals: nil, value: nil, location: Location.zero, errors: [])
|
|
1104
|
+
new(type, location, errors, name, equals, value)
|
|
1105
|
+
end
|
|
1106
|
+
|
|
965
1107
|
#: () -> serialized_html_attribute_node
|
|
966
1108
|
def to_hash
|
|
967
1109
|
super.merge({
|
|
@@ -995,7 +1137,9 @@ module Herb
|
|
|
995
1137
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
996
1138
|
output = +""
|
|
997
1139
|
|
|
998
|
-
|
|
1140
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1141
|
+
|
|
1142
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
999
1143
|
output += "\n"
|
|
1000
1144
|
|
|
1001
1145
|
if depth >= depth_limit
|
|
@@ -1039,12 +1183,22 @@ module Herb
|
|
|
1039
1183
|
|
|
1040
1184
|
attr_reader :content #: String?
|
|
1041
1185
|
|
|
1042
|
-
#: (String, Location, Array[Herb::Errors::Error], String) -> void
|
|
1186
|
+
#: (String, Location, Array[Herb::Errors::Error], String?) -> void
|
|
1043
1187
|
def initialize(type, location, errors, content)
|
|
1044
1188
|
super(type, location, errors)
|
|
1045
1189
|
@content = content&.force_encoding("utf-8")
|
|
1046
1190
|
end
|
|
1047
1191
|
|
|
1192
|
+
#: () -> String
|
|
1193
|
+
def self.type
|
|
1194
|
+
"AST_RUBY_LITERAL_NODE"
|
|
1195
|
+
end
|
|
1196
|
+
|
|
1197
|
+
#: (?content: String?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> RubyLiteralNode
|
|
1198
|
+
def self.build(content: nil, location: Location.zero, errors: [])
|
|
1199
|
+
new(type, location, errors, content)
|
|
1200
|
+
end
|
|
1201
|
+
|
|
1048
1202
|
#: () -> serialized_ruby_literal_node
|
|
1049
1203
|
def to_hash
|
|
1050
1204
|
super.merge({
|
|
@@ -1076,7 +1230,9 @@ module Herb
|
|
|
1076
1230
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1077
1231
|
output = +""
|
|
1078
1232
|
|
|
1079
|
-
|
|
1233
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1234
|
+
|
|
1235
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1080
1236
|
output += "\n"
|
|
1081
1237
|
|
|
1082
1238
|
if depth >= depth_limit
|
|
@@ -1104,13 +1260,23 @@ module Herb
|
|
|
1104
1260
|
attr_reader :content #: String?
|
|
1105
1261
|
attr_reader :prefix #: String?
|
|
1106
1262
|
|
|
1107
|
-
#: (String, Location, Array[Herb::Errors::Error], String
|
|
1263
|
+
#: (String, Location, Array[Herb::Errors::Error], String?, String?) -> void
|
|
1108
1264
|
def initialize(type, location, errors, content, prefix)
|
|
1109
1265
|
super(type, location, errors)
|
|
1110
1266
|
@content = content&.force_encoding("utf-8")
|
|
1111
1267
|
@prefix = prefix&.force_encoding("utf-8")
|
|
1112
1268
|
end
|
|
1113
1269
|
|
|
1270
|
+
#: () -> String
|
|
1271
|
+
def self.type
|
|
1272
|
+
"AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE"
|
|
1273
|
+
end
|
|
1274
|
+
|
|
1275
|
+
#: (?content: String?, ?prefix: String?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> RubyHTMLAttributesSplatNode
|
|
1276
|
+
def self.build(content: nil, prefix: nil, location: Location.zero, errors: [])
|
|
1277
|
+
new(type, location, errors, content, prefix)
|
|
1278
|
+
end
|
|
1279
|
+
|
|
1114
1280
|
#: () -> serialized_ruby_html_attributes_splat_node
|
|
1115
1281
|
def to_hash
|
|
1116
1282
|
super.merge({
|
|
@@ -1143,7 +1309,9 @@ module Herb
|
|
|
1143
1309
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1144
1310
|
output = +""
|
|
1145
1311
|
|
|
1146
|
-
|
|
1312
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1313
|
+
|
|
1314
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1147
1315
|
output += "\n"
|
|
1148
1316
|
|
|
1149
1317
|
if depth >= depth_limit
|
|
@@ -1178,7 +1346,7 @@ module Herb
|
|
|
1178
1346
|
attr_reader :tag_name #: Herb::Token?
|
|
1179
1347
|
attr_reader :children #: Array[Herb::AST::Node]
|
|
1180
1348
|
|
|
1181
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
1349
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Array[Herb::AST::Node]) -> void
|
|
1182
1350
|
def initialize(type, location, errors, tag_opening, content, tag_closing, tag_name, children)
|
|
1183
1351
|
super(type, location, errors)
|
|
1184
1352
|
@tag_opening = tag_opening
|
|
@@ -1188,6 +1356,16 @@ module Herb
|
|
|
1188
1356
|
@children = children
|
|
1189
1357
|
end
|
|
1190
1358
|
|
|
1359
|
+
#: () -> String
|
|
1360
|
+
def self.type
|
|
1361
|
+
"AST_ERB_OPEN_TAG_NODE"
|
|
1362
|
+
end
|
|
1363
|
+
|
|
1364
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?tag_name: Herb::Token?, ?children: Array[Herb::AST::Node], ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBOpenTagNode
|
|
1365
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, tag_name: nil, children: [], location: Location.zero, errors: [])
|
|
1366
|
+
new(type, location, errors, tag_opening, content, tag_closing, tag_name, children)
|
|
1367
|
+
end
|
|
1368
|
+
|
|
1191
1369
|
#: () -> serialized_erb_open_tag_node
|
|
1192
1370
|
def to_hash
|
|
1193
1371
|
super.merge({
|
|
@@ -1223,7 +1401,9 @@ module Herb
|
|
|
1223
1401
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1224
1402
|
output = +""
|
|
1225
1403
|
|
|
1226
|
-
|
|
1404
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1405
|
+
|
|
1406
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1227
1407
|
output += "\n"
|
|
1228
1408
|
|
|
1229
1409
|
if depth >= depth_limit
|
|
@@ -1262,12 +1442,22 @@ module Herb
|
|
|
1262
1442
|
|
|
1263
1443
|
attr_reader :content #: String?
|
|
1264
1444
|
|
|
1265
|
-
#: (String, Location, Array[Herb::Errors::Error], String) -> void
|
|
1445
|
+
#: (String, Location, Array[Herb::Errors::Error], String?) -> void
|
|
1266
1446
|
def initialize(type, location, errors, content)
|
|
1267
1447
|
super(type, location, errors)
|
|
1268
1448
|
@content = content&.force_encoding("utf-8")
|
|
1269
1449
|
end
|
|
1270
1450
|
|
|
1451
|
+
#: () -> String
|
|
1452
|
+
def self.type
|
|
1453
|
+
"AST_HTML_TEXT_NODE"
|
|
1454
|
+
end
|
|
1455
|
+
|
|
1456
|
+
#: (?content: String?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLTextNode
|
|
1457
|
+
def self.build(content: nil, location: Location.zero, errors: [])
|
|
1458
|
+
new(type, location, errors, content)
|
|
1459
|
+
end
|
|
1460
|
+
|
|
1271
1461
|
#: () -> serialized_html_text_node
|
|
1272
1462
|
def to_hash
|
|
1273
1463
|
super.merge({
|
|
@@ -1299,7 +1489,9 @@ module Herb
|
|
|
1299
1489
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1300
1490
|
output = +""
|
|
1301
1491
|
|
|
1302
|
-
|
|
1492
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1493
|
+
|
|
1494
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1303
1495
|
output += "\n"
|
|
1304
1496
|
|
|
1305
1497
|
if depth >= depth_limit
|
|
@@ -1329,7 +1521,7 @@ module Herb
|
|
|
1329
1521
|
attr_reader :children #: Array[Herb::AST::Node]
|
|
1330
1522
|
attr_reader :comment_end #: Herb::Token?
|
|
1331
1523
|
|
|
1332
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
1524
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Array[Herb::AST::Node], Herb::Token?) -> void
|
|
1333
1525
|
def initialize(type, location, errors, comment_start, children, comment_end)
|
|
1334
1526
|
super(type, location, errors)
|
|
1335
1527
|
@comment_start = comment_start
|
|
@@ -1337,6 +1529,16 @@ module Herb
|
|
|
1337
1529
|
@comment_end = comment_end
|
|
1338
1530
|
end
|
|
1339
1531
|
|
|
1532
|
+
#: () -> String
|
|
1533
|
+
def self.type
|
|
1534
|
+
"AST_HTML_COMMENT_NODE"
|
|
1535
|
+
end
|
|
1536
|
+
|
|
1537
|
+
#: (?comment_start: Herb::Token?, ?children: Array[Herb::AST::Node], ?comment_end: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLCommentNode
|
|
1538
|
+
def self.build(comment_start: nil, children: [], comment_end: nil, location: Location.zero, errors: [])
|
|
1539
|
+
new(type, location, errors, comment_start, children, comment_end)
|
|
1540
|
+
end
|
|
1541
|
+
|
|
1340
1542
|
#: () -> serialized_html_comment_node
|
|
1341
1543
|
def to_hash
|
|
1342
1544
|
super.merge({
|
|
@@ -1370,7 +1572,9 @@ module Herb
|
|
|
1370
1572
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1371
1573
|
output = +""
|
|
1372
1574
|
|
|
1373
|
-
|
|
1575
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1576
|
+
|
|
1577
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1374
1578
|
output += "\n"
|
|
1375
1579
|
|
|
1376
1580
|
if depth >= depth_limit
|
|
@@ -1407,7 +1611,7 @@ module Herb
|
|
|
1407
1611
|
attr_reader :children #: Array[Herb::AST::Node]
|
|
1408
1612
|
attr_reader :tag_closing #: Herb::Token?
|
|
1409
1613
|
|
|
1410
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
1614
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Array[Herb::AST::Node], Herb::Token?) -> void
|
|
1411
1615
|
def initialize(type, location, errors, tag_opening, children, tag_closing)
|
|
1412
1616
|
super(type, location, errors)
|
|
1413
1617
|
@tag_opening = tag_opening
|
|
@@ -1415,6 +1619,16 @@ module Herb
|
|
|
1415
1619
|
@tag_closing = tag_closing
|
|
1416
1620
|
end
|
|
1417
1621
|
|
|
1622
|
+
#: () -> String
|
|
1623
|
+
def self.type
|
|
1624
|
+
"AST_HTML_DOCTYPE_NODE"
|
|
1625
|
+
end
|
|
1626
|
+
|
|
1627
|
+
#: (?tag_opening: Herb::Token?, ?children: Array[Herb::AST::Node], ?tag_closing: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HTMLDoctypeNode
|
|
1628
|
+
def self.build(tag_opening: nil, children: [], tag_closing: nil, location: Location.zero, errors: [])
|
|
1629
|
+
new(type, location, errors, tag_opening, children, tag_closing)
|
|
1630
|
+
end
|
|
1631
|
+
|
|
1418
1632
|
#: () -> serialized_html_doctype_node
|
|
1419
1633
|
def to_hash
|
|
1420
1634
|
super.merge({
|
|
@@ -1448,7 +1662,9 @@ module Herb
|
|
|
1448
1662
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1449
1663
|
output = +""
|
|
1450
1664
|
|
|
1451
|
-
|
|
1665
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1666
|
+
|
|
1667
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1452
1668
|
output += "\n"
|
|
1453
1669
|
|
|
1454
1670
|
if depth >= depth_limit
|
|
@@ -1485,7 +1701,7 @@ module Herb
|
|
|
1485
1701
|
attr_reader :children #: Array[Herb::AST::Node]
|
|
1486
1702
|
attr_reader :tag_closing #: Herb::Token?
|
|
1487
1703
|
|
|
1488
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
1704
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Array[Herb::AST::Node], Herb::Token?) -> void
|
|
1489
1705
|
def initialize(type, location, errors, tag_opening, children, tag_closing)
|
|
1490
1706
|
super(type, location, errors)
|
|
1491
1707
|
@tag_opening = tag_opening
|
|
@@ -1493,6 +1709,16 @@ module Herb
|
|
|
1493
1709
|
@tag_closing = tag_closing
|
|
1494
1710
|
end
|
|
1495
1711
|
|
|
1712
|
+
#: () -> String
|
|
1713
|
+
def self.type
|
|
1714
|
+
"AST_XML_DECLARATION_NODE"
|
|
1715
|
+
end
|
|
1716
|
+
|
|
1717
|
+
#: (?tag_opening: Herb::Token?, ?children: Array[Herb::AST::Node], ?tag_closing: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> XMLDeclarationNode
|
|
1718
|
+
def self.build(tag_opening: nil, children: [], tag_closing: nil, location: Location.zero, errors: [])
|
|
1719
|
+
new(type, location, errors, tag_opening, children, tag_closing)
|
|
1720
|
+
end
|
|
1721
|
+
|
|
1496
1722
|
#: () -> serialized_xml_declaration_node
|
|
1497
1723
|
def to_hash
|
|
1498
1724
|
super.merge({
|
|
@@ -1526,7 +1752,103 @@ module Herb
|
|
|
1526
1752
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1527
1753
|
output = +""
|
|
1528
1754
|
|
|
1529
|
-
|
|
1755
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1756
|
+
|
|
1757
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1758
|
+
output += "\n"
|
|
1759
|
+
|
|
1760
|
+
if depth >= depth_limit
|
|
1761
|
+
output += dimmed("└── [depth limit reached ...]\n\n")
|
|
1762
|
+
|
|
1763
|
+
return output.gsub(/^/, " " * indent)
|
|
1764
|
+
end
|
|
1765
|
+
|
|
1766
|
+
output += inspect_errors(prefix: "│ ")
|
|
1767
|
+
|
|
1768
|
+
output += white("├── tag_opening: ")
|
|
1769
|
+
output += tag_opening ? tag_opening.tree_inspect : magenta("∅")
|
|
1770
|
+
output += "\n"
|
|
1771
|
+
output += white("├── children: ")
|
|
1772
|
+
output += inspect_array(children, prefix: "│ ", indent: indent, depth: depth + 1, depth_limit: depth_limit)
|
|
1773
|
+
output += white("└── tag_closing: ")
|
|
1774
|
+
output += tag_closing ? tag_closing.tree_inspect : magenta("∅")
|
|
1775
|
+
output += "\n"
|
|
1776
|
+
output += "\n"
|
|
1777
|
+
|
|
1778
|
+
output.gsub(/^/, " " * indent)
|
|
1779
|
+
end
|
|
1780
|
+
end
|
|
1781
|
+
|
|
1782
|
+
#: type serialized_xml_processing_instruction_node = {
|
|
1783
|
+
#| tag_opening: Herb::Token?,
|
|
1784
|
+
#| target: Herb::Token?,
|
|
1785
|
+
#| children: Array[Herb::AST::Node],
|
|
1786
|
+
#| tag_closing: Herb::Token?,
|
|
1787
|
+
#| }
|
|
1788
|
+
class XMLProcessingInstructionNode < Node
|
|
1789
|
+
include Colors
|
|
1790
|
+
|
|
1791
|
+
attr_reader :tag_opening #: Herb::Token?
|
|
1792
|
+
attr_reader :target #: Herb::Token?
|
|
1793
|
+
attr_reader :children #: Array[Herb::AST::Node]
|
|
1794
|
+
attr_reader :tag_closing #: Herb::Token?
|
|
1795
|
+
|
|
1796
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Array[Herb::AST::Node], Herb::Token?) -> void
|
|
1797
|
+
def initialize(type, location, errors, tag_opening, target, children, tag_closing)
|
|
1798
|
+
super(type, location, errors)
|
|
1799
|
+
@tag_opening = tag_opening
|
|
1800
|
+
@target = target
|
|
1801
|
+
@children = children
|
|
1802
|
+
@tag_closing = tag_closing
|
|
1803
|
+
end
|
|
1804
|
+
|
|
1805
|
+
#: () -> String
|
|
1806
|
+
def self.type
|
|
1807
|
+
"AST_XML_PROCESSING_INSTRUCTION_NODE"
|
|
1808
|
+
end
|
|
1809
|
+
|
|
1810
|
+
#: (?tag_opening: Herb::Token?, ?target: Herb::Token?, ?children: Array[Herb::AST::Node], ?tag_closing: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> XMLProcessingInstructionNode
|
|
1811
|
+
def self.build(tag_opening: nil, target: nil, children: [], tag_closing: nil, location: Location.zero, errors: [])
|
|
1812
|
+
new(type, location, errors, tag_opening, target, children, tag_closing)
|
|
1813
|
+
end
|
|
1814
|
+
|
|
1815
|
+
#: () -> serialized_xml_processing_instruction_node
|
|
1816
|
+
def to_hash
|
|
1817
|
+
super.merge({
|
|
1818
|
+
tag_opening: tag_opening,
|
|
1819
|
+
target: target,
|
|
1820
|
+
children: children,
|
|
1821
|
+
tag_closing: tag_closing,
|
|
1822
|
+
}) #: Herb::serialized_xml_processing_instruction_node
|
|
1823
|
+
end
|
|
1824
|
+
|
|
1825
|
+
#: (Visitor) -> void
|
|
1826
|
+
def accept(visitor)
|
|
1827
|
+
visitor.visit_xml_processing_instruction_node(self)
|
|
1828
|
+
end
|
|
1829
|
+
|
|
1830
|
+
#: () -> Array[Herb::AST::Node?]
|
|
1831
|
+
def child_nodes
|
|
1832
|
+
[*(children || [])]
|
|
1833
|
+
end
|
|
1834
|
+
|
|
1835
|
+
#: () -> Array[Herb::AST::Node]
|
|
1836
|
+
def compact_child_nodes
|
|
1837
|
+
child_nodes.compact
|
|
1838
|
+
end
|
|
1839
|
+
|
|
1840
|
+
#: () -> String
|
|
1841
|
+
def inspect
|
|
1842
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
1843
|
+
end
|
|
1844
|
+
|
|
1845
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
1846
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1847
|
+
output = +""
|
|
1848
|
+
|
|
1849
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1850
|
+
|
|
1851
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1530
1852
|
output += "\n"
|
|
1531
1853
|
|
|
1532
1854
|
if depth >= depth_limit
|
|
@@ -1540,6 +1862,9 @@ module Herb
|
|
|
1540
1862
|
output += white("├── tag_opening: ")
|
|
1541
1863
|
output += tag_opening ? tag_opening.tree_inspect : magenta("∅")
|
|
1542
1864
|
output += "\n"
|
|
1865
|
+
output += white("├── target: ")
|
|
1866
|
+
output += target ? target.tree_inspect : magenta("∅")
|
|
1867
|
+
output += "\n"
|
|
1543
1868
|
output += white("├── children: ")
|
|
1544
1869
|
output += inspect_array(children, prefix: "│ ", indent: indent, depth: depth + 1, depth_limit: depth_limit)
|
|
1545
1870
|
output += white("└── tag_closing: ")
|
|
@@ -1563,7 +1888,7 @@ module Herb
|
|
|
1563
1888
|
attr_reader :children #: Array[Herb::AST::Node]
|
|
1564
1889
|
attr_reader :tag_closing #: Herb::Token?
|
|
1565
1890
|
|
|
1566
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
1891
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Array[Herb::AST::Node], Herb::Token?) -> void
|
|
1567
1892
|
def initialize(type, location, errors, tag_opening, children, tag_closing)
|
|
1568
1893
|
super(type, location, errors)
|
|
1569
1894
|
@tag_opening = tag_opening
|
|
@@ -1571,6 +1896,16 @@ module Herb
|
|
|
1571
1896
|
@tag_closing = tag_closing
|
|
1572
1897
|
end
|
|
1573
1898
|
|
|
1899
|
+
#: () -> String
|
|
1900
|
+
def self.type
|
|
1901
|
+
"AST_CDATA_NODE"
|
|
1902
|
+
end
|
|
1903
|
+
|
|
1904
|
+
#: (?tag_opening: Herb::Token?, ?children: Array[Herb::AST::Node], ?tag_closing: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> CDATANode
|
|
1905
|
+
def self.build(tag_opening: nil, children: [], tag_closing: nil, location: Location.zero, errors: [])
|
|
1906
|
+
new(type, location, errors, tag_opening, children, tag_closing)
|
|
1907
|
+
end
|
|
1908
|
+
|
|
1574
1909
|
#: () -> serialized_cdata_node
|
|
1575
1910
|
def to_hash
|
|
1576
1911
|
super.merge({
|
|
@@ -1604,7 +1939,9 @@ module Herb
|
|
|
1604
1939
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1605
1940
|
output = +""
|
|
1606
1941
|
|
|
1607
|
-
|
|
1942
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
1943
|
+
|
|
1944
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1608
1945
|
output += "\n"
|
|
1609
1946
|
|
|
1610
1947
|
if depth >= depth_limit
|
|
@@ -1637,12 +1974,22 @@ module Herb
|
|
|
1637
1974
|
|
|
1638
1975
|
attr_reader :value #: Herb::Token?
|
|
1639
1976
|
|
|
1640
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token) -> void
|
|
1977
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?) -> void
|
|
1641
1978
|
def initialize(type, location, errors, value)
|
|
1642
1979
|
super(type, location, errors)
|
|
1643
1980
|
@value = value
|
|
1644
1981
|
end
|
|
1645
1982
|
|
|
1983
|
+
#: () -> String
|
|
1984
|
+
def self.type
|
|
1985
|
+
"AST_WHITESPACE_NODE"
|
|
1986
|
+
end
|
|
1987
|
+
|
|
1988
|
+
#: (?value: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> WhitespaceNode
|
|
1989
|
+
def self.build(value: nil, location: Location.zero, errors: [])
|
|
1990
|
+
new(type, location, errors, value)
|
|
1991
|
+
end
|
|
1992
|
+
|
|
1646
1993
|
#: () -> serialized_whitespace_node
|
|
1647
1994
|
def to_hash
|
|
1648
1995
|
super.merge({
|
|
@@ -1674,7 +2021,9 @@ module Herb
|
|
|
1674
2021
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1675
2022
|
output = +""
|
|
1676
2023
|
|
|
1677
|
-
|
|
2024
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
2025
|
+
|
|
2026
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1678
2027
|
output += "\n"
|
|
1679
2028
|
|
|
1680
2029
|
if depth >= depth_limit
|
|
@@ -1714,7 +2063,7 @@ module Herb
|
|
|
1714
2063
|
attr_reader :valid #: bool
|
|
1715
2064
|
attr_reader :prism_node #: String?
|
|
1716
2065
|
|
|
1717
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
2066
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, nil, bool, bool, String?) -> void
|
|
1718
2067
|
def initialize(type, location, errors, tag_opening, content, tag_closing, analyzed_ruby, parsed, valid, prism_node)
|
|
1719
2068
|
super(type, location, errors)
|
|
1720
2069
|
@tag_opening = tag_opening
|
|
@@ -1726,6 +2075,16 @@ module Herb
|
|
|
1726
2075
|
@prism_node = prism_node
|
|
1727
2076
|
end
|
|
1728
2077
|
|
|
2078
|
+
#: () -> String
|
|
2079
|
+
def self.type
|
|
2080
|
+
"AST_ERB_CONTENT_NODE"
|
|
2081
|
+
end
|
|
2082
|
+
|
|
2083
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?analyzed_ruby: nil, ?parsed: bool, ?valid: bool, ?prism_node: String?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBContentNode
|
|
2084
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, analyzed_ruby: nil, parsed: false, valid: false, prism_node: nil, location: Location.zero, errors: [])
|
|
2085
|
+
new(type, location, errors, tag_opening, content, tag_closing, analyzed_ruby, parsed, valid, prism_node)
|
|
2086
|
+
end
|
|
2087
|
+
|
|
1729
2088
|
#: () -> Prism::node?
|
|
1730
2089
|
def deserialized_prism_node
|
|
1731
2090
|
prism_node = @prism_node
|
|
@@ -1779,7 +2138,9 @@ module Herb
|
|
|
1779
2138
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1780
2139
|
output = +""
|
|
1781
2140
|
|
|
1782
|
-
|
|
2141
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
2142
|
+
|
|
2143
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1783
2144
|
output += "\n"
|
|
1784
2145
|
|
|
1785
2146
|
if depth >= depth_limit
|
|
@@ -1829,7 +2190,7 @@ module Herb
|
|
|
1829
2190
|
attr_reader :content #: Herb::Token?
|
|
1830
2191
|
attr_reader :tag_closing #: Herb::Token?
|
|
1831
2192
|
|
|
1832
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
2193
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?) -> void
|
|
1833
2194
|
def initialize(type, location, errors, tag_opening, content, tag_closing)
|
|
1834
2195
|
super(type, location, errors)
|
|
1835
2196
|
@tag_opening = tag_opening
|
|
@@ -1837,6 +2198,16 @@ module Herb
|
|
|
1837
2198
|
@tag_closing = tag_closing
|
|
1838
2199
|
end
|
|
1839
2200
|
|
|
2201
|
+
#: () -> String
|
|
2202
|
+
def self.type
|
|
2203
|
+
"AST_ERB_END_NODE"
|
|
2204
|
+
end
|
|
2205
|
+
|
|
2206
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBEndNode
|
|
2207
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, location: Location.zero, errors: [])
|
|
2208
|
+
new(type, location, errors, tag_opening, content, tag_closing)
|
|
2209
|
+
end
|
|
2210
|
+
|
|
1840
2211
|
#: () -> serialized_erb_end_node
|
|
1841
2212
|
def to_hash
|
|
1842
2213
|
super.merge({
|
|
@@ -1870,7 +2241,9 @@ module Herb
|
|
|
1870
2241
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1871
2242
|
output = +""
|
|
1872
2243
|
|
|
1873
|
-
|
|
2244
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
2245
|
+
|
|
2246
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1874
2247
|
output += "\n"
|
|
1875
2248
|
|
|
1876
2249
|
if depth >= depth_limit
|
|
@@ -1910,7 +2283,7 @@ module Herb
|
|
|
1910
2283
|
attr_reader :tag_closing #: Herb::Token?
|
|
1911
2284
|
attr_reader :statements #: Array[Herb::AST::Node]
|
|
1912
2285
|
|
|
1913
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
2286
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Array[Herb::AST::Node]) -> void
|
|
1914
2287
|
def initialize(type, location, errors, tag_opening, content, tag_closing, statements)
|
|
1915
2288
|
super(type, location, errors)
|
|
1916
2289
|
@tag_opening = tag_opening
|
|
@@ -1919,6 +2292,16 @@ module Herb
|
|
|
1919
2292
|
@statements = statements
|
|
1920
2293
|
end
|
|
1921
2294
|
|
|
2295
|
+
#: () -> String
|
|
2296
|
+
def self.type
|
|
2297
|
+
"AST_ERB_ELSE_NODE"
|
|
2298
|
+
end
|
|
2299
|
+
|
|
2300
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?statements: Array[Herb::AST::Node], ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBElseNode
|
|
2301
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, statements: [], location: Location.zero, errors: [])
|
|
2302
|
+
new(type, location, errors, tag_opening, content, tag_closing, statements)
|
|
2303
|
+
end
|
|
2304
|
+
|
|
1922
2305
|
#: () -> serialized_erb_else_node
|
|
1923
2306
|
def to_hash
|
|
1924
2307
|
super.merge({
|
|
@@ -1953,7 +2336,9 @@ module Herb
|
|
|
1953
2336
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
1954
2337
|
output = +""
|
|
1955
2338
|
|
|
1956
|
-
|
|
2339
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
2340
|
+
|
|
2341
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
1957
2342
|
output += "\n"
|
|
1958
2343
|
|
|
1959
2344
|
if depth >= depth_limit
|
|
@@ -2003,7 +2388,7 @@ module Herb
|
|
|
2003
2388
|
attr_reader :subsequent #: (Herb::AST::ERBIfNode | Herb::AST::ERBElseNode)?
|
|
2004
2389
|
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
2005
2390
|
|
|
2006
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
2391
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Herb::Location?, String?, Array[Herb::AST::Node], (Herb::AST::ERBIfNode | Herb::AST::ERBElseNode)?, Herb::AST::ERBEndNode?) -> void
|
|
2007
2392
|
def initialize(type, location, errors, tag_opening, content, tag_closing, then_keyword, prism_node, statements, subsequent, end_node)
|
|
2008
2393
|
super(type, location, errors)
|
|
2009
2394
|
@tag_opening = tag_opening
|
|
@@ -2016,6 +2401,16 @@ module Herb
|
|
|
2016
2401
|
@end_node = end_node
|
|
2017
2402
|
end
|
|
2018
2403
|
|
|
2404
|
+
#: () -> String
|
|
2405
|
+
def self.type
|
|
2406
|
+
"AST_ERB_IF_NODE"
|
|
2407
|
+
end
|
|
2408
|
+
|
|
2409
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?then_keyword: Herb::Location?, ?prism_node: String?, ?statements: Array[Herb::AST::Node], ?subsequent: (Herb::AST::ERBIfNode | Herb::AST::ERBElseNode)?, ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBIfNode
|
|
2410
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, then_keyword: nil, prism_node: nil, statements: [], subsequent: nil, end_node: nil, location: Location.zero, errors: [])
|
|
2411
|
+
new(type, location, errors, tag_opening, content, tag_closing, then_keyword, prism_node, statements, subsequent, end_node)
|
|
2412
|
+
end
|
|
2413
|
+
|
|
2019
2414
|
#: () -> Prism::node?
|
|
2020
2415
|
def deserialized_prism_node
|
|
2021
2416
|
prism_node = @prism_node
|
|
@@ -2070,7 +2465,9 @@ module Herb
|
|
|
2070
2465
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
2071
2466
|
output = +""
|
|
2072
2467
|
|
|
2073
|
-
|
|
2468
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
2469
|
+
|
|
2470
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
2074
2471
|
output += "\n"
|
|
2075
2472
|
|
|
2076
2473
|
if depth >= depth_limit
|
|
@@ -2148,7 +2545,7 @@ module Herb
|
|
|
2148
2545
|
attr_reader :ensure_clause #: Herb::AST::ERBEnsureNode?
|
|
2149
2546
|
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
2150
2547
|
|
|
2151
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
2548
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, String?, Array[Herb::AST::Node], Array[Herb::AST::RubyParameterNode]?, Herb::AST::ERBRescueNode?, Herb::AST::ERBElseNode?, Herb::AST::ERBEnsureNode?, Herb::AST::ERBEndNode?) -> void
|
|
2152
2549
|
def initialize(type, location, errors, tag_opening, content, tag_closing, prism_node, body, block_arguments, rescue_clause, else_clause, ensure_clause, end_node)
|
|
2153
2550
|
super(type, location, errors)
|
|
2154
2551
|
@tag_opening = tag_opening
|
|
@@ -2163,6 +2560,16 @@ module Herb
|
|
|
2163
2560
|
@end_node = end_node
|
|
2164
2561
|
end
|
|
2165
2562
|
|
|
2563
|
+
#: () -> String
|
|
2564
|
+
def self.type
|
|
2565
|
+
"AST_ERB_BLOCK_NODE"
|
|
2566
|
+
end
|
|
2567
|
+
|
|
2568
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?prism_node: String?, ?body: Array[Herb::AST::Node], ?block_arguments: Array[Herb::AST::RubyParameterNode]?, ?rescue_clause: Herb::AST::ERBRescueNode?, ?else_clause: Herb::AST::ERBElseNode?, ?ensure_clause: Herb::AST::ERBEnsureNode?, ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBBlockNode
|
|
2569
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, prism_node: nil, body: [], block_arguments: [], rescue_clause: nil, else_clause: nil, ensure_clause: nil, end_node: nil, location: Location.zero, errors: [])
|
|
2570
|
+
new(type, location, errors, tag_opening, content, tag_closing, prism_node, body, block_arguments, rescue_clause, else_clause, ensure_clause, end_node)
|
|
2571
|
+
end
|
|
2572
|
+
|
|
2166
2573
|
#: () -> Prism::node?
|
|
2167
2574
|
def deserialized_prism_node
|
|
2168
2575
|
prism_node = @prism_node
|
|
@@ -2219,7 +2626,9 @@ module Herb
|
|
|
2219
2626
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
2220
2627
|
output = +""
|
|
2221
2628
|
|
|
2222
|
-
|
|
2629
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
2630
|
+
|
|
2631
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
2223
2632
|
output += "\n"
|
|
2224
2633
|
|
|
2225
2634
|
if depth >= depth_limit
|
|
@@ -2286,30 +2695,250 @@ module Herb
|
|
|
2286
2695
|
end
|
|
2287
2696
|
end
|
|
2288
2697
|
|
|
2289
|
-
#: type
|
|
2698
|
+
#: type serialized_erb_iteration_block_node = {
|
|
2290
2699
|
#| tag_opening: Herb::Token?,
|
|
2291
2700
|
#| content: Herb::Token?,
|
|
2292
2701
|
#| tag_closing: Herb::Token?,
|
|
2293
|
-
#|
|
|
2294
|
-
#|
|
|
2702
|
+
#| prism_node: String?,
|
|
2703
|
+
#| receiver: Herb::Token?,
|
|
2704
|
+
#| call_operator: Herb::Token?,
|
|
2705
|
+
#| message: Herb::Token?,
|
|
2706
|
+
#| arguments: Array[Herb::AST::RubyLiteralNode]?,
|
|
2707
|
+
#| block_opening: Herb::Token?,
|
|
2708
|
+
#| body: Array[Herb::AST::Node],
|
|
2709
|
+
#| block_arguments: Array[Herb::AST::RubyParameterNode]?,
|
|
2710
|
+
#| rescue_clause: Herb::AST::ERBRescueNode?,
|
|
2711
|
+
#| else_clause: Herb::AST::ERBElseNode?,
|
|
2712
|
+
#| ensure_clause: Herb::AST::ERBEnsureNode?,
|
|
2713
|
+
#| end_node: Herb::AST::ERBEndNode?,
|
|
2295
2714
|
#| }
|
|
2296
|
-
class
|
|
2715
|
+
class ERBIterationBlockNode < Node
|
|
2297
2716
|
include Colors
|
|
2298
2717
|
|
|
2299
2718
|
attr_reader :tag_opening #: Herb::Token?
|
|
2300
2719
|
attr_reader :content #: Herb::Token?
|
|
2301
2720
|
attr_reader :tag_closing #: Herb::Token?
|
|
2302
|
-
attr_reader :
|
|
2303
|
-
attr_reader :
|
|
2721
|
+
attr_reader :prism_node #: String?
|
|
2722
|
+
attr_reader :receiver #: Herb::Token?
|
|
2723
|
+
attr_reader :call_operator #: Herb::Token?
|
|
2724
|
+
attr_reader :message #: Herb::Token?
|
|
2725
|
+
attr_reader :arguments #: Array[Herb::AST::RubyLiteralNode]?
|
|
2726
|
+
attr_reader :block_opening #: Herb::Token?
|
|
2727
|
+
attr_reader :body #: Array[Herb::AST::Node]
|
|
2728
|
+
attr_reader :block_arguments #: Array[Herb::AST::RubyParameterNode]?
|
|
2729
|
+
attr_reader :rescue_clause #: Herb::AST::ERBRescueNode?
|
|
2730
|
+
attr_reader :else_clause #: Herb::AST::ERBElseNode?
|
|
2731
|
+
attr_reader :ensure_clause #: Herb::AST::ERBEnsureNode?
|
|
2732
|
+
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
2304
2733
|
|
|
2305
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
2306
|
-
def initialize(type, location, errors, tag_opening, content, tag_closing,
|
|
2734
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, String?, Herb::Token?, Herb::Token?, Herb::Token?, Array[Herb::AST::RubyLiteralNode]?, Herb::Token?, Array[Herb::AST::Node], Array[Herb::AST::RubyParameterNode]?, Herb::AST::ERBRescueNode?, Herb::AST::ERBElseNode?, Herb::AST::ERBEnsureNode?, Herb::AST::ERBEndNode?) -> void
|
|
2735
|
+
def initialize(type, location, errors, tag_opening, content, tag_closing, prism_node, receiver, call_operator, message, arguments, block_opening, body, block_arguments, rescue_clause, else_clause, ensure_clause, end_node)
|
|
2307
2736
|
super(type, location, errors)
|
|
2308
2737
|
@tag_opening = tag_opening
|
|
2309
2738
|
@content = content
|
|
2310
2739
|
@tag_closing = tag_closing
|
|
2311
|
-
@
|
|
2312
|
-
@
|
|
2740
|
+
@prism_node = prism_node
|
|
2741
|
+
@receiver = receiver
|
|
2742
|
+
@call_operator = call_operator
|
|
2743
|
+
@message = message
|
|
2744
|
+
@arguments = arguments
|
|
2745
|
+
@block_opening = block_opening
|
|
2746
|
+
@body = body
|
|
2747
|
+
@block_arguments = block_arguments
|
|
2748
|
+
@rescue_clause = rescue_clause
|
|
2749
|
+
@else_clause = else_clause
|
|
2750
|
+
@ensure_clause = ensure_clause
|
|
2751
|
+
@end_node = end_node
|
|
2752
|
+
end
|
|
2753
|
+
|
|
2754
|
+
#: () -> String
|
|
2755
|
+
def self.type
|
|
2756
|
+
"AST_ERB_ITERATION_BLOCK_NODE"
|
|
2757
|
+
end
|
|
2758
|
+
|
|
2759
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?prism_node: String?, ?receiver: Herb::Token?, ?call_operator: Herb::Token?, ?message: Herb::Token?, ?arguments: Array[Herb::AST::RubyLiteralNode]?, ?block_opening: Herb::Token?, ?body: Array[Herb::AST::Node], ?block_arguments: Array[Herb::AST::RubyParameterNode]?, ?rescue_clause: Herb::AST::ERBRescueNode?, ?else_clause: Herb::AST::ERBElseNode?, ?ensure_clause: Herb::AST::ERBEnsureNode?, ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBIterationBlockNode
|
|
2760
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, prism_node: nil, receiver: nil, call_operator: nil, message: nil, arguments: [], block_opening: nil, body: [], block_arguments: [], rescue_clause: nil, else_clause: nil, ensure_clause: nil, end_node: nil, location: Location.zero, errors: [])
|
|
2761
|
+
new(type, location, errors, tag_opening, content, tag_closing, prism_node, receiver, call_operator, message, arguments, block_opening, body, block_arguments, rescue_clause, else_clause, ensure_clause, end_node)
|
|
2762
|
+
end
|
|
2763
|
+
|
|
2764
|
+
#: () -> Prism::node?
|
|
2765
|
+
def deserialized_prism_node
|
|
2766
|
+
prism_node = @prism_node
|
|
2767
|
+
return nil unless prism_node
|
|
2768
|
+
return nil unless source
|
|
2769
|
+
|
|
2770
|
+
begin
|
|
2771
|
+
require "prism"
|
|
2772
|
+
rescue LoadError
|
|
2773
|
+
warn "The 'prism' gem is required to deserialize Prism nodes. Add it to your Gemfile or install it with: gem install prism"
|
|
2774
|
+
return nil
|
|
2775
|
+
end
|
|
2776
|
+
|
|
2777
|
+
Prism.load(source, prism_node).value
|
|
2778
|
+
end
|
|
2779
|
+
|
|
2780
|
+
#: () -> serialized_erb_iteration_block_node
|
|
2781
|
+
def to_hash
|
|
2782
|
+
super.merge({
|
|
2783
|
+
tag_opening: tag_opening,
|
|
2784
|
+
content: content,
|
|
2785
|
+
tag_closing: tag_closing,
|
|
2786
|
+
prism_node: prism_node,
|
|
2787
|
+
receiver: receiver,
|
|
2788
|
+
call_operator: call_operator,
|
|
2789
|
+
message: message,
|
|
2790
|
+
arguments: arguments,
|
|
2791
|
+
block_opening: block_opening,
|
|
2792
|
+
body: body,
|
|
2793
|
+
block_arguments: block_arguments,
|
|
2794
|
+
rescue_clause: rescue_clause,
|
|
2795
|
+
else_clause: else_clause,
|
|
2796
|
+
ensure_clause: ensure_clause,
|
|
2797
|
+
end_node: end_node,
|
|
2798
|
+
}) #: Herb::serialized_erb_iteration_block_node
|
|
2799
|
+
end
|
|
2800
|
+
|
|
2801
|
+
#: (Visitor) -> void
|
|
2802
|
+
def accept(visitor)
|
|
2803
|
+
visitor.visit_erb_iteration_block_node(self)
|
|
2804
|
+
end
|
|
2805
|
+
|
|
2806
|
+
#: () -> Array[Herb::AST::Node?]
|
|
2807
|
+
def child_nodes
|
|
2808
|
+
[*(arguments || []), *(body || []), *(block_arguments || []), rescue_clause, else_clause, ensure_clause, end_node]
|
|
2809
|
+
end
|
|
2810
|
+
|
|
2811
|
+
#: () -> Array[Herb::AST::Node]
|
|
2812
|
+
def compact_child_nodes
|
|
2813
|
+
child_nodes.compact
|
|
2814
|
+
end
|
|
2815
|
+
|
|
2816
|
+
#: () -> String
|
|
2817
|
+
def inspect
|
|
2818
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
2819
|
+
end
|
|
2820
|
+
|
|
2821
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
2822
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
2823
|
+
output = +""
|
|
2824
|
+
|
|
2825
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
2826
|
+
|
|
2827
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
2828
|
+
output += "\n"
|
|
2829
|
+
|
|
2830
|
+
if depth >= depth_limit
|
|
2831
|
+
output += dimmed("└── [depth limit reached ...]\n\n")
|
|
2832
|
+
|
|
2833
|
+
return output.gsub(/^/, " " * indent)
|
|
2834
|
+
end
|
|
2835
|
+
|
|
2836
|
+
output += inspect_errors(prefix: "│ ")
|
|
2837
|
+
|
|
2838
|
+
output += white("├── tag_opening: ")
|
|
2839
|
+
output += tag_opening ? tag_opening.tree_inspect : magenta("∅")
|
|
2840
|
+
output += "\n"
|
|
2841
|
+
output += white("├── content: ")
|
|
2842
|
+
output += content ? content.tree_inspect : magenta("∅")
|
|
2843
|
+
output += "\n"
|
|
2844
|
+
output += white("├── tag_closing: ")
|
|
2845
|
+
output += tag_closing ? tag_closing.tree_inspect : magenta("∅")
|
|
2846
|
+
output += "\n"
|
|
2847
|
+
if prism_node && source
|
|
2848
|
+
output += white("├── prism_node: ")
|
|
2849
|
+
output += Herb::PrismInspect.inspect_prism_serialized(prism_node, source, "│ ")
|
|
2850
|
+
output += "\n"
|
|
2851
|
+
end
|
|
2852
|
+
output += white("├── receiver: ")
|
|
2853
|
+
output += receiver ? receiver.tree_inspect : magenta("∅")
|
|
2854
|
+
output += "\n"
|
|
2855
|
+
output += white("├── call_operator: ")
|
|
2856
|
+
output += call_operator ? call_operator.tree_inspect : magenta("∅")
|
|
2857
|
+
output += "\n"
|
|
2858
|
+
output += white("├── message: ")
|
|
2859
|
+
output += message ? message.tree_inspect : magenta("∅")
|
|
2860
|
+
output += "\n"
|
|
2861
|
+
output += white("├── arguments: ")
|
|
2862
|
+
output += inspect_array(arguments, prefix: "│ ", indent: indent, depth: depth + 1, depth_limit: depth_limit)
|
|
2863
|
+
output += white("├── block_opening: ")
|
|
2864
|
+
output += block_opening ? block_opening.tree_inspect : magenta("∅")
|
|
2865
|
+
output += "\n"
|
|
2866
|
+
output += white("├── body: ")
|
|
2867
|
+
output += inspect_array(body, prefix: "│ ", indent: indent, depth: depth + 1, depth_limit: depth_limit)
|
|
2868
|
+
output += white("├── block_arguments: ")
|
|
2869
|
+
output += inspect_array(block_arguments, prefix: "│ ", indent: indent, depth: depth + 1, depth_limit: depth_limit)
|
|
2870
|
+
output += white("├── rescue_clause: ")
|
|
2871
|
+
if rescue_clause
|
|
2872
|
+
output += "\n"
|
|
2873
|
+
output += "│ └── "
|
|
2874
|
+
output += rescue_clause.tree_inspect(indent: indent, depth: depth + 1, depth_limit: depth_limit).gsub(/^/, " " * (indent + 1)).lstrip.gsub(/^/, "│ ").delete_prefix("│ ")
|
|
2875
|
+
else
|
|
2876
|
+
output += magenta("∅\n")
|
|
2877
|
+
end
|
|
2878
|
+
output += white("├── else_clause: ")
|
|
2879
|
+
if else_clause
|
|
2880
|
+
output += "\n"
|
|
2881
|
+
output += "│ └── "
|
|
2882
|
+
output += else_clause.tree_inspect(indent: indent, depth: depth + 1, depth_limit: depth_limit).gsub(/^/, " " * (indent + 1)).lstrip.gsub(/^/, "│ ").delete_prefix("│ ")
|
|
2883
|
+
else
|
|
2884
|
+
output += magenta("∅\n")
|
|
2885
|
+
end
|
|
2886
|
+
output += white("├── ensure_clause: ")
|
|
2887
|
+
if ensure_clause
|
|
2888
|
+
output += "\n"
|
|
2889
|
+
output += "│ └── "
|
|
2890
|
+
output += ensure_clause.tree_inspect(indent: indent, depth: depth + 1, depth_limit: depth_limit).gsub(/^/, " " * (indent + 1)).lstrip.gsub(/^/, "│ ").delete_prefix("│ ")
|
|
2891
|
+
else
|
|
2892
|
+
output += magenta("∅\n")
|
|
2893
|
+
end
|
|
2894
|
+
output += white("└── end_node: ")
|
|
2895
|
+
if end_node
|
|
2896
|
+
output += "\n"
|
|
2897
|
+
output += " └── "
|
|
2898
|
+
output += end_node.tree_inspect(indent: indent, depth: depth + 1, depth_limit: depth_limit).gsub(/^/, " " * (indent + 1)).lstrip.gsub(/^/, " ").delete_prefix(" ")
|
|
2899
|
+
else
|
|
2900
|
+
output += magenta("∅\n")
|
|
2901
|
+
end
|
|
2902
|
+
output += "\n"
|
|
2903
|
+
|
|
2904
|
+
output.gsub(/^/, " " * indent)
|
|
2905
|
+
end
|
|
2906
|
+
end
|
|
2907
|
+
|
|
2908
|
+
#: type serialized_erb_when_node = {
|
|
2909
|
+
#| tag_opening: Herb::Token?,
|
|
2910
|
+
#| content: Herb::Token?,
|
|
2911
|
+
#| tag_closing: Herb::Token?,
|
|
2912
|
+
#| then_keyword: Herb::Location?,
|
|
2913
|
+
#| statements: Array[Herb::AST::Node],
|
|
2914
|
+
#| }
|
|
2915
|
+
class ERBWhenNode < Node
|
|
2916
|
+
include Colors
|
|
2917
|
+
|
|
2918
|
+
attr_reader :tag_opening #: Herb::Token?
|
|
2919
|
+
attr_reader :content #: Herb::Token?
|
|
2920
|
+
attr_reader :tag_closing #: Herb::Token?
|
|
2921
|
+
attr_reader :then_keyword #: Herb::Location?
|
|
2922
|
+
attr_reader :statements #: Array[Herb::AST::Node]
|
|
2923
|
+
|
|
2924
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Herb::Location?, Array[Herb::AST::Node]) -> void
|
|
2925
|
+
def initialize(type, location, errors, tag_opening, content, tag_closing, then_keyword, statements)
|
|
2926
|
+
super(type, location, errors)
|
|
2927
|
+
@tag_opening = tag_opening
|
|
2928
|
+
@content = content
|
|
2929
|
+
@tag_closing = tag_closing
|
|
2930
|
+
@then_keyword = then_keyword
|
|
2931
|
+
@statements = statements
|
|
2932
|
+
end
|
|
2933
|
+
|
|
2934
|
+
#: () -> String
|
|
2935
|
+
def self.type
|
|
2936
|
+
"AST_ERB_WHEN_NODE"
|
|
2937
|
+
end
|
|
2938
|
+
|
|
2939
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?then_keyword: Herb::Location?, ?statements: Array[Herb::AST::Node], ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBWhenNode
|
|
2940
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, then_keyword: nil, statements: [], location: Location.zero, errors: [])
|
|
2941
|
+
new(type, location, errors, tag_opening, content, tag_closing, then_keyword, statements)
|
|
2313
2942
|
end
|
|
2314
2943
|
|
|
2315
2944
|
#: () -> serialized_erb_when_node
|
|
@@ -2347,7 +2976,9 @@ module Herb
|
|
|
2347
2976
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
2348
2977
|
output = +""
|
|
2349
2978
|
|
|
2350
|
-
|
|
2979
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
2980
|
+
|
|
2981
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
2351
2982
|
output += "\n"
|
|
2352
2983
|
|
|
2353
2984
|
if depth >= depth_limit
|
|
@@ -2400,7 +3031,7 @@ module Herb
|
|
|
2400
3031
|
attr_reader :else_clause #: Herb::AST::ERBElseNode?
|
|
2401
3032
|
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
2402
3033
|
|
|
2403
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
3034
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Array[Herb::AST::Node], String?, Array[Herb::AST::ERBWhenNode], Herb::AST::ERBElseNode?, Herb::AST::ERBEndNode?) -> void
|
|
2404
3035
|
def initialize(type, location, errors, tag_opening, content, tag_closing, children, prism_node, conditions, else_clause, end_node)
|
|
2405
3036
|
super(type, location, errors)
|
|
2406
3037
|
@tag_opening = tag_opening
|
|
@@ -2413,6 +3044,16 @@ module Herb
|
|
|
2413
3044
|
@end_node = end_node
|
|
2414
3045
|
end
|
|
2415
3046
|
|
|
3047
|
+
#: () -> String
|
|
3048
|
+
def self.type
|
|
3049
|
+
"AST_ERB_CASE_NODE"
|
|
3050
|
+
end
|
|
3051
|
+
|
|
3052
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?children: Array[Herb::AST::Node], ?prism_node: String?, ?conditions: Array[Herb::AST::ERBWhenNode], ?else_clause: Herb::AST::ERBElseNode?, ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBCaseNode
|
|
3053
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, children: [], prism_node: nil, conditions: [], else_clause: nil, end_node: nil, location: Location.zero, errors: [])
|
|
3054
|
+
new(type, location, errors, tag_opening, content, tag_closing, children, prism_node, conditions, else_clause, end_node)
|
|
3055
|
+
end
|
|
3056
|
+
|
|
2416
3057
|
#: () -> Prism::node?
|
|
2417
3058
|
def deserialized_prism_node
|
|
2418
3059
|
prism_node = @prism_node
|
|
@@ -2467,7 +3108,9 @@ module Herb
|
|
|
2467
3108
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
2468
3109
|
output = +""
|
|
2469
3110
|
|
|
2470
|
-
|
|
3111
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
3112
|
+
|
|
3113
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
2471
3114
|
output += "\n"
|
|
2472
3115
|
|
|
2473
3116
|
if depth >= depth_limit
|
|
@@ -2540,7 +3183,7 @@ module Herb
|
|
|
2540
3183
|
attr_reader :else_clause #: Herb::AST::ERBElseNode?
|
|
2541
3184
|
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
2542
3185
|
|
|
2543
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
3186
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Array[Herb::AST::Node], String?, Array[Herb::AST::ERBInNode], Herb::AST::ERBElseNode?, Herb::AST::ERBEndNode?) -> void
|
|
2544
3187
|
def initialize(type, location, errors, tag_opening, content, tag_closing, children, prism_node, conditions, else_clause, end_node)
|
|
2545
3188
|
super(type, location, errors)
|
|
2546
3189
|
@tag_opening = tag_opening
|
|
@@ -2553,6 +3196,16 @@ module Herb
|
|
|
2553
3196
|
@end_node = end_node
|
|
2554
3197
|
end
|
|
2555
3198
|
|
|
3199
|
+
#: () -> String
|
|
3200
|
+
def self.type
|
|
3201
|
+
"AST_ERB_CASE_MATCH_NODE"
|
|
3202
|
+
end
|
|
3203
|
+
|
|
3204
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?children: Array[Herb::AST::Node], ?prism_node: String?, ?conditions: Array[Herb::AST::ERBInNode], ?else_clause: Herb::AST::ERBElseNode?, ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBCaseMatchNode
|
|
3205
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, children: [], prism_node: nil, conditions: [], else_clause: nil, end_node: nil, location: Location.zero, errors: [])
|
|
3206
|
+
new(type, location, errors, tag_opening, content, tag_closing, children, prism_node, conditions, else_clause, end_node)
|
|
3207
|
+
end
|
|
3208
|
+
|
|
2556
3209
|
#: () -> Prism::node?
|
|
2557
3210
|
def deserialized_prism_node
|
|
2558
3211
|
prism_node = @prism_node
|
|
@@ -2607,7 +3260,9 @@ module Herb
|
|
|
2607
3260
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
2608
3261
|
output = +""
|
|
2609
3262
|
|
|
2610
|
-
|
|
3263
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
3264
|
+
|
|
3265
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
2611
3266
|
output += "\n"
|
|
2612
3267
|
|
|
2613
3268
|
if depth >= depth_limit
|
|
@@ -2676,7 +3331,7 @@ module Herb
|
|
|
2676
3331
|
attr_reader :statements #: Array[Herb::AST::Node]
|
|
2677
3332
|
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
2678
3333
|
|
|
2679
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
3334
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, String?, Array[Herb::AST::Node], Herb::AST::ERBEndNode?) -> void
|
|
2680
3335
|
def initialize(type, location, errors, tag_opening, content, tag_closing, prism_node, statements, end_node)
|
|
2681
3336
|
super(type, location, errors)
|
|
2682
3337
|
@tag_opening = tag_opening
|
|
@@ -2687,6 +3342,16 @@ module Herb
|
|
|
2687
3342
|
@end_node = end_node
|
|
2688
3343
|
end
|
|
2689
3344
|
|
|
3345
|
+
#: () -> String
|
|
3346
|
+
def self.type
|
|
3347
|
+
"AST_ERB_WHILE_NODE"
|
|
3348
|
+
end
|
|
3349
|
+
|
|
3350
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?prism_node: String?, ?statements: Array[Herb::AST::Node], ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBWhileNode
|
|
3351
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, prism_node: nil, statements: [], end_node: nil, location: Location.zero, errors: [])
|
|
3352
|
+
new(type, location, errors, tag_opening, content, tag_closing, prism_node, statements, end_node)
|
|
3353
|
+
end
|
|
3354
|
+
|
|
2690
3355
|
#: () -> Prism::node?
|
|
2691
3356
|
def deserialized_prism_node
|
|
2692
3357
|
prism_node = @prism_node
|
|
@@ -2739,7 +3404,9 @@ module Herb
|
|
|
2739
3404
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
2740
3405
|
output = +""
|
|
2741
3406
|
|
|
2742
|
-
|
|
3407
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
3408
|
+
|
|
3409
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
2743
3410
|
output += "\n"
|
|
2744
3411
|
|
|
2745
3412
|
if depth >= depth_limit
|
|
@@ -2798,7 +3465,7 @@ module Herb
|
|
|
2798
3465
|
attr_reader :statements #: Array[Herb::AST::Node]
|
|
2799
3466
|
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
2800
3467
|
|
|
2801
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
3468
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, String?, Array[Herb::AST::Node], Herb::AST::ERBEndNode?) -> void
|
|
2802
3469
|
def initialize(type, location, errors, tag_opening, content, tag_closing, prism_node, statements, end_node)
|
|
2803
3470
|
super(type, location, errors)
|
|
2804
3471
|
@tag_opening = tag_opening
|
|
@@ -2809,6 +3476,16 @@ module Herb
|
|
|
2809
3476
|
@end_node = end_node
|
|
2810
3477
|
end
|
|
2811
3478
|
|
|
3479
|
+
#: () -> String
|
|
3480
|
+
def self.type
|
|
3481
|
+
"AST_ERB_UNTIL_NODE"
|
|
3482
|
+
end
|
|
3483
|
+
|
|
3484
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?prism_node: String?, ?statements: Array[Herb::AST::Node], ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBUntilNode
|
|
3485
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, prism_node: nil, statements: [], end_node: nil, location: Location.zero, errors: [])
|
|
3486
|
+
new(type, location, errors, tag_opening, content, tag_closing, prism_node, statements, end_node)
|
|
3487
|
+
end
|
|
3488
|
+
|
|
2812
3489
|
#: () -> Prism::node?
|
|
2813
3490
|
def deserialized_prism_node
|
|
2814
3491
|
prism_node = @prism_node
|
|
@@ -2861,7 +3538,9 @@ module Herb
|
|
|
2861
3538
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
2862
3539
|
output = +""
|
|
2863
3540
|
|
|
2864
|
-
|
|
3541
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
3542
|
+
|
|
3543
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
2865
3544
|
output += "\n"
|
|
2866
3545
|
|
|
2867
3546
|
if depth >= depth_limit
|
|
@@ -2920,7 +3599,7 @@ module Herb
|
|
|
2920
3599
|
attr_reader :statements #: Array[Herb::AST::Node]
|
|
2921
3600
|
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
2922
3601
|
|
|
2923
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
3602
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, String?, Array[Herb::AST::Node], Herb::AST::ERBEndNode?) -> void
|
|
2924
3603
|
def initialize(type, location, errors, tag_opening, content, tag_closing, prism_node, statements, end_node)
|
|
2925
3604
|
super(type, location, errors)
|
|
2926
3605
|
@tag_opening = tag_opening
|
|
@@ -2931,6 +3610,16 @@ module Herb
|
|
|
2931
3610
|
@end_node = end_node
|
|
2932
3611
|
end
|
|
2933
3612
|
|
|
3613
|
+
#: () -> String
|
|
3614
|
+
def self.type
|
|
3615
|
+
"AST_ERB_FOR_NODE"
|
|
3616
|
+
end
|
|
3617
|
+
|
|
3618
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?prism_node: String?, ?statements: Array[Herb::AST::Node], ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBForNode
|
|
3619
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, prism_node: nil, statements: [], end_node: nil, location: Location.zero, errors: [])
|
|
3620
|
+
new(type, location, errors, tag_opening, content, tag_closing, prism_node, statements, end_node)
|
|
3621
|
+
end
|
|
3622
|
+
|
|
2934
3623
|
#: () -> Prism::node?
|
|
2935
3624
|
def deserialized_prism_node
|
|
2936
3625
|
prism_node = @prism_node
|
|
@@ -2983,7 +3672,9 @@ module Herb
|
|
|
2983
3672
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
2984
3673
|
output = +""
|
|
2985
3674
|
|
|
2986
|
-
|
|
3675
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
3676
|
+
|
|
3677
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
2987
3678
|
output += "\n"
|
|
2988
3679
|
|
|
2989
3680
|
if depth >= depth_limit
|
|
@@ -3040,7 +3731,7 @@ module Herb
|
|
|
3040
3731
|
attr_reader :statements #: Array[Herb::AST::Node]
|
|
3041
3732
|
attr_reader :subsequent #: Herb::AST::ERBRescueNode?
|
|
3042
3733
|
|
|
3043
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
3734
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Array[Herb::AST::Node], Herb::AST::ERBRescueNode?) -> void
|
|
3044
3735
|
def initialize(type, location, errors, tag_opening, content, tag_closing, statements, subsequent)
|
|
3045
3736
|
super(type, location, errors)
|
|
3046
3737
|
@tag_opening = tag_opening
|
|
@@ -3050,6 +3741,16 @@ module Herb
|
|
|
3050
3741
|
@subsequent = subsequent
|
|
3051
3742
|
end
|
|
3052
3743
|
|
|
3744
|
+
#: () -> String
|
|
3745
|
+
def self.type
|
|
3746
|
+
"AST_ERB_RESCUE_NODE"
|
|
3747
|
+
end
|
|
3748
|
+
|
|
3749
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?statements: Array[Herb::AST::Node], ?subsequent: Herb::AST::ERBRescueNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBRescueNode
|
|
3750
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, statements: [], subsequent: nil, location: Location.zero, errors: [])
|
|
3751
|
+
new(type, location, errors, tag_opening, content, tag_closing, statements, subsequent)
|
|
3752
|
+
end
|
|
3753
|
+
|
|
3053
3754
|
#: () -> serialized_erb_rescue_node
|
|
3054
3755
|
def to_hash
|
|
3055
3756
|
super.merge({
|
|
@@ -3085,7 +3786,9 @@ module Herb
|
|
|
3085
3786
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
3086
3787
|
output = +""
|
|
3087
3788
|
|
|
3088
|
-
|
|
3789
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
3790
|
+
|
|
3791
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
3089
3792
|
output += "\n"
|
|
3090
3793
|
|
|
3091
3794
|
if depth >= depth_limit
|
|
@@ -3135,7 +3838,7 @@ module Herb
|
|
|
3135
3838
|
attr_reader :tag_closing #: Herb::Token?
|
|
3136
3839
|
attr_reader :statements #: Array[Herb::AST::Node]
|
|
3137
3840
|
|
|
3138
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
3841
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Array[Herb::AST::Node]) -> void
|
|
3139
3842
|
def initialize(type, location, errors, tag_opening, content, tag_closing, statements)
|
|
3140
3843
|
super(type, location, errors)
|
|
3141
3844
|
@tag_opening = tag_opening
|
|
@@ -3144,6 +3847,16 @@ module Herb
|
|
|
3144
3847
|
@statements = statements
|
|
3145
3848
|
end
|
|
3146
3849
|
|
|
3850
|
+
#: () -> String
|
|
3851
|
+
def self.type
|
|
3852
|
+
"AST_ERB_ENSURE_NODE"
|
|
3853
|
+
end
|
|
3854
|
+
|
|
3855
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?statements: Array[Herb::AST::Node], ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBEnsureNode
|
|
3856
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, statements: [], location: Location.zero, errors: [])
|
|
3857
|
+
new(type, location, errors, tag_opening, content, tag_closing, statements)
|
|
3858
|
+
end
|
|
3859
|
+
|
|
3147
3860
|
#: () -> serialized_erb_ensure_node
|
|
3148
3861
|
def to_hash
|
|
3149
3862
|
super.merge({
|
|
@@ -3178,7 +3891,9 @@ module Herb
|
|
|
3178
3891
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
3179
3892
|
output = +""
|
|
3180
3893
|
|
|
3181
|
-
|
|
3894
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
3895
|
+
|
|
3896
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
3182
3897
|
output += "\n"
|
|
3183
3898
|
|
|
3184
3899
|
if depth >= depth_limit
|
|
@@ -3230,7 +3945,7 @@ module Herb
|
|
|
3230
3945
|
attr_reader :ensure_clause #: Herb::AST::ERBEnsureNode?
|
|
3231
3946
|
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
3232
3947
|
|
|
3233
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
3948
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, String?, Array[Herb::AST::Node], Herb::AST::ERBRescueNode?, Herb::AST::ERBElseNode?, Herb::AST::ERBEnsureNode?, Herb::AST::ERBEndNode?) -> void
|
|
3234
3949
|
def initialize(type, location, errors, tag_opening, content, tag_closing, prism_node, statements, rescue_clause, else_clause, ensure_clause, end_node)
|
|
3235
3950
|
super(type, location, errors)
|
|
3236
3951
|
@tag_opening = tag_opening
|
|
@@ -3244,6 +3959,16 @@ module Herb
|
|
|
3244
3959
|
@end_node = end_node
|
|
3245
3960
|
end
|
|
3246
3961
|
|
|
3962
|
+
#: () -> String
|
|
3963
|
+
def self.type
|
|
3964
|
+
"AST_ERB_BEGIN_NODE"
|
|
3965
|
+
end
|
|
3966
|
+
|
|
3967
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?prism_node: String?, ?statements: Array[Herb::AST::Node], ?rescue_clause: Herb::AST::ERBRescueNode?, ?else_clause: Herb::AST::ERBElseNode?, ?ensure_clause: Herb::AST::ERBEnsureNode?, ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBBeginNode
|
|
3968
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, prism_node: nil, statements: [], rescue_clause: nil, else_clause: nil, ensure_clause: nil, end_node: nil, location: Location.zero, errors: [])
|
|
3969
|
+
new(type, location, errors, tag_opening, content, tag_closing, prism_node, statements, rescue_clause, else_clause, ensure_clause, end_node)
|
|
3970
|
+
end
|
|
3971
|
+
|
|
3247
3972
|
#: () -> Prism::node?
|
|
3248
3973
|
def deserialized_prism_node
|
|
3249
3974
|
prism_node = @prism_node
|
|
@@ -3299,7 +4024,9 @@ module Herb
|
|
|
3299
4024
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
3300
4025
|
output = +""
|
|
3301
4026
|
|
|
3302
|
-
|
|
4027
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
4028
|
+
|
|
4029
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
3303
4030
|
output += "\n"
|
|
3304
4031
|
|
|
3305
4032
|
if depth >= depth_limit
|
|
@@ -3386,7 +4113,7 @@ module Herb
|
|
|
3386
4113
|
attr_reader :else_clause #: Herb::AST::ERBElseNode?
|
|
3387
4114
|
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
3388
4115
|
|
|
3389
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
4116
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Herb::Location?, String?, Array[Herb::AST::Node], Herb::AST::ERBElseNode?, Herb::AST::ERBEndNode?) -> void
|
|
3390
4117
|
def initialize(type, location, errors, tag_opening, content, tag_closing, then_keyword, prism_node, statements, else_clause, end_node)
|
|
3391
4118
|
super(type, location, errors)
|
|
3392
4119
|
@tag_opening = tag_opening
|
|
@@ -3399,6 +4126,16 @@ module Herb
|
|
|
3399
4126
|
@end_node = end_node
|
|
3400
4127
|
end
|
|
3401
4128
|
|
|
4129
|
+
#: () -> String
|
|
4130
|
+
def self.type
|
|
4131
|
+
"AST_ERB_UNLESS_NODE"
|
|
4132
|
+
end
|
|
4133
|
+
|
|
4134
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?then_keyword: Herb::Location?, ?prism_node: String?, ?statements: Array[Herb::AST::Node], ?else_clause: Herb::AST::ERBElseNode?, ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBUnlessNode
|
|
4135
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, then_keyword: nil, prism_node: nil, statements: [], else_clause: nil, end_node: nil, location: Location.zero, errors: [])
|
|
4136
|
+
new(type, location, errors, tag_opening, content, tag_closing, then_keyword, prism_node, statements, else_clause, end_node)
|
|
4137
|
+
end
|
|
4138
|
+
|
|
3402
4139
|
#: () -> Prism::node?
|
|
3403
4140
|
def deserialized_prism_node
|
|
3404
4141
|
prism_node = @prism_node
|
|
@@ -3453,7 +4190,9 @@ module Herb
|
|
|
3453
4190
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
3454
4191
|
output = +""
|
|
3455
4192
|
|
|
3456
|
-
|
|
4193
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
4194
|
+
|
|
4195
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
3457
4196
|
output += "\n"
|
|
3458
4197
|
|
|
3459
4198
|
if depth >= depth_limit
|
|
@@ -3515,13 +4254,23 @@ module Herb
|
|
|
3515
4254
|
attr_reader :name #: Herb::Token?
|
|
3516
4255
|
attr_reader :value #: Herb::AST::RubyLiteralNode?
|
|
3517
4256
|
|
|
3518
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
4257
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::AST::RubyLiteralNode?) -> void
|
|
3519
4258
|
def initialize(type, location, errors, name, value)
|
|
3520
4259
|
super(type, location, errors)
|
|
3521
4260
|
@name = name
|
|
3522
4261
|
@value = value
|
|
3523
4262
|
end
|
|
3524
4263
|
|
|
4264
|
+
#: () -> String
|
|
4265
|
+
def self.type
|
|
4266
|
+
"AST_RUBY_RENDER_LOCAL_NODE"
|
|
4267
|
+
end
|
|
4268
|
+
|
|
4269
|
+
#: (?name: Herb::Token?, ?value: Herb::AST::RubyLiteralNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> RubyRenderLocalNode
|
|
4270
|
+
def self.build(name: nil, value: nil, location: Location.zero, errors: [])
|
|
4271
|
+
new(type, location, errors, name, value)
|
|
4272
|
+
end
|
|
4273
|
+
|
|
3525
4274
|
#: () -> serialized_ruby_render_local_node
|
|
3526
4275
|
def to_hash
|
|
3527
4276
|
super.merge({
|
|
@@ -3554,7 +4303,9 @@ module Herb
|
|
|
3554
4303
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
3555
4304
|
output = +""
|
|
3556
4305
|
|
|
3557
|
-
|
|
4306
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
4307
|
+
|
|
4308
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
3558
4309
|
output += "\n"
|
|
3559
4310
|
|
|
3560
4311
|
if depth >= depth_limit
|
|
@@ -3601,6 +4352,8 @@ module Herb
|
|
|
3601
4352
|
#| handlers: Herb::Token?,
|
|
3602
4353
|
#| content_type: Herb::Token?,
|
|
3603
4354
|
#| locals: Array[Herb::AST::RubyRenderLocalNode]?,
|
|
4355
|
+
#| state: Array[Herb::AST::HerbStateDeclarationNode]?,
|
|
4356
|
+
#| state_location: Herb::Location?,
|
|
3604
4357
|
#| }
|
|
3605
4358
|
class RubyRenderKeywordsNode < Node
|
|
3606
4359
|
include Colors
|
|
@@ -3623,9 +4376,11 @@ module Herb
|
|
|
3623
4376
|
attr_reader :handlers #: Herb::Token?
|
|
3624
4377
|
attr_reader :content_type #: Herb::Token?
|
|
3625
4378
|
attr_reader :locals #: Array[Herb::AST::RubyRenderLocalNode]?
|
|
4379
|
+
attr_reader :state #: Array[Herb::AST::HerbStateDeclarationNode]?
|
|
4380
|
+
attr_reader :state_location #: Herb::Location?
|
|
3626
4381
|
|
|
3627
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
3628
|
-
def initialize(type, location, errors, partial, template_path, layout, file, inline_template, body, plain, html, renderable, collection, object, as_name, spacer_template, formats, variants, handlers, content_type, locals)
|
|
4382
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Array[Herb::AST::RubyRenderLocalNode]?, Array[Herb::AST::HerbStateDeclarationNode]?, Herb::Location?) -> void
|
|
4383
|
+
def initialize(type, location, errors, partial, template_path, layout, file, inline_template, body, plain, html, renderable, collection, object, as_name, spacer_template, formats, variants, handlers, content_type, locals, state, state_location)
|
|
3629
4384
|
super(type, location, errors)
|
|
3630
4385
|
@partial = partial
|
|
3631
4386
|
@template_path = template_path
|
|
@@ -3645,6 +4400,18 @@ module Herb
|
|
|
3645
4400
|
@handlers = handlers
|
|
3646
4401
|
@content_type = content_type
|
|
3647
4402
|
@locals = locals
|
|
4403
|
+
@state = state
|
|
4404
|
+
@state_location = state_location
|
|
4405
|
+
end
|
|
4406
|
+
|
|
4407
|
+
#: () -> String
|
|
4408
|
+
def self.type
|
|
4409
|
+
"AST_RUBY_RENDER_KEYWORDS_NODE"
|
|
4410
|
+
end
|
|
4411
|
+
|
|
4412
|
+
#: (?partial: Herb::Token?, ?template_path: Herb::Token?, ?layout: Herb::Token?, ?file: Herb::Token?, ?inline_template: Herb::Token?, ?body: Herb::Token?, ?plain: Herb::Token?, ?html: Herb::Token?, ?renderable: Herb::Token?, ?collection: Herb::Token?, ?object: Herb::Token?, ?as_name: Herb::Token?, ?spacer_template: Herb::Token?, ?formats: Herb::Token?, ?variants: Herb::Token?, ?handlers: Herb::Token?, ?content_type: Herb::Token?, ?locals: Array[Herb::AST::RubyRenderLocalNode]?, ?state: Array[Herb::AST::HerbStateDeclarationNode]?, ?state_location: Herb::Location?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> RubyRenderKeywordsNode
|
|
4413
|
+
def self.build(partial: nil, template_path: nil, layout: nil, file: nil, inline_template: nil, body: nil, plain: nil, html: nil, renderable: nil, collection: nil, object: nil, as_name: nil, spacer_template: nil, formats: nil, variants: nil, handlers: nil, content_type: nil, locals: [], state: [], state_location: nil, location: Location.zero, errors: [])
|
|
4414
|
+
new(type, location, errors, partial, template_path, layout, file, inline_template, body, plain, html, renderable, collection, object, as_name, spacer_template, formats, variants, handlers, content_type, locals, state, state_location)
|
|
3648
4415
|
end
|
|
3649
4416
|
|
|
3650
4417
|
#: () -> serialized_ruby_render_keywords_node
|
|
@@ -3668,6 +4435,8 @@ module Herb
|
|
|
3668
4435
|
handlers: handlers,
|
|
3669
4436
|
content_type: content_type,
|
|
3670
4437
|
locals: locals,
|
|
4438
|
+
state: state,
|
|
4439
|
+
state_location: state_location,
|
|
3671
4440
|
}) #: Herb::serialized_ruby_render_keywords_node
|
|
3672
4441
|
end
|
|
3673
4442
|
|
|
@@ -3678,7 +4447,7 @@ module Herb
|
|
|
3678
4447
|
|
|
3679
4448
|
#: () -> Array[Herb::AST::Node?]
|
|
3680
4449
|
def child_nodes
|
|
3681
|
-
[*(locals || [])]
|
|
4450
|
+
[*(locals || []), *(state || [])]
|
|
3682
4451
|
end
|
|
3683
4452
|
|
|
3684
4453
|
#: () -> Array[Herb::AST::Node]
|
|
@@ -3695,7 +4464,9 @@ module Herb
|
|
|
3695
4464
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
3696
4465
|
output = +""
|
|
3697
4466
|
|
|
3698
|
-
|
|
4467
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
4468
|
+
|
|
4469
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
3699
4470
|
output += "\n"
|
|
3700
4471
|
|
|
3701
4472
|
if depth >= depth_limit
|
|
@@ -3757,8 +4528,13 @@ module Herb
|
|
|
3757
4528
|
output += white("├── content_type: ")
|
|
3758
4529
|
output += content_type ? content_type.tree_inspect : magenta("∅")
|
|
3759
4530
|
output += "\n"
|
|
3760
|
-
output += white("
|
|
3761
|
-
output += inspect_array(locals, prefix: "
|
|
4531
|
+
output += white("├── locals: ")
|
|
4532
|
+
output += inspect_array(locals, prefix: "│ ", indent: indent, depth: depth + 1, depth_limit: depth_limit)
|
|
4533
|
+
output += white("├── state: ")
|
|
4534
|
+
output += inspect_array(state, prefix: "│ ", indent: indent, depth: depth + 1, depth_limit: depth_limit)
|
|
4535
|
+
output += white("└── state_location: ")
|
|
4536
|
+
output += state_location ? dimmed("(location: #{state_location.tree_inspect})") : magenta("∅")
|
|
4537
|
+
output += "\n"
|
|
3762
4538
|
output += "\n"
|
|
3763
4539
|
|
|
3764
4540
|
output.gsub(/^/, " " * indent)
|
|
@@ -3795,7 +4571,7 @@ module Herb
|
|
|
3795
4571
|
attr_reader :ensure_clause #: Herb::AST::ERBEnsureNode?
|
|
3796
4572
|
attr_reader :end_node #: Herb::AST::ERBEndNode?
|
|
3797
4573
|
|
|
3798
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
4574
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, nil, String?, Herb::AST::RubyRenderKeywordsNode?, Array[Herb::AST::Node], Array[Herb::AST::RubyParameterNode]?, Herb::AST::ERBRescueNode?, Herb::AST::ERBElseNode?, Herb::AST::ERBEnsureNode?, Herb::AST::ERBEndNode?) -> void
|
|
3799
4575
|
def initialize(type, location, errors, tag_opening, content, tag_closing, analyzed_ruby, prism_node, keywords, body, block_arguments, rescue_clause, else_clause, ensure_clause, end_node)
|
|
3800
4576
|
super(type, location, errors)
|
|
3801
4577
|
@tag_opening = tag_opening
|
|
@@ -3812,6 +4588,16 @@ module Herb
|
|
|
3812
4588
|
@end_node = end_node
|
|
3813
4589
|
end
|
|
3814
4590
|
|
|
4591
|
+
#: () -> String
|
|
4592
|
+
def self.type
|
|
4593
|
+
"AST_ERB_RENDER_NODE"
|
|
4594
|
+
end
|
|
4595
|
+
|
|
4596
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?analyzed_ruby: nil, ?prism_node: String?, ?keywords: Herb::AST::RubyRenderKeywordsNode?, ?body: Array[Herb::AST::Node], ?block_arguments: Array[Herb::AST::RubyParameterNode]?, ?rescue_clause: Herb::AST::ERBRescueNode?, ?else_clause: Herb::AST::ERBElseNode?, ?ensure_clause: Herb::AST::ERBEnsureNode?, ?end_node: Herb::AST::ERBEndNode?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBRenderNode
|
|
4597
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, analyzed_ruby: nil, prism_node: nil, keywords: nil, body: [], block_arguments: [], rescue_clause: nil, else_clause: nil, ensure_clause: nil, end_node: nil, location: Location.zero, errors: [])
|
|
4598
|
+
new(type, location, errors, tag_opening, content, tag_closing, analyzed_ruby, prism_node, keywords, body, block_arguments, rescue_clause, else_clause, ensure_clause, end_node)
|
|
4599
|
+
end
|
|
4600
|
+
|
|
3815
4601
|
#: () -> Prism::node?
|
|
3816
4602
|
def deserialized_prism_node
|
|
3817
4603
|
prism_node = @prism_node
|
|
@@ -3870,7 +4656,9 @@ module Herb
|
|
|
3870
4656
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
3871
4657
|
output = +""
|
|
3872
4658
|
|
|
3873
|
-
|
|
4659
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
4660
|
+
|
|
4661
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
3874
4662
|
output += "\n"
|
|
3875
4663
|
|
|
3876
4664
|
if depth >= depth_limit
|
|
@@ -3959,7 +4747,7 @@ module Herb
|
|
|
3959
4747
|
attr_reader :kind #: String?
|
|
3960
4748
|
attr_reader :required #: bool
|
|
3961
4749
|
|
|
3962
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
4750
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::AST::RubyLiteralNode?, String?, bool) -> void
|
|
3963
4751
|
def initialize(type, location, errors, name, default_value, kind, required)
|
|
3964
4752
|
super(type, location, errors)
|
|
3965
4753
|
@name = name
|
|
@@ -3968,6 +4756,16 @@ module Herb
|
|
|
3968
4756
|
@required = required
|
|
3969
4757
|
end
|
|
3970
4758
|
|
|
4759
|
+
#: () -> String
|
|
4760
|
+
def self.type
|
|
4761
|
+
"AST_RUBY_PARAMETER_NODE"
|
|
4762
|
+
end
|
|
4763
|
+
|
|
4764
|
+
#: (?name: Herb::Token?, ?default_value: Herb::AST::RubyLiteralNode?, ?kind: String?, ?required: bool, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> RubyParameterNode
|
|
4765
|
+
def self.build(name: nil, default_value: nil, kind: nil, required: false, location: Location.zero, errors: [])
|
|
4766
|
+
new(type, location, errors, name, default_value, kind, required)
|
|
4767
|
+
end
|
|
4768
|
+
|
|
3971
4769
|
#: () -> serialized_ruby_parameter_node
|
|
3972
4770
|
def to_hash
|
|
3973
4771
|
super.merge({
|
|
@@ -4002,7 +4800,9 @@ module Herb
|
|
|
4002
4800
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
4003
4801
|
output = +""
|
|
4004
4802
|
|
|
4005
|
-
|
|
4803
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
4804
|
+
|
|
4805
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
4006
4806
|
output += "\n"
|
|
4007
4807
|
|
|
4008
4808
|
if depth >= depth_limit
|
|
@@ -4052,7 +4852,7 @@ module Herb
|
|
|
4052
4852
|
attr_reader :prism_node #: String?
|
|
4053
4853
|
attr_reader :locals #: Array[Herb::AST::RubyParameterNode]?
|
|
4054
4854
|
|
|
4055
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
4855
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, nil, String?, Array[Herb::AST::RubyParameterNode]?) -> void
|
|
4056
4856
|
def initialize(type, location, errors, tag_opening, content, tag_closing, analyzed_ruby, prism_node, locals)
|
|
4057
4857
|
super(type, location, errors)
|
|
4058
4858
|
@tag_opening = tag_opening
|
|
@@ -4063,6 +4863,16 @@ module Herb
|
|
|
4063
4863
|
@locals = locals
|
|
4064
4864
|
end
|
|
4065
4865
|
|
|
4866
|
+
#: () -> String
|
|
4867
|
+
def self.type
|
|
4868
|
+
"AST_ERB_STRICT_LOCALS_NODE"
|
|
4869
|
+
end
|
|
4870
|
+
|
|
4871
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?analyzed_ruby: nil, ?prism_node: String?, ?locals: Array[Herb::AST::RubyParameterNode]?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBStrictLocalsNode
|
|
4872
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, analyzed_ruby: nil, prism_node: nil, locals: [], location: Location.zero, errors: [])
|
|
4873
|
+
new(type, location, errors, tag_opening, content, tag_closing, analyzed_ruby, prism_node, locals)
|
|
4874
|
+
end
|
|
4875
|
+
|
|
4066
4876
|
#: () -> Prism::node?
|
|
4067
4877
|
def deserialized_prism_node
|
|
4068
4878
|
prism_node = @prism_node
|
|
@@ -4115,7 +4925,9 @@ module Herb
|
|
|
4115
4925
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
4116
4926
|
output = +""
|
|
4117
4927
|
|
|
4118
|
-
|
|
4928
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
4929
|
+
|
|
4930
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
4119
4931
|
output += "\n"
|
|
4120
4932
|
|
|
4121
4933
|
if depth >= depth_limit
|
|
@@ -4160,7 +4972,7 @@ module Herb
|
|
|
4160
4972
|
attr_reader :content #: Herb::Token?
|
|
4161
4973
|
attr_reader :tag_closing #: Herb::Token?
|
|
4162
4974
|
|
|
4163
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
4975
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?) -> void
|
|
4164
4976
|
def initialize(type, location, errors, tag_opening, content, tag_closing)
|
|
4165
4977
|
super(type, location, errors)
|
|
4166
4978
|
@tag_opening = tag_opening
|
|
@@ -4168,8 +4980,18 @@ module Herb
|
|
|
4168
4980
|
@tag_closing = tag_closing
|
|
4169
4981
|
end
|
|
4170
4982
|
|
|
4171
|
-
#: () ->
|
|
4172
|
-
def
|
|
4983
|
+
#: () -> String
|
|
4984
|
+
def self.type
|
|
4985
|
+
"AST_ERB_YIELD_NODE"
|
|
4986
|
+
end
|
|
4987
|
+
|
|
4988
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBYieldNode
|
|
4989
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, location: Location.zero, errors: [])
|
|
4990
|
+
new(type, location, errors, tag_opening, content, tag_closing)
|
|
4991
|
+
end
|
|
4992
|
+
|
|
4993
|
+
#: () -> serialized_erb_yield_node
|
|
4994
|
+
def to_hash
|
|
4173
4995
|
super.merge({
|
|
4174
4996
|
tag_opening: tag_opening,
|
|
4175
4997
|
content: content,
|
|
@@ -4201,7 +5023,9 @@ module Herb
|
|
|
4201
5023
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
4202
5024
|
output = +""
|
|
4203
5025
|
|
|
4204
|
-
|
|
5026
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
5027
|
+
|
|
5028
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
4205
5029
|
output += "\n"
|
|
4206
5030
|
|
|
4207
5031
|
if depth >= depth_limit
|
|
@@ -4243,7 +5067,7 @@ module Herb
|
|
|
4243
5067
|
attr_reader :then_keyword #: Herb::Location?
|
|
4244
5068
|
attr_reader :statements #: Array[Herb::AST::Node]
|
|
4245
5069
|
|
|
4246
|
-
#: (String, Location, Array[Herb::Errors::Error], Herb::Token
|
|
5070
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Herb::Location?, Array[Herb::AST::Node]) -> void
|
|
4247
5071
|
def initialize(type, location, errors, tag_opening, content, tag_closing, then_keyword, statements)
|
|
4248
5072
|
super(type, location, errors)
|
|
4249
5073
|
@tag_opening = tag_opening
|
|
@@ -4253,6 +5077,16 @@ module Herb
|
|
|
4253
5077
|
@statements = statements
|
|
4254
5078
|
end
|
|
4255
5079
|
|
|
5080
|
+
#: () -> String
|
|
5081
|
+
def self.type
|
|
5082
|
+
"AST_ERB_IN_NODE"
|
|
5083
|
+
end
|
|
5084
|
+
|
|
5085
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?then_keyword: Herb::Location?, ?statements: Array[Herb::AST::Node], ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBInNode
|
|
5086
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, then_keyword: nil, statements: [], location: Location.zero, errors: [])
|
|
5087
|
+
new(type, location, errors, tag_opening, content, tag_closing, then_keyword, statements)
|
|
5088
|
+
end
|
|
5089
|
+
|
|
4256
5090
|
#: () -> serialized_erb_in_node
|
|
4257
5091
|
def to_hash
|
|
4258
5092
|
super.merge({
|
|
@@ -4288,7 +5122,9 @@ module Herb
|
|
|
4288
5122
|
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
4289
5123
|
output = +""
|
|
4290
5124
|
|
|
4291
|
-
|
|
5125
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
5126
|
+
|
|
5127
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
4292
5128
|
output += "\n"
|
|
4293
5129
|
|
|
4294
5130
|
if depth >= depth_limit
|
|
@@ -4319,5 +5155,406 @@ module Herb
|
|
|
4319
5155
|
end
|
|
4320
5156
|
end
|
|
4321
5157
|
|
|
5158
|
+
#: type serialized_herb_directive_node = {
|
|
5159
|
+
#| tag_opening: Herb::Token?,
|
|
5160
|
+
#| content: Herb::Token?,
|
|
5161
|
+
#| tag_closing: Herb::Token?,
|
|
5162
|
+
#| key: Herb::Token?,
|
|
5163
|
+
#| arguments: Herb::Token?,
|
|
5164
|
+
#| }
|
|
5165
|
+
class HerbDirectiveNode < Node
|
|
5166
|
+
include Colors
|
|
5167
|
+
|
|
5168
|
+
attr_reader :tag_opening #: Herb::Token?
|
|
5169
|
+
attr_reader :content #: Herb::Token?
|
|
5170
|
+
attr_reader :tag_closing #: Herb::Token?
|
|
5171
|
+
attr_reader :key #: Herb::Token?
|
|
5172
|
+
attr_reader :arguments #: Herb::Token?
|
|
5173
|
+
|
|
5174
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?) -> void
|
|
5175
|
+
def initialize(type, location, errors, tag_opening, content, tag_closing, key, arguments)
|
|
5176
|
+
super(type, location, errors)
|
|
5177
|
+
@tag_opening = tag_opening
|
|
5178
|
+
@content = content
|
|
5179
|
+
@tag_closing = tag_closing
|
|
5180
|
+
@key = key
|
|
5181
|
+
@arguments = arguments
|
|
5182
|
+
end
|
|
5183
|
+
|
|
5184
|
+
#: () -> String
|
|
5185
|
+
def self.type
|
|
5186
|
+
"AST_HERB_DIRECTIVE_NODE"
|
|
5187
|
+
end
|
|
5188
|
+
|
|
5189
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?key: Herb::Token?, ?arguments: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HerbDirectiveNode
|
|
5190
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, key: nil, arguments: nil, location: Location.zero, errors: [])
|
|
5191
|
+
new(type, location, errors, tag_opening, content, tag_closing, key, arguments)
|
|
5192
|
+
end
|
|
5193
|
+
|
|
5194
|
+
#: () -> serialized_herb_directive_node
|
|
5195
|
+
def to_hash
|
|
5196
|
+
super.merge({
|
|
5197
|
+
tag_opening: tag_opening,
|
|
5198
|
+
content: content,
|
|
5199
|
+
tag_closing: tag_closing,
|
|
5200
|
+
key: key,
|
|
5201
|
+
arguments: arguments,
|
|
5202
|
+
}) #: Herb::serialized_herb_directive_node
|
|
5203
|
+
end
|
|
5204
|
+
|
|
5205
|
+
#: (Visitor) -> void
|
|
5206
|
+
def accept(visitor)
|
|
5207
|
+
visitor.visit_herb_directive_node(self)
|
|
5208
|
+
end
|
|
5209
|
+
|
|
5210
|
+
#: () -> Array[Herb::AST::Node?]
|
|
5211
|
+
def child_nodes
|
|
5212
|
+
[]
|
|
5213
|
+
end
|
|
5214
|
+
|
|
5215
|
+
#: () -> Array[Herb::AST::Node]
|
|
5216
|
+
def compact_child_nodes
|
|
5217
|
+
child_nodes.compact
|
|
5218
|
+
end
|
|
5219
|
+
|
|
5220
|
+
#: () -> String
|
|
5221
|
+
def inspect
|
|
5222
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
5223
|
+
end
|
|
5224
|
+
|
|
5225
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
5226
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
5227
|
+
output = +""
|
|
5228
|
+
|
|
5229
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
5230
|
+
|
|
5231
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
5232
|
+
output += "\n"
|
|
5233
|
+
|
|
5234
|
+
if depth >= depth_limit
|
|
5235
|
+
output += dimmed("└── [depth limit reached ...]\n\n")
|
|
5236
|
+
|
|
5237
|
+
return output.gsub(/^/, " " * indent)
|
|
5238
|
+
end
|
|
5239
|
+
|
|
5240
|
+
output += inspect_errors(prefix: "│ ")
|
|
5241
|
+
|
|
5242
|
+
output += white("├── tag_opening: ")
|
|
5243
|
+
output += tag_opening ? tag_opening.tree_inspect : magenta("∅")
|
|
5244
|
+
output += "\n"
|
|
5245
|
+
output += white("├── content: ")
|
|
5246
|
+
output += content ? content.tree_inspect : magenta("∅")
|
|
5247
|
+
output += "\n"
|
|
5248
|
+
output += white("├── tag_closing: ")
|
|
5249
|
+
output += tag_closing ? tag_closing.tree_inspect : magenta("∅")
|
|
5250
|
+
output += "\n"
|
|
5251
|
+
output += white("├── key: ")
|
|
5252
|
+
output += key ? key.tree_inspect : magenta("∅")
|
|
5253
|
+
output += "\n"
|
|
5254
|
+
output += white("└── arguments: ")
|
|
5255
|
+
output += arguments ? arguments.tree_inspect : magenta("∅")
|
|
5256
|
+
output += "\n"
|
|
5257
|
+
output += "\n"
|
|
5258
|
+
|
|
5259
|
+
output.gsub(/^/, " " * indent)
|
|
5260
|
+
end
|
|
5261
|
+
end
|
|
5262
|
+
|
|
5263
|
+
#: type serialized_herb_state_declaration_node = {
|
|
5264
|
+
#| name: Herb::Token?,
|
|
5265
|
+
#| default_value: Herb::AST::RubyLiteralNode?,
|
|
5266
|
+
#| kind: String?,
|
|
5267
|
+
#| }
|
|
5268
|
+
class HerbStateDeclarationNode < Node
|
|
5269
|
+
include Colors
|
|
5270
|
+
|
|
5271
|
+
attr_reader :name #: Herb::Token?
|
|
5272
|
+
attr_reader :default_value #: Herb::AST::RubyLiteralNode?
|
|
5273
|
+
attr_reader :kind #: String?
|
|
5274
|
+
|
|
5275
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::AST::RubyLiteralNode?, String?) -> void
|
|
5276
|
+
def initialize(type, location, errors, name, default_value, kind)
|
|
5277
|
+
super(type, location, errors)
|
|
5278
|
+
@name = name
|
|
5279
|
+
@default_value = default_value
|
|
5280
|
+
@kind = kind&.force_encoding("utf-8")
|
|
5281
|
+
end
|
|
5282
|
+
|
|
5283
|
+
#: () -> String
|
|
5284
|
+
def self.type
|
|
5285
|
+
"AST_HERB_STATE_DECLARATION_NODE"
|
|
5286
|
+
end
|
|
5287
|
+
|
|
5288
|
+
#: (?name: Herb::Token?, ?default_value: Herb::AST::RubyLiteralNode?, ?kind: String?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HerbStateDeclarationNode
|
|
5289
|
+
def self.build(name: nil, default_value: nil, kind: nil, location: Location.zero, errors: [])
|
|
5290
|
+
new(type, location, errors, name, default_value, kind)
|
|
5291
|
+
end
|
|
5292
|
+
|
|
5293
|
+
#: () -> serialized_herb_state_declaration_node
|
|
5294
|
+
def to_hash
|
|
5295
|
+
super.merge({
|
|
5296
|
+
name: name,
|
|
5297
|
+
default_value: default_value,
|
|
5298
|
+
kind: kind,
|
|
5299
|
+
}) #: Herb::serialized_herb_state_declaration_node
|
|
5300
|
+
end
|
|
5301
|
+
|
|
5302
|
+
#: (Visitor) -> void
|
|
5303
|
+
def accept(visitor)
|
|
5304
|
+
visitor.visit_herb_state_declaration_node(self)
|
|
5305
|
+
end
|
|
5306
|
+
|
|
5307
|
+
#: () -> Array[Herb::AST::Node?]
|
|
5308
|
+
def child_nodes
|
|
5309
|
+
[default_value]
|
|
5310
|
+
end
|
|
5311
|
+
|
|
5312
|
+
#: () -> Array[Herb::AST::Node]
|
|
5313
|
+
def compact_child_nodes
|
|
5314
|
+
child_nodes.compact
|
|
5315
|
+
end
|
|
5316
|
+
|
|
5317
|
+
#: () -> String
|
|
5318
|
+
def inspect
|
|
5319
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
5320
|
+
end
|
|
5321
|
+
|
|
5322
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
5323
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
5324
|
+
output = +""
|
|
5325
|
+
|
|
5326
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
5327
|
+
|
|
5328
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
5329
|
+
output += "\n"
|
|
5330
|
+
|
|
5331
|
+
if depth >= depth_limit
|
|
5332
|
+
output += dimmed("└── [depth limit reached ...]\n\n")
|
|
5333
|
+
|
|
5334
|
+
return output.gsub(/^/, " " * indent)
|
|
5335
|
+
end
|
|
5336
|
+
|
|
5337
|
+
output += inspect_errors(prefix: "│ ")
|
|
5338
|
+
|
|
5339
|
+
output += white("├── name: ")
|
|
5340
|
+
output += name ? name.tree_inspect : magenta("∅")
|
|
5341
|
+
output += "\n"
|
|
5342
|
+
output += white("├── default_value: ")
|
|
5343
|
+
if default_value
|
|
5344
|
+
output += "\n"
|
|
5345
|
+
output += "│ └── "
|
|
5346
|
+
output += default_value.tree_inspect(indent: indent, depth: depth + 1, depth_limit: depth_limit).gsub(/^/, " " * (indent + 1)).lstrip.gsub(/^/, "│ ").delete_prefix("│ ")
|
|
5347
|
+
else
|
|
5348
|
+
output += magenta("∅\n")
|
|
5349
|
+
end
|
|
5350
|
+
output += white("└── kind: ") + green("#{kind.inspect}\n")
|
|
5351
|
+
output += "\n"
|
|
5352
|
+
|
|
5353
|
+
output.gsub(/^/, " " * indent)
|
|
5354
|
+
end
|
|
5355
|
+
end
|
|
5356
|
+
|
|
5357
|
+
#: type serialized_herb_state_directive_node = {
|
|
5358
|
+
#| tag_opening: Herb::Token?,
|
|
5359
|
+
#| content: Herb::Token?,
|
|
5360
|
+
#| tag_closing: Herb::Token?,
|
|
5361
|
+
#| key: Herb::Token?,
|
|
5362
|
+
#| signature: Herb::Token?,
|
|
5363
|
+
#| states: Array[Herb::AST::HerbStateDeclarationNode]?,
|
|
5364
|
+
#| }
|
|
5365
|
+
class HerbStateDirectiveNode < Node
|
|
5366
|
+
include Colors
|
|
5367
|
+
|
|
5368
|
+
attr_reader :tag_opening #: Herb::Token?
|
|
5369
|
+
attr_reader :content #: Herb::Token?
|
|
5370
|
+
attr_reader :tag_closing #: Herb::Token?
|
|
5371
|
+
attr_reader :key #: Herb::Token?
|
|
5372
|
+
attr_reader :signature #: Herb::Token?
|
|
5373
|
+
attr_reader :states #: Array[Herb::AST::HerbStateDeclarationNode]?
|
|
5374
|
+
|
|
5375
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Herb::Token?, Array[Herb::AST::HerbStateDeclarationNode]?) -> void
|
|
5376
|
+
def initialize(type, location, errors, tag_opening, content, tag_closing, key, signature, states)
|
|
5377
|
+
super(type, location, errors)
|
|
5378
|
+
@tag_opening = tag_opening
|
|
5379
|
+
@content = content
|
|
5380
|
+
@tag_closing = tag_closing
|
|
5381
|
+
@key = key
|
|
5382
|
+
@signature = signature
|
|
5383
|
+
@states = states
|
|
5384
|
+
end
|
|
5385
|
+
|
|
5386
|
+
#: () -> String
|
|
5387
|
+
def self.type
|
|
5388
|
+
"AST_HERB_STATE_DIRECTIVE_NODE"
|
|
5389
|
+
end
|
|
5390
|
+
|
|
5391
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?key: Herb::Token?, ?signature: Herb::Token?, ?states: Array[Herb::AST::HerbStateDeclarationNode]?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> HerbStateDirectiveNode
|
|
5392
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, key: nil, signature: nil, states: [], location: Location.zero, errors: [])
|
|
5393
|
+
new(type, location, errors, tag_opening, content, tag_closing, key, signature, states)
|
|
5394
|
+
end
|
|
5395
|
+
|
|
5396
|
+
#: () -> serialized_herb_state_directive_node
|
|
5397
|
+
def to_hash
|
|
5398
|
+
super.merge({
|
|
5399
|
+
tag_opening: tag_opening,
|
|
5400
|
+
content: content,
|
|
5401
|
+
tag_closing: tag_closing,
|
|
5402
|
+
key: key,
|
|
5403
|
+
signature: signature,
|
|
5404
|
+
states: states,
|
|
5405
|
+
}) #: Herb::serialized_herb_state_directive_node
|
|
5406
|
+
end
|
|
5407
|
+
|
|
5408
|
+
#: (Visitor) -> void
|
|
5409
|
+
def accept(visitor)
|
|
5410
|
+
visitor.visit_herb_state_directive_node(self)
|
|
5411
|
+
end
|
|
5412
|
+
|
|
5413
|
+
#: () -> Array[Herb::AST::Node?]
|
|
5414
|
+
def child_nodes
|
|
5415
|
+
[*(states || [])]
|
|
5416
|
+
end
|
|
5417
|
+
|
|
5418
|
+
#: () -> Array[Herb::AST::Node]
|
|
5419
|
+
def compact_child_nodes
|
|
5420
|
+
child_nodes.compact
|
|
5421
|
+
end
|
|
5422
|
+
|
|
5423
|
+
#: () -> String
|
|
5424
|
+
def inspect
|
|
5425
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
5426
|
+
end
|
|
5427
|
+
|
|
5428
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
5429
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
5430
|
+
output = +""
|
|
5431
|
+
|
|
5432
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
5433
|
+
|
|
5434
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
5435
|
+
output += "\n"
|
|
5436
|
+
|
|
5437
|
+
if depth >= depth_limit
|
|
5438
|
+
output += dimmed("└── [depth limit reached ...]\n\n")
|
|
5439
|
+
|
|
5440
|
+
return output.gsub(/^/, " " * indent)
|
|
5441
|
+
end
|
|
5442
|
+
|
|
5443
|
+
output += inspect_errors(prefix: "│ ")
|
|
5444
|
+
|
|
5445
|
+
output += white("├── tag_opening: ")
|
|
5446
|
+
output += tag_opening ? tag_opening.tree_inspect : magenta("∅")
|
|
5447
|
+
output += "\n"
|
|
5448
|
+
output += white("├── content: ")
|
|
5449
|
+
output += content ? content.tree_inspect : magenta("∅")
|
|
5450
|
+
output += "\n"
|
|
5451
|
+
output += white("├── tag_closing: ")
|
|
5452
|
+
output += tag_closing ? tag_closing.tree_inspect : magenta("∅")
|
|
5453
|
+
output += "\n"
|
|
5454
|
+
output += white("├── key: ")
|
|
5455
|
+
output += key ? key.tree_inspect : magenta("∅")
|
|
5456
|
+
output += "\n"
|
|
5457
|
+
output += white("├── signature: ")
|
|
5458
|
+
output += signature ? signature.tree_inspect : magenta("∅")
|
|
5459
|
+
output += "\n"
|
|
5460
|
+
output += white("└── states: ")
|
|
5461
|
+
output += inspect_array(states, prefix: " ", indent: indent, depth: depth + 1, depth_limit: depth_limit)
|
|
5462
|
+
output += "\n"
|
|
5463
|
+
|
|
5464
|
+
output.gsub(/^/, " " * indent)
|
|
5465
|
+
end
|
|
5466
|
+
end
|
|
5467
|
+
|
|
5468
|
+
#: type serialized_erb_comment_node = {
|
|
5469
|
+
#| tag_opening: Herb::Token?,
|
|
5470
|
+
#| content: Herb::Token?,
|
|
5471
|
+
#| tag_closing: Herb::Token?,
|
|
5472
|
+
#| }
|
|
5473
|
+
class ERBCommentNode < Node
|
|
5474
|
+
include Colors
|
|
5475
|
+
|
|
5476
|
+
attr_reader :tag_opening #: Herb::Token?
|
|
5477
|
+
attr_reader :content #: Herb::Token?
|
|
5478
|
+
attr_reader :tag_closing #: Herb::Token?
|
|
5479
|
+
|
|
5480
|
+
#: (String, Location, Array[Herb::Errors::Error], Herb::Token?, Herb::Token?, Herb::Token?) -> void
|
|
5481
|
+
def initialize(type, location, errors, tag_opening, content, tag_closing)
|
|
5482
|
+
super(type, location, errors)
|
|
5483
|
+
@tag_opening = tag_opening
|
|
5484
|
+
@content = content
|
|
5485
|
+
@tag_closing = tag_closing
|
|
5486
|
+
end
|
|
5487
|
+
|
|
5488
|
+
#: () -> String
|
|
5489
|
+
def self.type
|
|
5490
|
+
"AST_ERB_COMMENT_NODE"
|
|
5491
|
+
end
|
|
5492
|
+
|
|
5493
|
+
#: (?tag_opening: Herb::Token?, ?content: Herb::Token?, ?tag_closing: Herb::Token?, ?location: Location, ?errors: Array[Herb::Errors::Error]) -> ERBCommentNode
|
|
5494
|
+
def self.build(tag_opening: nil, content: nil, tag_closing: nil, location: Location.zero, errors: [])
|
|
5495
|
+
new(type, location, errors, tag_opening, content, tag_closing)
|
|
5496
|
+
end
|
|
5497
|
+
|
|
5498
|
+
#: () -> serialized_erb_comment_node
|
|
5499
|
+
def to_hash
|
|
5500
|
+
super.merge({
|
|
5501
|
+
tag_opening: tag_opening,
|
|
5502
|
+
content: content,
|
|
5503
|
+
tag_closing: tag_closing,
|
|
5504
|
+
}) #: Herb::serialized_erb_comment_node
|
|
5505
|
+
end
|
|
5506
|
+
|
|
5507
|
+
#: (Visitor) -> void
|
|
5508
|
+
def accept(visitor)
|
|
5509
|
+
visitor.visit_erb_comment_node(self)
|
|
5510
|
+
end
|
|
5511
|
+
|
|
5512
|
+
#: () -> Array[Herb::AST::Node?]
|
|
5513
|
+
def child_nodes
|
|
5514
|
+
[]
|
|
5515
|
+
end
|
|
5516
|
+
|
|
5517
|
+
#: () -> Array[Herb::AST::Node]
|
|
5518
|
+
def compact_child_nodes
|
|
5519
|
+
child_nodes.compact
|
|
5520
|
+
end
|
|
5521
|
+
|
|
5522
|
+
#: () -> String
|
|
5523
|
+
def inspect
|
|
5524
|
+
tree_inspect.rstrip.gsub(/\s+$/, "")
|
|
5525
|
+
end
|
|
5526
|
+
|
|
5527
|
+
#: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
|
|
5528
|
+
def tree_inspect(indent: 0, depth: 0, depth_limit: 10)
|
|
5529
|
+
output = +""
|
|
5530
|
+
|
|
5531
|
+
location_inspect = location ? location.tree_inspect : "∅"
|
|
5532
|
+
|
|
5533
|
+
output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location_inspect})")}")
|
|
5534
|
+
output += "\n"
|
|
5535
|
+
|
|
5536
|
+
if depth >= depth_limit
|
|
5537
|
+
output += dimmed("└── [depth limit reached ...]\n\n")
|
|
5538
|
+
|
|
5539
|
+
return output.gsub(/^/, " " * indent)
|
|
5540
|
+
end
|
|
5541
|
+
|
|
5542
|
+
output += inspect_errors(prefix: "│ ")
|
|
5543
|
+
|
|
5544
|
+
output += white("├── tag_opening: ")
|
|
5545
|
+
output += tag_opening ? tag_opening.tree_inspect : magenta("∅")
|
|
5546
|
+
output += "\n"
|
|
5547
|
+
output += white("├── content: ")
|
|
5548
|
+
output += content ? content.tree_inspect : magenta("∅")
|
|
5549
|
+
output += "\n"
|
|
5550
|
+
output += white("└── tag_closing: ")
|
|
5551
|
+
output += tag_closing ? tag_closing.tree_inspect : magenta("∅")
|
|
5552
|
+
output += "\n"
|
|
5553
|
+
output += "\n"
|
|
5554
|
+
|
|
5555
|
+
output.gsub(/^/, " " * indent)
|
|
5556
|
+
end
|
|
5557
|
+
end
|
|
5558
|
+
|
|
4322
5559
|
end
|
|
4323
5560
|
end
|