mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-15 01:50:12 -06:00
The new Decimal API
This commit is contained in:
@@ -82,6 +82,7 @@ lincat
|
||||
Num = NumDet ;
|
||||
Card = NumDet ;
|
||||
Digits = {s : Str ; size: NumSize} ;
|
||||
Decimal = {s : Str ; size: NumSize; hasDot : Bool} ;
|
||||
|
||||
QS = {s : QForm => Str} ;
|
||||
QCl = {
|
||||
|
||||
@@ -87,7 +87,7 @@ lin
|
||||
-- : Digits -> Card ; -- 51
|
||||
NumDigits n = {s = \\_,_,_ => n.s ; size = n.size } ;
|
||||
|
||||
NumFloat n1 n2 = {s = \\_,_,_ => n1.s ++ BIND ++ "." ++ BIND ++ n2.s ; size = n1.size } ;
|
||||
NumDecimal n = {s = \\_,_,_ => n.s ; size = n.size } ;
|
||||
|
||||
-- : Quant -> Num -> Det ; -- these five
|
||||
DetQuant quant num = {
|
||||
@@ -247,10 +247,4 @@ lin
|
||||
a=Ag (gennum Masc (numSizeNumber n.size)) P3
|
||||
} ;
|
||||
|
||||
QuantityFloatNP n1 n2 m = {
|
||||
s = \\cas => preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ;
|
||||
pron=False ;
|
||||
a=Ag GPl P3
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete NumeralRus of Numeral = CatRus [Numeral,Digits] ** open ResRus, InflectionRus, Prelude in {
|
||||
concrete NumeralRus of Numeral = CatRus [Numeral,Digits,Decimal] ** open ResRus, InflectionRus, Prelude in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
@@ -431,6 +431,22 @@ lin
|
||||
D_7 = mk2Dig "7" Num5 ;
|
||||
D_8 = mk2Dig "8" Num5 ;
|
||||
D_9 = mk2Dig "9" Num5 ;
|
||||
|
||||
PosDecimal d = d ** {hasDot=False} ;
|
||||
NegDecimal d = {
|
||||
s = "-" ++ BIND ++ d.s ;
|
||||
n = Pl ;
|
||||
size = d.size ;
|
||||
hasDot=False
|
||||
} ;
|
||||
IFrac d i = {
|
||||
s=d.s ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s;
|
||||
n = Pl ;
|
||||
size = d.size ;
|
||||
hasDot=True
|
||||
} ;
|
||||
|
||||
oper
|
||||
mk3Dig : Str -> Str -> NumSize -> TDigit = \c,o,size -> mk4Dig c o Pl size ;
|
||||
|
||||
@@ -252,6 +252,8 @@ lin pot3plus n m =
|
||||
D_8 = mk2Dig "8" plg ;
|
||||
D_9 = mk2Dig "9" plg ;
|
||||
|
||||
PosDecimal d = d ** {hasDot=False} ;
|
||||
|
||||
oper
|
||||
mk3Dig : Str -> Str -> Size -> TDigit = \c,o,size -> mk4Dig c o Pl size ;
|
||||
mk2Dig : Str -> Size -> TDigit = \c,size -> mk3Dig c (c + "o") size ;
|
||||
|
||||
Reference in New Issue
Block a user