mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-27 03:46:29 -06:00
The new Decimal API
This commit is contained in:
@@ -54,6 +54,7 @@ flags coding = utf8 ;
|
||||
DAP = Det ;
|
||||
Numeral = {s : Str ; n : Number ; tenPlus : Bool} ;
|
||||
Digits = {s : Str ; n : Number ; tenPlus : Bool ; tail : DTail} ;
|
||||
Decimal = {s : Str ; n : Number ; tenPlus : Bool ; hasDot : Bool} ;
|
||||
Conj = Conjunction ; -- {s : Str ; null : Str ; type : ConjType} ;
|
||||
Subj = Subjunction ; -- {s : Str ; type : SubjType} ;
|
||||
Prep = Preposition ; -- {s : Str ; null : Str} ;
|
||||
|
||||
@@ -134,6 +134,7 @@ flags coding = utf8 ;
|
||||
NumCard card = card ** {inclCard = True} ;
|
||||
|
||||
NumDigits num = num ** {postpositive = []} ;
|
||||
NumDecimal num = num ** {postpositive = []} ;
|
||||
|
||||
NumNumeral num = num ** {postpositive = []} ;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete NumeralJpn of Numeral = CatJpn [Numeral,Digits] ** open ResJpn, ParadigmsJpn, Prelude in {
|
||||
concrete NumeralJpn of Numeral = CatJpn [Numeral,Digits,Decimal] ** open ResJpn, ParadigmsJpn, Prelude in {
|
||||
|
||||
flags coding = utf8 ;
|
||||
|
||||
@@ -202,7 +202,23 @@ flags coding = utf8 ;
|
||||
D_7 = {s = "7" ; n = Pl ; is0 = False} ;
|
||||
D_8 = {s = "8" ; n = Pl ; is0 = False} ;
|
||||
D_9 = {s = "9" ; n = Pl ; is0 = False} ;
|
||||
|
||||
|
||||
PosDecimal d = d ** {hasDot=False} ;
|
||||
NegDecimal d = {
|
||||
s = "-" ++ BIND ++ d.s ;
|
||||
n = Pl ;
|
||||
tenPlus = d.tenPlus ;
|
||||
hasDot=False
|
||||
} ;
|
||||
IFrac d i = {
|
||||
s = d.s ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s;
|
||||
n = Pl ;
|
||||
tenPlus = d.tenPlus ;
|
||||
hasDot=True
|
||||
} ;
|
||||
|
||||
oper
|
||||
commaIf : DTail -> Str = \t -> case t of {
|
||||
T3 => "," ;
|
||||
|
||||
Reference in New Issue
Block a user