types.ml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. type expr =
  2. | Ident of string
  3. | Strlit of string
  4. | Uri of string
  5. | Concat of expr list
  6. | Number of float * string option
  7. | Function of string * expr
  8. | Hexcolor of string
  9. | Unary of string * expr
  10. | Nary of string * expr list
  11. type declaration = string * expr * bool
  12. type selector =
  13. | No_element
  14. | All_elements
  15. | Element of string
  16. | Id of selector * string
  17. | Class of selector * string
  18. | Pseudo of selector * string * selector list option
  19. | Attribute of selector * string * (string * expr) option
  20. | Combinator of selector * string * selector
  21. (*
  22. type selector =
  23. | Simple of string
  24. | Combinator of selector * string * selector
  25. *)
  26. type media_expr = string * expr option
  27. type media_query = string option * string option * media_expr list
  28. type descriptor_declaration = string * expr
  29. type keyframe_ruleset = expr * declaration list
  30. type supports_declaration = string * expr
  31. type condition =
  32. | Not of condition
  33. | And of condition list
  34. | Or of condition list
  35. | Decl of supports_declaration
  36. (*XXX: | Enclosed of expr*)
  37. type statement =
  38. | Ruleset of selector list * declaration list
  39. (* <selectors> { <declarations> } *)
  40. | Media of media_query list * statement list
  41. (* @media <queries> { <rulesets> } *)
  42. | Import of expr * media_query list
  43. (* @import <target> [<media>]; *)
  44. | Charset of string
  45. (* @charset "<charset>"; *)
  46. | Page of string option * declaration list
  47. (* @page [<pseudo_page>] { <declarations> } *)
  48. | Font_face of descriptor_declaration list
  49. (* @font-face { <declarations> } *)
  50. | Namespace of string option * expr
  51. (* @namespace [<prefix>] "<uri>"; *)
  52. | Keyframes of string * string * keyframe_ruleset list
  53. (* @[-<prefix>-]keyframes <id> { <rulesets> } *)
  54. | Supports of condition * statement list
  55. (* @supports <condition> { <rulesets> } *)
  56. type stylesheet = statement list
  57. type box =
  58. | Expr of expr
  59. | Declaration of declaration
  60. | Selector of selector
  61. | Media_expr of media_expr
  62. | Media_query of media_query
  63. | Descriptor_declaration of descriptor_declaration
  64. | Keyframe_ruleset of keyframe_ruleset
  65. | Supports_declaration of supports_declaration
  66. | Condition of condition
  67. | Statement of statement
  68. | Stylesheet of stylesheet
  69. | Clear
  70. type loc = string * int * int * int * int
  71. exception Syntax_error of string
  72. exception Loc_error of loc * string
  73. exception Box_error of box * string