aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/licentia/input.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-06-14 18:33:54 -0400
committerEduardo Julian2021-06-14 18:33:54 -0400
commit519c0c0c71cdf7ce3dfc64b9781ab826760b3d94 (patch)
tree75fa0672afceff129e5e75afb7a5fed197ce1773 /stdlib/source/program/licentia/input.lux
parentaf3e6e2cb011dc2ad9204440990731a2f272716d (diff)
Extracted Licentia out of the standard library.
Diffstat (limited to '')
-rw-r--r--licentia/source/program/licentia/input.lux (renamed from stdlib/source/program/licentia/input.lux)29
1 files changed, 15 insertions, 14 deletions
diff --git a/stdlib/source/program/licentia/input.lux b/licentia/source/program/licentia/input.lux
index 5ec07e32b..52205762d 100644
--- a/stdlib/source/program/licentia/input.lux
+++ b/licentia/source/program/licentia/input.lux
@@ -8,7 +8,8 @@
["<.>" json (#+ Parser)]]]
[data
[text
- ["%" format (#+ format)]]
+ ["%" format (#+ format)]]]
+ [math
[number
["n" nat]
["i" int]
@@ -20,7 +21,7 @@
Distribution
Commercial
Extension
- Entity Black-List
+ Entity Black_List
URL Attribution
Addendum
License)
@@ -34,11 +35,11 @@
(<json>.field "name" <json>.string)
(<json>.field "version" <json>.string))))
-(exception: #export (cannot-use-fractional-amount {amount Frac})
+(exception: #export (cannot_use_fractional_amount {amount Frac})
(exception.report
["Amount" (%.frac amount)]))
-(exception: #export (cannot-use-negative-amount {amount Int})
+(exception: #export (cannot_use_negative_amount {amount Int})
(exception.report
["Amount" (%.int amount)]))
@@ -47,14 +48,14 @@
(do <>.monad
[amountF <json>.number
#let [amountI (f.int amountF)]
- _ (<>.assert (exception.construct cannot-use-fractional-amount amountF)
+ _ (<>.assert (exception.construct ..cannot_use_fractional_amount [amountF])
(f.= amountF
(i.frac amountI)))
- _ (<>.assert (exception.construct cannot-use-negative-amount amountI)
+ _ (<>.assert (exception.construct ..cannot_use_negative_amount [amountI])
(i.> +0 amountI))]
(wrap (.nat amountI))))
-(exception: #export (invalid-period {period (Period Nat)})
+(exception: #export (invalid_period {period (Period Nat)})
(exception.report
["Start" (%.nat (get@ #time.start period))]
["End" (%.nat (get@ #time.end period))]))
@@ -67,11 +68,11 @@
end (<json>.field "end" ..amount)
#let [period {#time.start start
#time.end end}]
- _ (<>.assert (exception.construct invalid-period period)
+ _ (<>.assert (exception.construct ..invalid_period [period])
(n.<= end start))]
(wrap period))))
-(def: copyright-holder
+(def: copyright_holder
(Parser copyright.Holder)
(<json>.object
($_ <>.and
@@ -121,8 +122,8 @@
(Parser Entity)
<json>.string)
-(def: black-list
- (Parser Black-List)
+(def: black_list
+ (Parser Black_List)
(<json>.object
($_ <>.and
(<json>.field "justification" (<json>.nullable <json>.string))
@@ -152,15 +153,15 @@
(Parser License)
(<json>.object
($_ <>.and
- (<json>.field "copyright-holders" (<json>.array (<>.many ..copyright-holder)))
+ (<json>.field "copyright-holders" (<json>.array (<>.many ..copyright_holder)))
(<json>.field "identification" (<json>.nullable ..identification))
(<json>.field "termination" ..termination)
(<json>.field "liability" ..liability)
(<json>.field "distribution" ..distribution)
(<json>.field "commercial" ..commercial)
(<json>.field "extension" ..extension)
- (<json>.field "black-lists" (<json>.array (<>.some ..black-list)))
+ (<json>.field "black-lists" (<json>.array (<>.some ..black_list)))
(<json>.field "attribution" (<json>.nullable ..attribution))
- (<>.default {#//.commons-clause? false}
+ (<>.default {#//.commons_clause? false}
(<json>.field "addendum" ..addendum))
)))