(*--------------------------------------------------------------------------- Copyright (c) 2025 Anil Madhavapeddy . All rights reserved. SPDX-License-Identifier: MIT ---------------------------------------------------------------------------*) (** Parse error codes as defined by the WHATWG HTML5 specification. @see *) type t = | Abrupt_closing_of_empty_comment | Abrupt_doctype_public_identifier | Abrupt_doctype_system_identifier | Absence_of_digits_in_numeric_character_reference | Cdata_in_html_content | Character_reference_outside_unicode_range | Control_character_in_input_stream | Control_character_reference | Duplicate_attribute | End_tag_with_attributes | End_tag_with_trailing_solidus | Eof_before_tag_name | Eof_in_cdata | Eof_in_comment | Eof_in_doctype | Eof_in_script_html_comment_like_text | Eof_in_tag | Incorrectly_closed_comment | Incorrectly_opened_comment | Invalid_character_sequence_after_doctype_name | Invalid_first_character_of_tag_name | Missing_attribute_value | Missing_doctype_name | Missing_doctype_public_identifier | Missing_doctype_system_identifier | Missing_end_tag_name | Missing_quote_before_doctype_public_identifier | Missing_quote_before_doctype_system_identifier | Missing_semicolon_after_character_reference | Missing_whitespace_after_doctype_public_keyword | Missing_whitespace_after_doctype_system_keyword | Missing_whitespace_before_doctype_name | Missing_whitespace_between_attributes | Missing_whitespace_between_doctype_public_and_system_identifiers | Nested_comment | Noncharacter_character_reference | Noncharacter_in_input_stream | Non_void_html_element_start_tag_with_trailing_solidus | Null_character_reference | Surrogate_character_reference | Surrogate_in_input_stream | Unexpected_character_after_doctype_system_identifier | Unexpected_character_in_attribute_name | Unexpected_character_in_unquoted_attribute_value | Unexpected_equals_sign_before_attribute_name | Unexpected_null_character | Unexpected_question_mark_instead_of_tag_name | Unexpected_solidus_in_tag | Unknown_named_character_reference | Tree_construction_error of string let to_string = function | Abrupt_closing_of_empty_comment -> "abrupt-closing-of-empty-comment" | Abrupt_doctype_public_identifier -> "abrupt-doctype-public-identifier" | Abrupt_doctype_system_identifier -> "abrupt-doctype-system-identifier" | Absence_of_digits_in_numeric_character_reference -> "absence-of-digits-in-numeric-character-reference" | Cdata_in_html_content -> "cdata-in-html-content" | Character_reference_outside_unicode_range -> "character-reference-outside-unicode-range" | Control_character_in_input_stream -> "control-character-in-input-stream" | Control_character_reference -> "control-character-reference" | Duplicate_attribute -> "duplicate-attribute" | End_tag_with_attributes -> "end-tag-with-attributes" | End_tag_with_trailing_solidus -> "end-tag-with-trailing-solidus" | Eof_before_tag_name -> "eof-before-tag-name" | Eof_in_cdata -> "eof-in-cdata" | Eof_in_comment -> "eof-in-comment" | Eof_in_doctype -> "eof-in-doctype" | Eof_in_script_html_comment_like_text -> "eof-in-script-html-comment-like-text" | Eof_in_tag -> "eof-in-tag" | Incorrectly_closed_comment -> "incorrectly-closed-comment" | Incorrectly_opened_comment -> "incorrectly-opened-comment" | Invalid_character_sequence_after_doctype_name -> "invalid-character-sequence-after-doctype-name" | Invalid_first_character_of_tag_name -> "invalid-first-character-of-tag-name" | Missing_attribute_value -> "missing-attribute-value" | Missing_doctype_name -> "missing-doctype-name" | Missing_doctype_public_identifier -> "missing-doctype-public-identifier" | Missing_doctype_system_identifier -> "missing-doctype-system-identifier" | Missing_end_tag_name -> "missing-end-tag-name" | Missing_quote_before_doctype_public_identifier -> "missing-quote-before-doctype-public-identifier" | Missing_quote_before_doctype_system_identifier -> "missing-quote-before-doctype-system-identifier" | Missing_semicolon_after_character_reference -> "missing-semicolon-after-character-reference" | Missing_whitespace_after_doctype_public_keyword -> "missing-whitespace-after-doctype-public-keyword" | Missing_whitespace_after_doctype_system_keyword -> "missing-whitespace-after-doctype-system-keyword" | Missing_whitespace_before_doctype_name -> "missing-whitespace-before-doctype-name" | Missing_whitespace_between_attributes -> "missing-whitespace-between-attributes" | Missing_whitespace_between_doctype_public_and_system_identifiers -> "missing-whitespace-between-doctype-public-and-system-identifiers" | Nested_comment -> "nested-comment" | Noncharacter_character_reference -> "noncharacter-character-reference" | Noncharacter_in_input_stream -> "noncharacter-in-input-stream" | Non_void_html_element_start_tag_with_trailing_solidus -> "non-void-html-element-start-tag-with-trailing-solidus" | Null_character_reference -> "null-character-reference" | Surrogate_character_reference -> "surrogate-character-reference" | Surrogate_in_input_stream -> "surrogate-in-input-stream" | Unexpected_character_after_doctype_system_identifier -> "unexpected-character-after-doctype-system-identifier" | Unexpected_character_in_attribute_name -> "unexpected-character-in-attribute-name" | Unexpected_character_in_unquoted_attribute_value -> "unexpected-character-in-unquoted-attribute-value" | Unexpected_equals_sign_before_attribute_name -> "unexpected-equals-sign-before-attribute-name" | Unexpected_null_character -> "unexpected-null-character" | Unexpected_question_mark_instead_of_tag_name -> "unexpected-question-mark-instead-of-tag-name" | Unexpected_solidus_in_tag -> "unexpected-solidus-in-tag" | Unknown_named_character_reference -> "unknown-named-character-reference" | Tree_construction_error s -> s let of_string = function | "abrupt-closing-of-empty-comment" -> Abrupt_closing_of_empty_comment | "abrupt-doctype-public-identifier" -> Abrupt_doctype_public_identifier | "abrupt-doctype-system-identifier" -> Abrupt_doctype_system_identifier | "absence-of-digits-in-numeric-character-reference" -> Absence_of_digits_in_numeric_character_reference | "cdata-in-html-content" -> Cdata_in_html_content | "character-reference-outside-unicode-range" -> Character_reference_outside_unicode_range | "control-character-in-input-stream" -> Control_character_in_input_stream | "control-character-reference" -> Control_character_reference | "duplicate-attribute" -> Duplicate_attribute | "end-tag-with-attributes" -> End_tag_with_attributes | "end-tag-with-trailing-solidus" -> End_tag_with_trailing_solidus | "eof-before-tag-name" -> Eof_before_tag_name | "eof-in-cdata" -> Eof_in_cdata | "eof-in-comment" -> Eof_in_comment | "eof-in-doctype" -> Eof_in_doctype | "eof-in-script-html-comment-like-text" -> Eof_in_script_html_comment_like_text | "eof-in-tag" -> Eof_in_tag | "incorrectly-closed-comment" -> Incorrectly_closed_comment | "incorrectly-opened-comment" -> Incorrectly_opened_comment | "invalid-character-sequence-after-doctype-name" -> Invalid_character_sequence_after_doctype_name | "invalid-first-character-of-tag-name" -> Invalid_first_character_of_tag_name | "missing-attribute-value" -> Missing_attribute_value | "missing-doctype-name" -> Missing_doctype_name | "missing-doctype-public-identifier" -> Missing_doctype_public_identifier | "missing-doctype-system-identifier" -> Missing_doctype_system_identifier | "missing-end-tag-name" -> Missing_end_tag_name | "missing-quote-before-doctype-public-identifier" -> Missing_quote_before_doctype_public_identifier | "missing-quote-before-doctype-system-identifier" -> Missing_quote_before_doctype_system_identifier | "missing-semicolon-after-character-reference" -> Missing_semicolon_after_character_reference | "missing-whitespace-after-doctype-public-keyword" -> Missing_whitespace_after_doctype_public_keyword | "missing-whitespace-after-doctype-system-keyword" -> Missing_whitespace_after_doctype_system_keyword | "missing-whitespace-before-doctype-name" -> Missing_whitespace_before_doctype_name | "missing-whitespace-between-attributes" -> Missing_whitespace_between_attributes | "missing-whitespace-between-doctype-public-and-system-identifiers" -> Missing_whitespace_between_doctype_public_and_system_identifiers | "nested-comment" -> Nested_comment | "noncharacter-character-reference" -> Noncharacter_character_reference | "noncharacter-in-input-stream" -> Noncharacter_in_input_stream | "non-void-html-element-start-tag-with-trailing-solidus" -> Non_void_html_element_start_tag_with_trailing_solidus | "null-character-reference" -> Null_character_reference | "surrogate-character-reference" -> Surrogate_character_reference | "surrogate-in-input-stream" -> Surrogate_in_input_stream | "unexpected-character-after-doctype-system-identifier" -> Unexpected_character_after_doctype_system_identifier | "unexpected-character-in-attribute-name" -> Unexpected_character_in_attribute_name | "unexpected-character-in-unquoted-attribute-value" -> Unexpected_character_in_unquoted_attribute_value | "unexpected-equals-sign-before-attribute-name" -> Unexpected_equals_sign_before_attribute_name | "unexpected-null-character" -> Unexpected_null_character | "unexpected-question-mark-instead-of-tag-name" -> Unexpected_question_mark_instead_of_tag_name | "unexpected-solidus-in-tag" -> Unexpected_solidus_in_tag | "unknown-named-character-reference" -> Unknown_named_character_reference | s -> Tree_construction_error s let of_string_opt s = Some (of_string s) let is_whatwg_standard = function | Tree_construction_error _ -> false | _ -> true let pp fmt t = Format.pp_print_string fmt (to_string t)