-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#lang racket | ||
|
||
(provide #%app #%datum #%top #%top-interaction | ||
(rename-out [mb #%module-begin]) | ||
text | ||
newline) | ||
|
||
(require syntax/parse/define | ||
frosthaven-manager/gui/rich-text-display | ||
pict) | ||
|
||
(define-syntax-parser mb | ||
[(_ e ...) | ||
#'(#%module-begin | ||
(provide expr) | ||
(define expr | ||
(list e ...)))]) | ||
|
||
(module reader syntax/module-reader | ||
frosthaven-manager/syntax-lang | ||
#:read read | ||
#:read-syntax read-syntax | ||
|
||
(require racket/match | ||
syntax/strip-context | ||
frosthaven-manager/gui/rich-text-display | ||
pict) | ||
|
||
(define i 2) | ||
(define (read-syntax _src _in) | ||
(begin0 | ||
(match i | ||
[0 eof] | ||
[1 (strip-context #'newline)] | ||
[2 (strip-context #'(text "AoE spec"))]) | ||
(set! i (sub1 i)))) | ||
|
||
(define (read in) | ||
(syntax->datum (read-syntax (object-name in) in)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#lang frosthaven-manager/syntax-lang | ||
;; vim: ft=racket | ||
;; | ||
;; proof that I can embed model values and picts into the "read" syntax of a | ||
;; module, but only if they are returned as (stripped) syntax expressions that | ||
;; would evaluate to the model value or pict; then, they have to be interpreted | ||
;; in some way (usually by providing bindings or by using them in a macro that | ||
;; does something intelligent) | ||
;; | ||
;; for example, (newline? (second expr)) and (show-pict (first expr)) both work | ||
;; as expected |