mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-22 01:36:20 -06:00
The new Decimal API
This commit is contained in:
@@ -68,6 +68,7 @@ concrete CatNep of Cat = CommonX - [Adv] ** open ResNep, Prelude in {
|
||||
|
||||
Numeral = {s : CardOrd => Str ; n : Number} ;
|
||||
Digits = {s : CardOrd => Str ; n : Number } ;
|
||||
Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ;
|
||||
|
||||
---- Structural
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ concrete NounNep of Noun = CatNep ** open ResNep, Prelude in {
|
||||
PossPron p = {s = \\_,_ => p.ps } ;
|
||||
|
||||
NumDigits n = {s = n.s ! NCard ; n = n.n} ;
|
||||
NumDecimal n = {s = n.s ! NCard ; n = n.n} ;
|
||||
OrdDigits n = {s = n.s ! NOrd ; n = n.n} ;
|
||||
|
||||
NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete NumeralNep of Numeral = CatNep [Numeral,Digits] ** open ResNep, Prelude in {
|
||||
concrete NumeralNep of Numeral = CatNep [Numeral,Digits,Decimal] ** open ResNep, Prelude in {
|
||||
-- By Harald Hammarstroem
|
||||
-- Modification for Nepali by Dinesh Simkhada and Shafqat Virk - 2011
|
||||
flags coding=utf8 ;
|
||||
@@ -114,6 +114,16 @@ lin IDig d = { s = \\_ => d.s ; n = d.n} ;
|
||||
|
||||
lin IIDig d dg = { s = \\df => Prelude.glue d.s (dg.s ! df) ; n = Pl };
|
||||
|
||||
lin PosDecimal d = d ** {hasDot=False} ;
|
||||
lin NegDecimal d = { s = \\df => Prelude.glue "-" (d.s ! df) ; n = Pl ; hasDot=False } ;
|
||||
IFrac d i = {
|
||||
s=\\df=>d.s ! df ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s ;
|
||||
hasDot=True;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
oper ekhazar : Str = variants {"एक" ++ "हजार" ; "हजार"} ;
|
||||
oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "हजार"} ! sz ;
|
||||
oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "एक" ++ "सय" ; _ => s ++ "सय"} ! sz ;
|
||||
|
||||
@@ -114,6 +114,8 @@ lin IDig d = { s = \\_ => d.s ; n = d.n} ;
|
||||
|
||||
lin IIDig d dg = { s = \\df => Prelude.glue d.s (dg.s ! df) ; n = Pl };
|
||||
|
||||
lin PosDecimal d = d ** {hasDot=False} ;
|
||||
|
||||
oper ekhazar : Str = variants {"e:k" ++ "hjar" ; "hjar"} ;
|
||||
oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "hjar"} ! sz ;
|
||||
oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "e:k" ++ "sy" ; _ => s ++ "sy"} ! sz ;
|
||||
|
||||
Reference in New Issue
Block a user