www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit efb0d935172555e623a88e147f387a6e9a4a5bf6
parent f8b590226d80bf590515bf3fb04827dcb3b63d9f
Author: Georges Dupéron <georges.duperon@gmail.com>
Date:   Mon,  5 Sep 2016 15:49:10 +0200

Removed replace-top-loc which was unused, moved it to https://github.com/jsmaniac/phc-toolkit/blob/76788aba6499684fae33abfd4fb83da480eb26b3/stx/fold.rkt

Diffstat:
Mlang/reader.rkt | 34----------------------------------
1 file changed, 0 insertions(+), 34 deletions(-)

diff --git a/lang/reader.rkt b/lang/reader.rkt @@ -10,40 +10,6 @@ (only-in syntax/module-reader make-meta-reader) syntax/strip-context) -;; Replaces the syntax/loc for the top of the syntax object, until -;; a part which doesn't belong to old-source is reached. -;; e.g. (with-syntax ([d user-provided-syntax]) -;; (replace-top-loc -;; #'(a b (c d e)) -;; (syntax-source #'here) -;; new-loc)) -;; will produce a syntax object #'(a b (c (x (y) z) e)) -;; where a, b, c, z, e and their surrounding forms have their srcloc set to -;; new-loc, but (x (y) z) will be left intact, if the user-provided-syntax -;; appears in another file. -(define (replace-top-loc stx old-source new-loc) - (let process ([stx stx]) - (cond - [(syntax? stx) - (if (equal? (syntax-source stx) old-source) - (datum->syntax stx (process (syntax-e stx)) new-loc stx) - stx - ;; Use the following expression to replace the loc throughout stx - ;; instead of stopping the depth-first-search when the syntax-source - ;; is not old-source anymore - #;(datum->syntax stx (process (syntax-e stx)) stx stx))] - [(pair? stx) - (cons (process (car stx)) - (process (cdr stx)))] - [(vector? stx) - (list->vector (process (vector->list stx)))] - [(prefab-struct-key stx) - => (λ (key) - (make-prefab-struct key - (process (struct->vector stx))))] - [else - stx]))) - (define ((wrap-reader reader) chr in src line col pos) (define/with-syntax orig-mod (reader chr (narrow-until-prompt in) src line col pos))