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:
@@ -68,5 +68,6 @@ concrete CatHrv of Cat =
|
||||
|
||||
lincat Numeral = {s : AdjForms ; size : NumSize} ;
|
||||
lincat Digits = {s : Str ; size : NumSize} ;
|
||||
lincat Decimal = {s : Str ; size : NumSize ; hasDot : Bool} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ lin
|
||||
|
||||
NumCard c = c ;
|
||||
NumDigits ds = ds ** {s = \\_,_ => ds.s} ;
|
||||
NumDecimal dec = dec ** {s = \\_,_ => dec.s} ;
|
||||
NumNumeral nu = {
|
||||
s = \\g,c => (adjFormsAdjective nu.s).s ! g ! Sg ! c ; ---- TODO Sg?
|
||||
size = nu.size
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
concrete NumeralHrv of Numeral =
|
||||
|
||||
CatHrv [Numeral, Digits] **
|
||||
CatHrv [Numeral, Digits, Decimal] **
|
||||
|
||||
open
|
||||
ResHrv,
|
||||
@@ -125,6 +125,20 @@ oper mkThousand : Str -> NumSize -> Str = \attr,size ->
|
||||
|
||||
IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; size = dd.size} ;
|
||||
|
||||
PosDecimal d = d ** {hasDot=False} ;
|
||||
NegDecimal d = {
|
||||
s = "-" ++ Predef.BIND ++ d.s ;
|
||||
size = d.size ;
|
||||
hasDot=False
|
||||
} ;
|
||||
IFrac d i = {
|
||||
s = d.s ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s;
|
||||
size = d.size ;
|
||||
hasDot=True
|
||||
} ;
|
||||
|
||||
D_0 = { s = "0" ; size = NS_1} ; ---- ??
|
||||
D_1 = { s = "1" ; size = NS_1} ;
|
||||
D_2 = { s = "2" ; size = NS_2_4} ;
|
||||
|
||||
Reference in New Issue
Block a user