types.ml 1.1 KB

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