mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-24 02:31:10 -06:00
The new Decimal API
This commit is contained in:
@@ -66,6 +66,7 @@ concrete CatSlo 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} ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -95,6 +95,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 NumeralSlo of Numeral =
|
||||
|
||||
CatSlo [Numeral,Digits] **
|
||||
CatSlo [Numeral,Digits,Decimal] **
|
||||
|
||||
open
|
||||
ResSlo,
|
||||
@@ -122,4 +122,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 = 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
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user