-
Notifications
You must be signed in to change notification settings - Fork 3
/
bestiary.rkt
33 lines (29 loc) · 1.3 KB
/
bestiary.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#lang racket
(provide
#%app #%datum #%top #%top-interaction
(rename-out [mb #%module-begin]))
(require (for-syntax frosthaven-manager/syntax/monsters)
frosthaven-manager/syntax/monsters
syntax/parse/define)
(define-syntax-parser mb
[(_ ({~datum import} imports:string ...)
({~datum info} infos ...)
({~datum ability} actions ...))
#:do [(define-values (imported-info-dbs imported-ability-dbs)
(imports->dbs (syntax->datum #'(imports ...))))]
#:fail-unless (check-monsters-have-abilities imported-info-dbs imported-ability-dbs
(syntax->datum #'(infos ...))
(syntax->datum #'(actions ...)))
(check-monsters-have-abilities-message imported-info-dbs imported-ability-dbs
(syntax->datum #'(infos ...))
(syntax->datum #'(actions ...)))
;;=>
(syntax/loc this-syntax
(#%module-begin
(make-dbs (provide info-db ability-db)
(import imports ...)
(info infos ...)
(ability actions ...))))])
(module reader frosthaven-manager/syntax/module-reader
frosthaven-manager/bestiary
[parse-bestiary from frosthaven-manager/parsers/monster])