types.ml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 condition =
  20. | Not of condition
  21. | And of condition list
  22. | Or of condition list
  23. | Decl of declaration
  24. (*XXX: | Enclosed of expr*)
  25. type statement =
  26. | Ruleset of selector list * declaration list
  27. (* <selectors> { <declarations> } *)
  28. | Media of media_query list * statement list
  29. (* @media <queries> { <rulesets> } *)
  30. | Import of expr * media_query list
  31. (* @import <target> [<media>]; *)
  32. | Charset of string
  33. (* @charset "<charset>"; *)
  34. | Page of string option * declaration list
  35. (* @page [<pseudo_page>] { <declarations> } *)
  36. | Font_face of descriptor_declaration list
  37. (* @font-face { <declarations> } *)
  38. | Namespace of string option * expr
  39. (* @namespace [<prefix>] "<uri>"; *)
  40. | Keyframes of string * keyframe_ruleset list
  41. (* @keyframes <id> { <rulesets> } *)
  42. | Supports of condition * statement list
  43. (* @supports <condition> { <rulesets> } *)
  44. (* TODO: @document *)
  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