OCaml HTML5 parser/serialiser based on Python's JustHTML
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 74 lines 3.2 kB view raw
1(*--------------------------------------------------------------------------- 2 Copyright (c) 2025 Anil Madhavapeddy <anil@recoil.org>. All rights reserved. 3 SPDX-License-Identifier: MIT 4 ---------------------------------------------------------------------------*) 5 6(** CSS selector parse error codes. 7 8 These represent all possible errors that can occur when parsing 9 CSS selectors. 10*) 11 12type t = 13 | Empty_selector 14 | Unterminated_string 15 | Unterminated_escape 16 | Expected_identifier_after_hash 17 | Expected_identifier_after_dot 18 | Expected_attribute_name 19 | Expected_closing_bracket 20 | Expected_equals_after_operator of char 21 | Unexpected_character_in_attribute_selector 22 | Expected_pseudo_class_name 23 | Expected_closing_paren 24 | Unexpected_character of char 25 | Expected_attribute_value 26 | Expected_closing_bracket_or_operator 27 | Expected_selector_after_combinator 28 | Unexpected_token 29 | Expected_end_of_selector 30 31let to_string = function 32 | Empty_selector -> "empty-selector" 33 | Unterminated_string -> "unterminated-string" 34 | Unterminated_escape -> "unterminated-escape" 35 | Expected_identifier_after_hash -> "expected-identifier-after-hash" 36 | Expected_identifier_after_dot -> "expected-identifier-after-dot" 37 | Expected_attribute_name -> "expected-attribute-name" 38 | Expected_closing_bracket -> "expected-closing-bracket" 39 | Expected_equals_after_operator c -> 40 Printf.sprintf "expected-equals-after-%c" c 41 | Unexpected_character_in_attribute_selector -> 42 "unexpected-character-in-attribute-selector" 43 | Expected_pseudo_class_name -> "expected-pseudo-class-name" 44 | Expected_closing_paren -> "expected-closing-paren" 45 | Unexpected_character c -> Printf.sprintf "unexpected-character-%c" c 46 | Expected_attribute_value -> "expected-attribute-value" 47 | Expected_closing_bracket_or_operator -> 48 "expected-closing-bracket-or-operator" 49 | Expected_selector_after_combinator -> "expected-selector-after-combinator" 50 | Unexpected_token -> "unexpected-token" 51 | Expected_end_of_selector -> "expected-end-of-selector" 52 53let to_human_string = function 54 | Empty_selector -> "Empty selector" 55 | Unterminated_string -> "Unterminated string" 56 | Unterminated_escape -> "Unterminated escape" 57 | Expected_identifier_after_hash -> "Expected identifier after #" 58 | Expected_identifier_after_dot -> "Expected identifier after ." 59 | Expected_attribute_name -> "Expected attribute name" 60 | Expected_closing_bracket -> "Expected ]" 61 | Expected_equals_after_operator c -> 62 Printf.sprintf "Expected = after %c" c 63 | Unexpected_character_in_attribute_selector -> 64 "Unexpected character in attribute selector" 65 | Expected_pseudo_class_name -> "Expected pseudo-class name" 66 | Expected_closing_paren -> "Expected )" 67 | Unexpected_character c -> Printf.sprintf "Unexpected character: %c" c 68 | Expected_attribute_value -> "Expected attribute value" 69 | Expected_closing_bracket_or_operator -> "Expected ] or attribute operator" 70 | Expected_selector_after_combinator -> "Expected selector after combinator" 71 | Unexpected_token -> "Unexpected token" 72 | Expected_end_of_selector -> "Expected end of selector" 73 74let pp fmt t = Format.pp_print_string fmt (to_string t)