Source file time_expr_ast.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
type bound =
  [ `Every
  | `Next
  ]

type second_expr = int

type minute_second_expr = {
  minute : int;
  second : int;
}

type hour_minute_second_expr = {
  hour : int;
  minute : int;
  second : int;
}

type second_range_expr = second_expr Range.range

type minute_second_range_expr = minute_second_expr Range.range

type hour_minute_second_range_expr = hour_minute_second_expr Range.range

type day_expr =
  | Weekday of Time.weekday
  | Month_day of int

type day_range_expr =
  | Weekday_range of Time.weekday_range
  | Month_day_range of Time.month_day_range

type month_expr = Time.month

type year_expr = int

type unbounded_time_point_expr =
  | Tpe_name of string
  | Tpe_unix_seconds of int64 list
  | Second of second_expr
  | Minute_second of minute_second_expr
  | Hour_minute_second of hour_minute_second_expr
  | Day_hour_minute_second of {
      day : day_expr;
      hour_minute_second : hour_minute_second_expr;
    }
  | Month_day_hour_minute_second of {
      month : month_expr;
      month_day : int;
      hour_minute_second : hour_minute_second_expr;
    }
  | Year_month_day_hour_minute_second of {
      year : year_expr;
      month : month_expr;
      month_day : int;
      hour_minute_second : hour_minute_second_expr;
    }

type time_point_expr = bound * unbounded_time_point_expr

type month_weekday_mode =
  | First_n of int
  | Last_n of int

type unbounded_time_slot_expr =
  | Tse_name of string
  | Explicit_time_slot of (unbounded_time_point_expr * unbounded_time_point_expr)
  | Month_days_and_hour_minute_second_ranges of {
      month_days : int Range.range list;
      hour_minute_second_ranges : hour_minute_second_range_expr list;
    }
  | Weekdays_and_hour_minute_second_ranges of {
      weekdays : Time.weekday Range.range list;
      hour_minute_second_ranges : hour_minute_second_range_expr list;
    }
  | Months_and_month_days_and_hour_minute_second_ranges of {
      months : month_expr Range.range list;
      month_days : int Range.range list;
      hour_minute_second_ranges : hour_minute_second_range_expr list;
    }
  | Months_and_weekdays_and_hour_minute_second_ranges of {
      months : month_expr Range.range list;
      weekdays : Time.weekday Range.range list;
      hour_minute_second_ranges : hour_minute_second_range_expr list;
    }
  | Months_and_weekday_and_hour_minute_second_ranges of {
      months : month_expr Range.range list;
      weekday : Time.weekday;
      hour_minute_second_ranges : hour_minute_second_range_expr list;
      month_weekday_mode : month_weekday_mode option;
    }
  | Years_and_months_and_month_days_and_hour_minute_second_ranges of {
      years : int Range.range list;
      months : month_expr Range.range list;
      month_days : int Range.range list;
      hour_minute_second_ranges : hour_minute_second_range_expr list;
    }

type time_slot_expr = bound * unbounded_time_slot_expr

type unary_op = Not

type binary_op =
  | Union
  | Inter

type t =
  | Time_point_expr of time_point_expr
  | Time_slot_expr of time_slot_expr
  | Time_pattern of Time_pattern.time_pattern
  | Time_unary_op of unary_op * t
  | Time_binary_op of binary_op * t * t
  | Time_round_robin_select of t list