mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-29 04:46:30 -06:00
The new Decimal API
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
concrete NumeralEst of Numeral = CatEst [Numeral,Digits] ** open Prelude, ParadigmsEst, MorphoEst in {
|
||||
concrete NumeralEst of Numeral = CatEst [Numeral,Digits,Decimal] ** open Prelude, ParadigmsEst, MorphoEst in {
|
||||
|
||||
-- Notice: possessive forms are not used. They get wrong, since every
|
||||
-- part is made to agree in them.
|
||||
@@ -146,6 +146,20 @@ oper
|
||||
D_8 = mkDig "8" ;
|
||||
D_9 = mkDig "9" ;
|
||||
|
||||
PosDecimal d = d ** {hasDot=False} ;
|
||||
NegDecimal d = {
|
||||
s = \\o => "-" ++ BIND ++ d.s ! o ;
|
||||
n = Pl ;
|
||||
hasDot=False
|
||||
} ;
|
||||
IFrac d i = {
|
||||
s = \\o => d.s ! NCard (NCase Sg Nom) ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s ! o ;
|
||||
n = Pl ;
|
||||
hasDot=False
|
||||
} ;
|
||||
|
||||
oper
|
||||
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o MorphoEst.Pl ;
|
||||
mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ;
|
||||
|
||||
Reference in New Issue
Block a user