types.ml 1.3 KB

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