mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-17 23:30:14 -06:00
The new Decimal API
This commit is contained in:
@@ -75,6 +75,7 @@ concrete CatPol of Cat = CommonX - [CAdv] ** open ResPol, Prelude, (R = ParamX)
|
||||
a:Accom; n:Number };
|
||||
Ord = { s: AForm => Str };
|
||||
Digits = { s:Str; o:Str; a:Accom; n:Number };
|
||||
Decimal = { s:Str; o:Str; a:Accom; n:Number; hasDot : Bool };
|
||||
|
||||
|
||||
---- Structural
|
||||
|
||||
@@ -164,7 +164,7 @@ concrete NounPol of Noun = CatPol ** open ResPol, Prelude, PronounMorphoPol, Mor
|
||||
-- NumDigits : Digits -> Card ; -- 51
|
||||
NumDigits n = { s=\\_,_ => n.s; a=n.a; n=n.n };
|
||||
|
||||
NumFloat n1 n2 = { s=\\_,_ => n1.s ++ BIND ++ "." ++ BIND ++ n2.s; a=n1.a; n=Pl };
|
||||
NumDecimal n = { s=\\_,_ => n.s; a=n.a; n=n.n };
|
||||
|
||||
-- NumCard : Card -> Num ;
|
||||
NumCard c = c ** { hasCard = True };
|
||||
@@ -217,11 +217,4 @@ concrete NounPol of Noun = CatPol ** open ResPol, Prelude, PronounMorphoPol, Mor
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
QuantityFloatNP n1 n2 m = {
|
||||
nom,voc = preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ;
|
||||
dep = \\cc => preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ;
|
||||
gn = OthersPl;
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
-- Adam Slaski, 2009, 2010 <adam.slaski@gmail.com>
|
||||
|
||||
concrete NumeralPol of Numeral = CatPol [Numeral,Digits] ** open ResPol,Prelude, AdjectiveMorphoPol in {
|
||||
concrete NumeralPol of Numeral = CatPol [Numeral,Digits,Decimal] ** open ResPol,Prelude, AdjectiveMorphoPol in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
@@ -553,4 +553,24 @@ oper tysiac = table {
|
||||
D_8 = { s = "8"; o="8."; n=Pl; a=PiecA };
|
||||
D_9 = { s = "9"; o="9."; n=Pl; a=PiecA };
|
||||
|
||||
PosDecimal d = d ** {hasDot=False} ;
|
||||
NegDecimal d = {
|
||||
s = "-" ++ BIND ++ d.s;
|
||||
o = "-" ++ BIND ++ d.o;
|
||||
n=Pl;
|
||||
a=d.a;
|
||||
hasDot=False
|
||||
} ;
|
||||
IFrac d i = {
|
||||
s = d.s ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s;
|
||||
o = d.o ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.o;
|
||||
n=Pl;
|
||||
a=d.a;
|
||||
hasDot=True
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user