summaryrefslogtreecommitdiff
path: root/src/lib/repr/anatar.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/repr/anatar.ml')
-rw-r--r--src/lib/repr/anatar.ml282
1 files changed, 282 insertions, 0 deletions
diff --git a/src/lib/repr/anatar.ml b/src/lib/repr/anatar.ml
new file mode 100644
index 0000000..1d00266
--- /dev/null
+++ b/src/lib/repr/anatar.ml
@@ -0,0 +1,282 @@
+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 portant =
+ { T.position = Pos4
+ ; T.muted = None
+ ; T.category = I
+ ; T.primary = false
+ ; T.repr = "`" }
+
+let none = T.Nothing
+
+let space s = T.Repr s
+
+let a' =
+ { T.opened = true
+ ; 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 { opened = true ; position = `Above ; app = app_e }
+and e_closed =
+ T.Voyel { opened = false; position = `Above ; app = app_e }
+
+and schwa = T.Voyel
+ { opened = true
+ ; position = `Below
+ ; app = function
+ | Pos1 | Lower_3_1 -> "È"
+ | Pos2 | Lower_1_2 | Lower_4_2 -> "É"
+ | Pos3 -> "Ê"
+ | Pos4 -> "Ë"
+ | Lambe -> "L"
+ }
+
+and eu_opened = T.Voyel { opened = true ; position = `Above ; app = app_eu }
+and eu_closed = T.Voyel { opened = false ; position = `Above ; app = app_eu }
+
+and o' =
+ { T.opened = true
+ ; 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.opened = true
+ ; 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.opened = true
+ ; 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.opened = true
+ ; T.position = `Above
+ ; T.app = function
+ | Pos1 | Lower_1_2 | Lambe -> "&"
+ | Pos2 -> "U"
+ | Pos3 | Lower_3_1 -> "J"
+ | Pos4 | Lower_4_2 -> "M"
+ }
+
+and p = T.Consonant
+ { position = Pos2
+ ; muted = Some "y"
+ ; category = II
+ ; primary = true
+ ; repr = "q" }
+
+and b = T.Consonant
+ { position = Pos1
+ ; muted = Some "y"
+ ; category = II
+ ; primary = true
+ ; repr = "w" }
+
+and t = T.Consonant
+ { position = Pos2
+ ; muted = Some "6"
+ ; category = I
+ ; primary = true
+ ; repr = "1" }
+
+and d = T.Consonant
+ { position = Pos1
+ ; muted = Some "6"
+ ; category = I
+ ; primary = true
+ ; repr = "2" }
+
+and k = T.Consonant
+ { position = Lower_3_1
+ ; muted = Some "h"
+ ; category = III
+ ; primary = true
+ ; repr = "a" }
+
+and g = T.Consonant
+ { position = Pos1
+ ; muted = Some "h"
+ ; category = III
+ ; primary = true
+ ; repr = "s" }
+
+and f = T.Consonant
+ { position = Pos3
+ ; muted = None
+ ; category = II
+ ; primary = true
+ ; repr = "e" }
+
+and v = T.Consonant
+ { position = Pos1
+ ; muted = None
+ ; category = II
+ ; primary = true
+ ; repr = "r" }
+
+and ch = T.Consonant
+ { position = Lower_1_2
+ ; muted = None
+ ; category = III
+ ; primary = true
+ ; repr = "d" }
+
+and j = T.Consonant
+ { position = Pos1
+ ; muted = None
+ ; category = III
+ ; primary = true
+ ; repr = "f" }
+
+and s = T.Consonant
+ { position = Lower_4_2
+ ; muted = Some "i"
+ ; category = I
+ ; primary = true
+ ; repr = "3" }
+
+and z = T.Consonant
+ { position = Pos1
+ ; muted = None
+ ; category = I
+ ; primary = true
+ ; repr = "4" }
+
+and m = T.Consonant
+ { position = Pos1
+ ; muted = None
+ ; category = II
+ ; primary = true
+ ; repr = "t" }
+
+and n = T.Consonant
+ { position = Pos1
+ ; muted = None
+ ; category = I
+ ; primary = true
+ ; repr = "5" }
+
+and gn = T.Consonant
+ { position = Pos1
+ ; muted = None
+ ; category = III
+ ; primary = false
+ ; repr = "b" }
+
+and ng = T.Consonant
+ { position = Pos1
+ ; muted = None
+ ; category = III
+ ; primary = true
+ ; repr = "g" }
+
+and r = T.Consonant
+ { position = Pos2
+ ; muted = Some "u"
+ ; category = I
+ ; primary = false
+ ; repr = "7" }
+
+and semi_voyel_w = T.Consonant
+ { position = Pos3
+ ; muted = None
+ ; category = II
+ ; primary = false
+ ; repr = "." }
+
+and semi_voyel_y = T.Consonant
+ { position = Pos1
+ ; muted = None
+ ; category = II
+ ; primary = false
+ ; repr = "l" }
+
+and semi_voyel_u = T.Consonant
+ { position = Pos2
+ ; muted = None
+ ; category = II
+ ; primary = false
+ ; repr = "]" }
+
+let l =
+ let default =
+ { T.position = Lambe
+ ; T.muted = None
+ ; T.category = II
+ ; T.primary = false
+ ; T.repr = "j" } in
+ T.Consonant default
+
+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