Move syntax-source-* to syntax/location.
This commit is contained in:
parent
a1c5285cc2
commit
2c21d61870
|
@ -11,7 +11,9 @@
|
|||
quote-character-position
|
||||
quote-character-span
|
||||
quote-module-path
|
||||
quote-module-name)
|
||||
quote-module-name
|
||||
syntax-source-directory
|
||||
syntax-source-file-name)
|
||||
|
||||
(begin-for-syntax
|
||||
|
||||
|
@ -143,3 +145,19 @@
|
|||
[(null? path) src]
|
||||
[(pair? src) (append src path)]
|
||||
[else (cons src path)])))
|
||||
|
||||
;; ------------------------------------------------------------------------
|
||||
|
||||
(define (syntax-source-directory stx)
|
||||
(let* ([source (syntax-source stx)])
|
||||
(and (path-string? source)
|
||||
(let-values ([(base file dir?) (split-path source)])
|
||||
(and (path? base)
|
||||
(path->complete-path base
|
||||
(or (current-load-relative-directory)
|
||||
(current-directory))))))))
|
||||
|
||||
(define (syntax-source-file-name stx)
|
||||
(let* ([f (syntax-source stx)])
|
||||
(and (path-string? f)
|
||||
(let-values ([(base file dir?) (split-path f)]) file))))
|
||||
|
|
|
@ -3,15 +3,12 @@
|
|||
(require racket/syntax
|
||||
(for-syntax racket/base)
|
||||
(for-template racket/base)
|
||||
syntax/transformer) ; for re-export
|
||||
syntax/transformer ; for re-export
|
||||
syntax/location) ; for re-export
|
||||
|
||||
(provide ;; by endobson
|
||||
syntax-length
|
||||
|
||||
;; by cce:
|
||||
syntax-source-file-name
|
||||
syntax-source-directory
|
||||
|
||||
;; by stamourv:
|
||||
format-unique-id
|
||||
syntax-within?
|
||||
|
@ -21,33 +18,9 @@
|
|||
phase-of-enclosing-module
|
||||
|
||||
;; re-export, for backwards compatibility
|
||||
make-variable-like-transformer)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; By Carl Eastlund, below
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Syntax Locations
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define (syntax-source-directory stx)
|
||||
(let* ([source (syntax-source stx)])
|
||||
(and (path-string? source)
|
||||
(let-values ([(base file dir?) (split-path source)])
|
||||
(and (path? base)
|
||||
(path->complete-path base
|
||||
(or (current-load-relative-directory)
|
||||
(current-directory))))))))
|
||||
|
||||
(define (syntax-source-file-name stx)
|
||||
(let* ([f (syntax-source stx)])
|
||||
(and (path-string? f)
|
||||
(let-values ([(base file dir?) (split-path f)]) file))))
|
||||
make-variable-like-transformer
|
||||
syntax-source-file-name
|
||||
syntax-source-directory)
|
||||
|
||||
;; by stamourv:
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user