The new Decimal API

This commit is contained in:
Krasimir Angelov
2023-08-21 20:14:26 +02:00
parent 58da8deca8
commit fb398c603e
147 changed files with 918 additions and 188 deletions
+1
View File
@@ -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} ;
+1
View File
@@ -134,6 +134,7 @@ flags coding = utf8 ;
NumCard card = card ** {inclCard = True} ;
NumDigits num = num ** {postpositive = []} ;
NumDecimal num = num ** {postpositive = []} ;
NumNumeral num = num ** {postpositive = []} ;
+18 -2
View File
@@ -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 => "," ;