mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-24 18:46:28 -06:00
The new Decimal API
This commit is contained in:
@@ -61,7 +61,8 @@ concrete CatPnb of Cat = CommonX - [Adv] ** open ResPnb, Prelude in {
|
||||
---- Numeral
|
||||
|
||||
Numeral = {s : CardOrd => Str ; n : Number} ;
|
||||
Digits = {s : CardOrd => Str ; n : Number } ;
|
||||
Digits = {s : CardOrd => Str ; n : Number} ;
|
||||
Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ;
|
||||
|
||||
---- Structural
|
||||
|
||||
|
||||
@@ -64,6 +64,8 @@ concrete NounPnb of Noun = CatPnb ** open ResPnb, Prelude in {
|
||||
NumDigits n = {s = n.s ! NCard ; n = n.n} ;
|
||||
OrdDigits n = {s = n.s ! NOrd; n = n.n} ;
|
||||
|
||||
NumDecimal n = {s = n.s ! NCard ; n = n.n} ;
|
||||
|
||||
NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ;
|
||||
OrdNumeral numeral = {s = numeral.s ! NOrd ; n = numeral.n} ;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete NumeralPnb of Numeral = CatPnb [Numeral,Digits] ** open ResPnb, Prelude in {
|
||||
concrete NumeralPnb of Numeral = CatPnb [Numeral,Digits,Decimal] ** open ResPnb, Prelude in {
|
||||
-- By Harald Hammarstroem
|
||||
-- Modification for Punjabi by Shafqat Virk
|
||||
flags coding=utf8 ;
|
||||
@@ -119,6 +119,19 @@ lin D_8 = { s = "۸" ; n = Pl};
|
||||
lin D_9 = { s = "۹" ; n = Pl};
|
||||
lin IDig d = { s = \\_ => d.s ; n = d.n} ;
|
||||
lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl };
|
||||
lin PosDecimal d = d ** {hasDot=False} ;
|
||||
NegDecimal d = {
|
||||
s = \\o => "-" ++ BIND ++ d.s ! o ;
|
||||
n = Pl ;
|
||||
hasDot=False
|
||||
} ;
|
||||
lin IFrac d i = {
|
||||
s = \\o => d.s ! o ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s;
|
||||
n = Pl ;
|
||||
hasDot=True
|
||||
} ;
|
||||
|
||||
oper ekhazar : Str = variants {"ہزار" ; "اك" ++ "ہزار"} ;
|
||||
oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "ہزار"} ! sz ;
|
||||
|
||||
Reference in New Issue
Block a user