Compare commits

..

1 Commits

5 changed files with 37 additions and 77 deletions

View File

@ -6,22 +6,14 @@ env:
global:
- RACKET_DIR=~/racket
matrix:
#- RACKET_VERSION=6.1.1
#- RACKET_VERSION=6.2
#- RACKET_VERSION=6.2.1
#- RACKET_VERSION=6.3
- RACKET_VERSION=6.1.1
- RACKET_VERSION=6.2
- RACKET_VERSION=6.2.1
- RACKET_VERSION=6.3
- RACKET_VERSION=6.4
- RACKET_VERSION=6.5
- RACKET_VERSION=6.6
- RACKET_VERSION=6.7
- RACKET_VERSION=6.8
- RACKET_VERSION=6.9
- RACKET_VERSION=6.10
- RACKET_VERSION=6.10.1
- RACKET_VERSION=6.11
- RACKET_VERSION=6.12
- RACKET_VERSION=7.0
- RACKET_VERSION=7.1
- RACKET_VERSION=7.2
- RACKET_VERSION=HEAD
matrix:
@ -40,7 +32,7 @@ install:
before_script:
script:
- raco pkg install -j 2 --deps search-auto --link aful
- raco test -r -p aful
- raco pkg install --deps search-auto --link aful
- raco test -x -p aful
after_script:

View File

@ -6,16 +6,14 @@
read read-syntax)
(except-in aful/reader
read read-syntax)))
@author[
"Alex Knauth"
@author+email["Suzanne Soy" "racket@suzanne.soy"]]
@title{aful}
@;; example: @aful-code{(map #λ(+ % 1) '(1 2 3))}
@(define-syntax-rule @aful-code[stuff ...]
@code[#:lang "aful racket" stuff ...])
source code: @url["https://github.com/jsmaniac/aful/"]
source code: @url["https://github.com/AlexKnauth/aful"]
@section{#lang aful}
@ -103,4 +101,4 @@ Examples:
@defparam[current-arg-string arg-str string?]{
a parameter that controls default values of the @racket[arg-str] arguments to @racket[aful-read] etc.
}
}

View File

@ -19,8 +19,6 @@
racket/function
syntax/srcloc
hygienic-reader-extension/extend-reader
"scribble-enhanced.rkt"
phc-toolkit/stx
"unhygienic/hygienic-reader-extension--extend-reader--unhygienic.rkt"
(for-meta -10 racket/base)
(for-meta -9 racket/base)
@ -54,7 +52,7 @@
((wrap-reader read) in)))
(define (aful-read-syntax [src (object-name (current-input-port))] [in (current-input-port)]
#:arg-str [arg-str (current-arg-string)])
#:arg-str [arg-str (current-arg-string)])
(parameterize ([current-arg-string arg-str])
((wrap-reader read-syntax) src in)))
@ -64,19 +62,19 @@
(require syntax/strip-context)
(define ((wrap-reader-unhygienic p) . p-args)
(strip-context
(apply (extend-reader-unhygienic p
(λ ([orig-rt (current-readtable)]
#:outer-scope outer-scope
#:arg-str [arg-str (current-arg-string)])
(make-aful-readtable orig-rt
#:outer-scope (λ (stx [mode 'flip]) stx)
#:arg-str arg-str))
(apply (extend-reader p
(λ ([orig-rt (current-readtable)]
#:outer-scope outer-scope
#:arg-str [arg-str (current-arg-string)])
(make-aful-readtable orig-rt
#:outer-scope (λ (stx [mode 'flip]) stx)
#:arg-str arg-str))
#:hygiene? #f)
p-args)))
(define (make-aful-readtable [orig-rt (current-readtable)]
#:outer-scope outer-scope
#:arg-str [arg-str (current-arg-string)])
#:outer-scope outer-scope
#:arg-str [arg-str (current-arg-string)])
(define reader-proc (make-reader-proc orig-rt outer-scope #:arg-str arg-str))
(let* ([rt orig-rt]
[rt (make-readtable rt #\λ 'dispatch-macro reader-proc)]
@ -149,9 +147,9 @@
(define loc-stx (build-source-location-syntax loc))
(define λ-loc
(update-source-location loc-stx
#:column (and col (+ col 1))
#:position (and pos (+ pos 1))
#:span (and stx-pos pos (max 0 (- stx-pos pos 1)))))
#:column (and col (+ col 1))
#:position (and pos (+ pos 1))
#:span (and stx-pos pos (max 0 (- stx-pos pos 1)))))
(hygienic-app
#:outer-scope outer-scope
(lambda (stx*)
@ -160,14 +158,10 @@
[% (string->id stx* arg-str)]
[%1 (string->id stx* arg-str "1")]
[body stx*])
(syntax-property
(syntax/top-loc loc-stx
(lambda args
(define-syntax % (make-rename-transformer #'%1))
body))
'scribble-render-as
aful-scribble-render)
))
(syntax/loc loc-stx
(lambda args
(define-syntax % (make-rename-transformer #'%1))
body))))
stx)))
(define (orig stx)
@ -179,25 +173,25 @@
(syntax->datum (parse stx identity)))
(check-equal? (chk #'(+))
'(lambda ()
(define-syntax % (make-rename-transformer #'%1))
(+)))
(define-syntax % (make-rename-transformer #'%1))
(+)))
(check-equal? (chk #'(+ 2 %1 %1))
'(lambda (%1)
(define-syntax % (make-rename-transformer #'%1))
(+ 2 %1 %1)))
(define-syntax % (make-rename-transformer #'%1))
(+ 2 %1 %1)))
(check-equal? (chk #'(+ 2 %3 %2 %1))
'(lambda (%1 %2 %3)
(define-syntax % (make-rename-transformer #'%1))
(+ 2 %3 %2 %1)))
(define-syntax % (make-rename-transformer #'%1))
(+ 2 %3 %2 %1)))
(check-equal? (chk #'(apply list* % %&))
'(lambda (%1 . %&)
(define-syntax % (make-rename-transformer #'%1))
(apply list* % %&)))
(define-syntax % (make-rename-transformer #'%1))
(apply list* % %&)))
(check-equal? (parameterize ([current-arg-string "_"])
(chk #'(apply list* _ _&)))
'(lambda (_1 . _&)
(define-syntax _ (make-rename-transformer #'_1))
(apply list* _ _&))))
(define-syntax _ (make-rename-transformer #'_1))
(apply list* _ _&))))
;; parse-args : Stx -> KW-Formals-Stx
(define (parse-args stx #:arg-str [arg-str (current-arg-string)])

View File

@ -1,20 +0,0 @@
#lang racket
(provide aful-scribble-render)
(require phc-toolkit/stx)
(define (aful-scribble-render self id code typeset-code uncode d->s stx-prop)
(syntax-case self ()
[(_ _ _ body)
; #λ(body) reads as:
; (lambda args
; (define-syntax % (make-rename-transformer #'%1))
; body)
(with-syntax ([uncode (datum->syntax uncode (syntax-e uncode) self)])
(syntax/top-loc self
((uncode(let ()
(local-require scribble-enhanced/with-manual)
(seclink "_lang_aful"
#:doc '(lib "aful/docs/aful.scrbl")
(tt ""))))
body)))]))

View File

@ -8,9 +8,6 @@
"at-exp-lib"
"rackjure"
"rackunit-lib"
"phc-toolkit"
"scribble-enhanced"
"scribble-lib"
))
(define build-deps
@ -18,6 +15,5 @@
"racket-doc"
"scribble-doc"
"scribble-code-examples"
"scribble-doc"
))