aboutsummaryrefslogtreecommitdiff
path: root/lib/rites/rite_ef/vocab_ef.ml
blob: e5726e852007a235ec2fc854a50504bfa877967a (plain) (blame)
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
(* EF (1962) season and rank vocabulary. Both are closed variants private to
   this rite: OF code cannot name them, and this rite cannot name OF's. *)

(* Seasons per RG 71-77, in canonical liturgical-year order. *)
type season =
  | Advent  (** RG 71 *)
  | Christmastide  (** RG 72-73: to 13 January inclusive *)
  | Time_after_epiphany  (** RG 77: from 14 January *)
  | Septuagesima  (** RG 73 *)
  | Lent  (** RG 74 *)
  | Passiontide  (** RG 75 *)
  | Paschaltide  (** RG 76 *)
  | Time_after_pentecost  (** RG 77 *)
[@@deriving sexp]

(* RG 8: "Dies liturgici sunt primae, secundae, tertiae aut quartae classis." *)
type rank = Class1 | Class2 | Class3 | Class4 [@@deriving sexp]

let seasons =
  [ Advent; Christmastide; Time_after_epiphany; Septuagesima; Lent; Passiontide;
    Paschaltide; Time_after_pentecost ]

let ranks = [ Class1; Class2; Class3; Class4 ]

let season_to_string = function
  | Advent -> "advent"
  | Christmastide -> "christmastide"
  | Time_after_epiphany -> "time-after-epiphany"
  | Septuagesima -> "septuagesima"
  | Lent -> "lent"
  | Passiontide -> "passiontide"
  | Paschaltide -> "paschaltide"
  | Time_after_pentecost -> "time-after-pentecost"

let season_of_string = function
  | "advent" -> Some Advent
  | "christmastide" -> Some Christmastide
  | "time-after-epiphany" -> Some Time_after_epiphany
  | "septuagesima" -> Some Septuagesima
  | "lent" -> Some Lent
  | "passiontide" -> Some Passiontide
  | "paschaltide" -> Some Paschaltide
  | "time-after-pentecost" -> Some Time_after_pentecost
  | _ -> None

(* Deliberately NOT season_to_string: slugs are lectionary keys adopted verbatim
   from lectio, which names these two seasons differently. Changing these words
   would silently break the Plan 4 lectionary bootstrap (CORRECTED, final fix
   wave, item 7 -- see Slug.ml's own corrected comment for the Plan 3/4
   distinction: the sanctoral bootstrap these slugs already serve is Plan 3
   and shipped; the lectionary/reading-citations bootstrap is Plan 4). *)
let season_slug_word = function
  | Christmastide -> "christmas"
  | Paschaltide -> "easter"
  | s -> season_to_string s

let rank_to_string = function
  | Class1 -> "class-1" | Class2 -> "class-2" | Class3 -> "class-3" | Class4 -> "class-4"

let rank_of_string = function
  | "class-1" -> Some Class1 | "class-2" -> Some Class2
  | "class-3" -> Some Class3 | "class-4" -> Some Class4
  | _ -> None

let vocab : (season, rank) Colitur_kernel.Vocab.t =
  { seasons; season_to_string; season_of_string; ranks; rank_to_string; rank_of_string }