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:
@@ -66,6 +66,7 @@ concrete CatCze of Cat =
|
||||
|
||||
lincat Numeral = Determiner ; ---- TODO: should contain Ord as well
|
||||
lincat Digits = {s:Str ; size : NumSize} ;
|
||||
lincat Decimal = {s:Str ; size : NumSize ; hasDot : Bool} ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ lin
|
||||
|
||||
NumCard c = c ;
|
||||
NumDigits ds = ds ** {s = \\_,_ => ds.s} ;
|
||||
NumDecimal ds = ds ** {s = \\_,_ => ds.s} ;
|
||||
NumNumeral nu = nu ;
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
concrete NumeralCze of Numeral =
|
||||
|
||||
CatCze [Numeral,Digits] **
|
||||
CatCze [Numeral,Digits,Decimal] **
|
||||
|
||||
open
|
||||
ResCze,
|
||||
@@ -117,4 +117,18 @@ oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ;
|
||||
D_8 = { s = "8" ; size = Num5} ;
|
||||
D_9 = { s = "9" ; size = Num5} ;
|
||||
|
||||
PosDecimal d = d ** {hasDot=False} ;
|
||||
NegDecimal d = {
|
||||
s = "-" ++ Predef.BIND ++ d.s ;
|
||||
size = Num5 ;
|
||||
hasDot=False
|
||||
} ;
|
||||
IFrac d i = {
|
||||
s = d.s ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s ;
|
||||
size = Num5 ;
|
||||
hasDot=True
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user