diff options
Diffstat (limited to 'src/lib/repr/tengwar.ml')
-rw-r--r-- | src/lib/repr/tengwar.ml | 83 |
1 files changed, 32 insertions, 51 deletions
diff --git a/src/lib/repr/tengwar.ml b/src/lib/repr/tengwar.ml index 4fc224b..d291a8b 100644 --- a/src/lib/repr/tengwar.ml +++ b/src/lib/repr/tengwar.ml @@ -35,6 +35,8 @@ and t = let none = Nothing +let space s = Repr s + let a = Voyel { opened = true ; position = `Above @@ -106,53 +108,6 @@ and u = Voyel | Pos3 -> "J" | Pos4 -> "M" } -and a_nasal = Nasal - (fun f -> match f with - | Consonant c -> begin match c.primary, c.position, c.category with - | true, Pos1, _ -> "{#" - | true, _, _ -> "[E" - | false, _, I -> "5#" - | false, _, II -> "t#" - | false, _, III -> "g#" - end - | _ -> "5#" - - ) - -and o_nasal = Nasal - (fun f -> match f with - | Consonant c -> begin match c.primary, c.position, c.category with - | true, Pos1, _ -> "{^" - | true, _, _ -> "[Y" - | false, _, I -> "5^" - | false, _, II -> "t^" - | false, _, III -> "g^" - end - | _ -> "5^" - ) - -and i_nasal = Nasal - (fun f -> match f with - | Consonant c -> begin match c.primary, c.position, c.category with - | true, Pos1, _ -> "{$" - | true, _, _ -> "[T" - | false, _, I -> "5$" - | false, _, II -> "t$" - | false, _, III -> "g$" - end - | _ -> "5$") - -and y_nasal = Nasal - (fun f -> match f with - | Consonant c -> begin match c.primary, c.position, c.category with - | true, Pos1, _ -> "{Ø" - | true, _, _ -> "[Ù" - | false, _, I -> "5Ø" - | false, _, II -> "tØ" - | false, _, III -> "gØ" - end - | _ -> "5Ø") - and p = Consonant { position = Pos2 ; muted = Some "y" @@ -293,6 +248,32 @@ and semi_voyel_u = Consonant ; primary = false ; repr = "]" } +let nasal v = + let Voyel letter = v [@@warning "-8"]in + Nasal + ( fun f -> + let Consonant c = n [@@warning "-8"] in + let default = c.repr ^ letter.app c.position in + + match f with + | Consonant c -> begin match c.category with + | I -> default + | II -> + let Consonant c = m [@@warning "-8"] in + c.repr ^ letter.app c.position + | III -> + let Consonant c = gn [@@warning "-8"] in + c.repr ^ letter.app c.position + end + | _ -> default + ) + +let a_nasal = nasal a +and o_nasal = nasal o +and i_nasal = nasal i +and y_nasal = nasal y + + let diphtongue : t -> t -> t = fun t1 t2 -> match t1, t2 with @@ -328,7 +309,7 @@ let muted and portant = { position = Pos4 ; muted = None - ; category = III + ; category = I ; primary = false ; repr = "`" } @@ -349,7 +330,7 @@ let fold | Some Voyel ( {position = `Below; _ } as v) -> Buffer.add_string buff (v.app Pos1) | Some Nasal n -> - Buffer.add_string buff ("`" ^ (n (Consonant portant))) + Buffer.add_string buff (n (Consonant portant)) | Some Repr r -> Buffer.add_string buff r | Some Consonant c -> @@ -366,13 +347,13 @@ let fold Buffer.add_string buff ((v.app Pos1)^ c.repr); _fold None tl | Some Nasal n, Consonant c -> - Buffer.add_string buff (c.repr ^ (n hd)); + Buffer.add_string buff ((n hd) ^ c.repr); _fold None tl | Some Voyel v, _ -> Buffer.add_string buff ("`" ^ (v.app portant.position)); _fold (Some hd) tl | Some Nasal n, _ -> - Buffer.add_string buff ("`" ^ (n (Consonant portant))); + Buffer.add_string buff (n (Consonant portant)); _fold (Some hd) tl | Some Repr r, _ -> Buffer.add_string buff r; |