types.ml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. | Simple of string
  14. | Combinator of selector * string * selector
  15. type media_expr = string * expr option
  16. type media_query = string option * string option * media_expr list
  17. type descriptor_declaration = string * expr
  18. type keyframe_ruleset = expr * declaration list
  19. type statement =
  20. | Ruleset of selector list * declaration list
  21. (* <selectors> { <declarations> } *)
  22. | Media of media_query list * statement list
  23. (* @media <queries> { <rulesets> } *)
  24. | Import of expr * media_query list
  25. (* @import <target> [<media>]; *)
  26. | Charset of string
  27. (* @charset "<charset>"; *)
  28. | Page of string option * declaration list
  29. (* @page [<pseudo_page>] { <declarations> } *)
  30. | Font_face of descriptor_declaration list
  31. (* @font-face { <declarations> } *)
  32. | Namespace of string option * expr
  33. (* @namespace [<prefix>] "<uri>"; *)
  34. | Keyframes of string * keyframe_ruleset list
  35. (* TODO: @document, @supports *)
  36. type stylesheet = statement list
  37. type args = {
  38. mutable infiles : string list;
  39. mutable outfile : string option;
  40. mutable verbose : int;
  41. }
  42. type loc = string * int * int * int * int
  43. exception SyntaxError of string
  44. exception LocError of loc * string