types.ml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 supports_declaration = string * expr
  20. type condition =
  21. | Not of condition
  22. | And of condition list
  23. | Or of condition list
  24. | Decl of supports_declaration
  25. (*XXX: | Enclosed of expr*)
  26. type statement =
  27. | Ruleset of selector list * declaration list
  28. (* <selectors> { <declarations> } *)
  29. | Media of media_query list * statement list
  30. (* @media <queries> { <rulesets> } *)
  31. | Import of expr * media_query list
  32. (* @import <target> [<media>]; *)
  33. | Charset of string
  34. (* @charset "<charset>"; *)
  35. | Page of string option * declaration list
  36. (* @page [<pseudo_page>] { <declarations> } *)
  37. | Font_face of descriptor_declaration list
  38. (* @font-face { <declarations> } *)
  39. | Namespace of string option * expr
  40. (* @namespace [<prefix>] "<uri>"; *)
  41. | Keyframes of string * keyframe_ruleset list
  42. (* @keyframes <id> { <rulesets> } *)
  43. | Supports of condition * statement list
  44. (* @supports <condition> { <rulesets> } *)
  45. type stylesheet = statement list
  46. type args = {
  47. mutable infiles : string list;
  48. mutable outfile : string option;
  49. mutable verbose : int;
  50. }
  51. type loc = string * int * int * int * int
  52. exception SyntaxError of string
  53. exception LocError of loc * string