Compare commits

..

1 Commits

5 changed files with 37 additions and 77 deletions

View File

@ -6,22 +6,14 @@ env:
global: global:
- RACKET_DIR=~/racket - RACKET_DIR=~/racket
matrix: matrix:
#- RACKET_VERSION=6.1.1 - RACKET_VERSION=6.1.1
#- RACKET_VERSION=6.2 - RACKET_VERSION=6.2
#- RACKET_VERSION=6.2.1 - RACKET_VERSION=6.2.1
#- RACKET_VERSION=6.3 - RACKET_VERSION=6.3
- RACKET_VERSION=6.4 - RACKET_VERSION=6.4
- RACKET_VERSION=6.5 - RACKET_VERSION=6.5
- RACKET_VERSION=6.6
- RACKET_VERSION=6.7 - 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 - RACKET_VERSION=HEAD
matrix: matrix:
@ -40,7 +32,7 @@ install:
before_script: before_script:
script: script:
- raco pkg install -j 2 --deps search-auto --link aful - raco pkg install --deps search-auto --link aful
- raco test -r -p aful - raco test -x -p aful
after_script: after_script:

View File

@ -6,16 +6,14 @@
read read-syntax) read read-syntax)
(except-in aful/reader (except-in aful/reader
read read-syntax))) read read-syntax)))
@author[
"Alex Knauth"
@author+email["Suzanne Soy" "racket@suzanne.soy"]]
@title{aful} @title{aful}
@;; example: @aful-code{(map #λ(+ % 1) '(1 2 3))} @;; example: @aful-code{(map #λ(+ % 1) '(1 2 3))}
@(define-syntax-rule @aful-code[stuff ...] @(define-syntax-rule @aful-code[stuff ...]
@code[#:lang "aful racket" 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} @section{#lang aful}
@ -103,4 +101,4 @@ Examples:
@defparam[current-arg-string arg-str string?]{ @defparam[current-arg-string arg-str string?]{
a parameter that controls default values of the @racket[arg-str] arguments to @racket[aful-read] etc. 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 racket/function
syntax/srcloc syntax/srcloc
hygienic-reader-extension/extend-reader hygienic-reader-extension/extend-reader
"scribble-enhanced.rkt"
phc-toolkit/stx
"unhygienic/hygienic-reader-extension--extend-reader--unhygienic.rkt" "unhygienic/hygienic-reader-extension--extend-reader--unhygienic.rkt"
(for-meta -10 racket/base) (for-meta -10 racket/base)
(for-meta -9 racket/base) (for-meta -9 racket/base)
@ -54,7 +52,7 @@
((wrap-reader read) in))) ((wrap-reader read) in)))
(define (aful-read-syntax [src (object-name (current-input-port))] [in (current-input-port)] (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]) (parameterize ([current-arg-string arg-str])
((wrap-reader read-syntax) src in))) ((wrap-reader read-syntax) src in)))
@ -64,19 +62,19 @@
(require syntax/strip-context) (require syntax/strip-context)
(define ((wrap-reader-unhygienic p) . p-args) (define ((wrap-reader-unhygienic p) . p-args)
(strip-context (strip-context
(apply (extend-reader-unhygienic p (apply (extend-reader p
(λ ([orig-rt (current-readtable)] (λ ([orig-rt (current-readtable)]
#:outer-scope outer-scope #:outer-scope outer-scope
#:arg-str [arg-str (current-arg-string)]) #:arg-str [arg-str (current-arg-string)])
(make-aful-readtable orig-rt (make-aful-readtable orig-rt
#:outer-scope (λ (stx [mode 'flip]) stx) #:outer-scope (λ (stx [mode 'flip]) stx)
#:arg-str arg-str)) #:arg-str arg-str))
#:hygiene? #f) #:hygiene? #f)
p-args))) p-args)))
(define (make-aful-readtable [orig-rt (current-readtable)] (define (make-aful-readtable [orig-rt (current-readtable)]
#:outer-scope outer-scope #:outer-scope outer-scope
#:arg-str [arg-str (current-arg-string)]) #:arg-str [arg-str (current-arg-string)])
(define reader-proc (make-reader-proc orig-rt outer-scope #:arg-str arg-str)) (define reader-proc (make-reader-proc orig-rt outer-scope #:arg-str arg-str))
(let* ([rt orig-rt] (let* ([rt orig-rt]
[rt (make-readtable rt #\λ 'dispatch-macro reader-proc)] [rt (make-readtable rt #\λ 'dispatch-macro reader-proc)]
@ -149,9 +147,9 @@
(define loc-stx (build-source-location-syntax loc)) (define loc-stx (build-source-location-syntax loc))
(define λ-loc (define λ-loc
(update-source-location loc-stx (update-source-location loc-stx
#:column (and col (+ col 1)) #:column (and col (+ col 1))
#:position (and pos (+ pos 1)) #:position (and pos (+ pos 1))
#:span (and stx-pos pos (max 0 (- stx-pos pos 1))))) #:span (and stx-pos pos (max 0 (- stx-pos pos 1)))))
(hygienic-app (hygienic-app
#:outer-scope outer-scope #:outer-scope outer-scope
(lambda (stx*) (lambda (stx*)
@ -160,14 +158,10 @@
[% (string->id stx* arg-str)] [% (string->id stx* arg-str)]
[%1 (string->id stx* arg-str "1")] [%1 (string->id stx* arg-str "1")]
[body stx*]) [body stx*])
(syntax-property (syntax/loc loc-stx
(syntax/top-loc loc-stx (lambda args
(lambda args (define-syntax % (make-rename-transformer #'%1))
(define-syntax % (make-rename-transformer #'%1)) body))))
body))
'scribble-render-as
aful-scribble-render)
))
stx))) stx)))
(define (orig stx) (define (orig stx)
@ -179,25 +173,25 @@
(syntax->datum (parse stx identity))) (syntax->datum (parse stx identity)))
(check-equal? (chk #'(+)) (check-equal? (chk #'(+))
'(lambda () '(lambda ()
(define-syntax % (make-rename-transformer #'%1)) (define-syntax % (make-rename-transformer #'%1))
(+))) (+)))
(check-equal? (chk #'(+ 2 %1 %1)) (check-equal? (chk #'(+ 2 %1 %1))
'(lambda (%1) '(lambda (%1)
(define-syntax % (make-rename-transformer #'%1)) (define-syntax % (make-rename-transformer #'%1))
(+ 2 %1 %1))) (+ 2 %1 %1)))
(check-equal? (chk #'(+ 2 %3 %2 %1)) (check-equal? (chk #'(+ 2 %3 %2 %1))
'(lambda (%1 %2 %3) '(lambda (%1 %2 %3)
(define-syntax % (make-rename-transformer #'%1)) (define-syntax % (make-rename-transformer #'%1))
(+ 2 %3 %2 %1))) (+ 2 %3 %2 %1)))
(check-equal? (chk #'(apply list* % %&)) (check-equal? (chk #'(apply list* % %&))
'(lambda (%1 . %&) '(lambda (%1 . %&)
(define-syntax % (make-rename-transformer #'%1)) (define-syntax % (make-rename-transformer #'%1))
(apply list* % %&))) (apply list* % %&)))
(check-equal? (parameterize ([current-arg-string "_"]) (check-equal? (parameterize ([current-arg-string "_"])
(chk #'(apply list* _ _&))) (chk #'(apply list* _ _&)))
'(lambda (_1 . _&) '(lambda (_1 . _&)
(define-syntax _ (make-rename-transformer #'_1)) (define-syntax _ (make-rename-transformer #'_1))
(apply list* _ _&)))) (apply list* _ _&))))
;; parse-args : Stx -> KW-Formals-Stx ;; parse-args : Stx -> KW-Formals-Stx
(define (parse-args stx #:arg-str [arg-str (current-arg-string)]) (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" "at-exp-lib"
"rackjure" "rackjure"
"rackunit-lib" "rackunit-lib"
"phc-toolkit"
"scribble-enhanced"
"scribble-lib"
)) ))
(define build-deps (define build-deps
@ -18,6 +15,5 @@
"racket-doc" "racket-doc"
"scribble-doc" "scribble-doc"
"scribble-code-examples" "scribble-code-examples"
"scribble-doc"
)) ))