relaxed the restrictions on planet requires in the teaching languages to allow the new forms

This commit is contained in:
Robby Findler 2011-10-07 07:47:40 -05:00
parent 57deb86f7b
commit a40f288e48
2 changed files with 35 additions and 23 deletions

View File

@ -1550,6 +1550,14 @@
'stepper-black-box-expr 'stepper-black-box-expr
stx)]))] stx)]))]
[(_ (planet . rest)) [(_ (planet . rest))
(let ([go
(λ ()
;; use the original `planet', so that it binds correctly:
(syntax-case stx ()
[(_ ms) (stepper-syntax-property
#'(require ms)
'stepper-black-box-expr
stx)]))])
(syntax-case stx (planet) (syntax-case stx (planet)
[(_ (planet s1 (s2 s3 n1 n2))) [(_ (planet s1 (s2 s3 n1 n2)))
(and (string? (syntax-e #'s1)) (and (string? (syntax-e #'s1))
@ -1561,18 +1569,20 @@
(check-string-form stx #'s1) (check-string-form stx #'s1)
(check-string-form stx #'s2) (check-string-form stx #'s2)
(check-string-form stx #'s3) (check-string-form stx #'s3)
;; use the original `planet', so that it binds correctly: (go))]
(syntax-case stx () [(_ (planet a))
[(_ ms) (stepper-syntax-property (or (string? (syntax-e #'a))
#'(require ms) (symbol? (syntax-e #'a)))
'stepper-black-box-expr (go)]
stx)]))]
[_else [_else
(teach-syntax-error (teach-syntax-error
'require 'require
stx stx
#f #f
"not a valid planet path; should be: (require (planet STRING (STRING STRING NUMBER NUMBER)))")])] (string-append
"not a valid planet path; should be:"
" (require (planet STRING (STRING STRING NUMBER NUMBER)))"
" (require (planet STRING)) or (require (planet SYMBOL))"))]))]
[(_ thing) [(_ thing)
(teach-syntax-error (teach-syntax-error
'require 'require

View File

@ -247,6 +247,8 @@
(htdp-syntax-test #'(require (lib "a" "b/")) #rx"end with a slash") (htdp-syntax-test #'(require (lib "a" "b/")) #rx"end with a slash")
(htdp-syntax-test #'(require (lib "a" 2)) #rx"string for a lib path") (htdp-syntax-test #'(require (lib "a" 2)) #rx"string for a lib path")
(htdp-syntax-test #'(require (planet "a" 2)) #rx"not a valid planet path") (htdp-syntax-test #'(require (planet "a" 2)) #rx"not a valid planet path")
(htdp-syntax-test #'(require (planet "test-connectionλ.ss" ("planet" "test-connection.plt" 1 0)))
#rx"string can contain only")
(define rx:dots-error "found a template") (define rx:dots-error "found a template")