summaryrefslogtreecommitdiff
path: root/src/lib/repr/anatar.ml
blob: cca6162714c17f0203a430b7fe6fc5bfe2d791cc (plain)
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
module T = Tengwar

(** Glyph position for the diacritc *)
type position =
  | Pos1
  | Pos2
  | Pos3
  | Pos4
  | Lambe       (* Position for the Lambe (Theta inside) *)
  | Lower_1_2   (* Position for the Harma *)
  | Lower_3_1   (* Position for the Calma *)
  | Lower_4_2   (* Position for the Thule *)

type t = position T.t

let none = T.none

let space s = T.space s

let a' =
  { T.position = `Above
  ; T.app = function
      | Pos1 | Lower_1_2 | Lambe -> "#"
      | Pos2 -> "E"
      | Pos3 | Lower_3_1 -> "D"
      | Pos4 | Lower_4_2 -> "C"
  }
let a = T.Voyel a'

let app_e = function
  | Pos1 | Lower_1_2 | Lambe -> "$"
  | Pos2 -> "R"
  | Pos3 | Lower_3_1 -> "F"
  | Pos4 | Lower_4_2 -> "V"

and app_eu = function
  | Pos1 | Lower_1_2 | Lambe -> "Ü"
  | Pos2 -> "Ý"
  | Pos3 | Lower_3_1 -> "Þ"
  | Pos4 | Lower_4_2 -> "ß"

let e_opened =
  T.Voyel { position = `Above ; app = app_e }
and e_closed =
  T.Voyel { position = `Above ; app = app_e }

and schwa = T.Voyel
    { position = `Below
    ; app = function
        | Pos1 | Lower_3_1 -> "È"
        | Pos2 | Lower_1_2 | Lower_4_2 -> "É"
        | Pos3 -> "Ê"
        | Pos4 -> "Ë"
        | Lambe -> "L"
    }

and eu_opened = T.Voyel { position = `Above ; app = app_eu }
and eu_closed = T.Voyel { position = `Above ; app = app_eu }

and o' =
  { T.position = `Above
  ; T.app = function
      | Pos1 | Lower_1_2 | Lambe -> "^"
      | Pos2 -> "Y"
      | Pos3 | Lower_3_1 -> "H"
      | Pos4 | Lower_4_2 -> "N"
  }

let o = T.Voyel o'

and i' =
  { T.position = `Above
  ; T.app = function
      | Pos1 | Lower_1_2 | Lambe -> "%"
      | Pos2 -> "T"
      | Pos3 | Lower_3_1 -> "G"
      | Pos4 | Lower_4_2 -> "B"
  }

let i = T.Voyel i'

and y' =
  { T.position = `Above
  ; T.app = function
      | Pos1 | Lower_1_2 | Lambe -> "Ø"
      | Pos2 -> "Ù"
      | Pos3 | Lower_3_1 -> "Ú"
      | Pos4 | Lower_4_2 -> "Û"
  }

let y = T.Voyel y'

and u = T.Voyel
    { T.position = `Above
    ; T.app = function
        | Pos1 | Lower_1_2 | Lambe -> "&"
        | Pos2 -> "U"
        | Pos3 | Lower_3_1 -> "J"
        | Pos4 | Lower_4_2 -> "M"
    }

let portant =       T.portant       "`"             Pos4

and t =             T.t             "1" (Some "6")  Pos2
and d =             T.d             "2" (Some "6")  Pos1
and p =             T.p             "q" (Some "y")  Pos2
and b =             T.b             "w" (Some "y")  Pos1
and k =             T.k             "a" (Some "h")  Lower_3_1
and g =             T.g             "s" (Some "h")  Pos1
and f =             T.f             "e"             Pos3
and v =             T.v             "r"             Pos1
and ch =            T.ch            "d"             Lower_1_2
and j =             T.j             "f"             Pos1
and s =             T.s             "3" (Some "i")  Lower_4_2
and z =             T.z             "4"             Pos1
and m =             T.m             "t"             Pos1
and n =             T.n             "5"             Pos1
and gn =            T.gn            "b"             Pos1
and ng =            T.ng            "g"             Pos1
and r =             T.r             "7" (Some "u")  Pos2
and l =             T.l             "j"             Lambe

and semi_voyel_w =  T.semi_voyel_w  "."             Pos3
and semi_voyel_y =  T.semi_voyel_y  "l"             Pos1
and semi_voyel_u =  T.semi_voyel_u  "]"             Pos2

let a_nasal =       T.nasal m ng n a'
and o_nasal =       T.nasal m ng n o'
and i_nasal =       T.nasal m ng n i'
and y_nasal =       T.nasal m ng n y'

let muted
  : t -> t
  = fun t ->
    match t with
    | Consonant c ->
      begin match c.muted with
        | None -> t
        | Some s -> Consonant {c with repr = s ; position = Pos2}
      end
    | _ -> t

let diphtongue = T.diphtongue

let fold = T.fold ~portant