mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-24 10:41:15 -06:00
The new Decimal API
This commit is contained in:
@@ -22,6 +22,7 @@ lincat
|
||||
Prep = ResAmh.Prep;
|
||||
Numeral = ResAmh.Numeral; --{s : CardOrd => Case => Str ; n : Number} ;
|
||||
Digits = ResAmh.Digits;--{s : CardOrd => Case => Str ; n : Number ; tail : DTail} ;
|
||||
Decimal = ResAmh.Decimal;
|
||||
Ord = ResAmh.Ord ; --{ s : Case => Str } ;
|
||||
Num = ResAmh.Num;--{s : Case => Str ; n : Number ; hasCard : Bool} ;
|
||||
Card = ResAmh.Card;--{s : Case => Str ; n : Number} ;
|
||||
|
||||
@@ -94,6 +94,7 @@ lin
|
||||
NumCard n = {s = \\s,c => n.s!Masc!Sg!s!c ; n = Pl; hasCard = True} ;
|
||||
|
||||
NumDigits n = {s = n.s ! NCard } ;
|
||||
NumDecimal n = {s = n.s ! NCard } ;
|
||||
|
||||
NumNumeral numeral = {s = numeral.s ! NCard} ;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
concrete NumeralAmh of Numeral = CatAmh [Numeral,Digits] ** open ResAmh,ParamX,Prelude in {
|
||||
concrete NumeralAmh of Numeral = CatAmh [Numeral,Digits,Decimal] ** open ResAmh,ParamX,Prelude in {
|
||||
flags coding = utf8;
|
||||
lincat
|
||||
|
||||
@@ -91,6 +91,18 @@ lin pot3plus n m = {
|
||||
D_8 = mkDig "8" ;
|
||||
D_9 = mk2Dig "9" "9ኛ";
|
||||
|
||||
PosDecimal d = d ** {hasDot=False} ;
|
||||
NegDecimal d = {
|
||||
s = \\o,g,n,s,c => "-" ++ BIND ++ d.s !o!g!n!s!c ;
|
||||
hasDot=False
|
||||
} ;
|
||||
IFrac d i = {
|
||||
s = \\o,g,n,s,c => d.s!NCard!Masc!Sg!Indef!c ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s ! o ! g ! n ! s ! c;
|
||||
hasDot=True
|
||||
} ;
|
||||
|
||||
oper
|
||||
commaIf : DTail -> Str = \t -> case t of {
|
||||
T3 => BIND++","++BIND ;
|
||||
|
||||
@@ -161,6 +161,10 @@ resource ResAmh = PatternsAmh** open Prelude,MorphoAmh,ParamX in {
|
||||
s : CardOrd=>Gender=>Number=>Species=>Case => Str ;
|
||||
tail : DTail
|
||||
} ;
|
||||
Decimal = {
|
||||
s : CardOrd=>Gender=>Number=>Species=>Case => Str ;
|
||||
hasDot : Bool
|
||||
} ;
|
||||
|
||||
Ord = {s : Gender=>Number=>Species=>Case => Str} ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user