|
|
@ -11,11 +11,12 @@
|
|
|
|
"project.rkt")
|
|
|
|
"project.rkt")
|
|
|
|
(provide (rename-out [reader-module-begin #%module-begin]) (all-from-out "../setup.rkt"))
|
|
|
|
(provide (rename-out [reader-module-begin #%module-begin]) (all-from-out "../setup.rkt"))
|
|
|
|
|
|
|
|
|
|
|
|
(define (path-string->here-path path-string)
|
|
|
|
(define (source-name->pollen-require-path source-name)
|
|
|
|
(cond
|
|
|
|
;; the `path-string` passed in from `read-syntax` can actually be `any/c`
|
|
|
|
[(symbol? path-string) (symbol->string path-string)]
|
|
|
|
(if (syntax? source-name)
|
|
|
|
[(equal? path-string "unsaved editor") path-string]
|
|
|
|
(syntax-source source-name)
|
|
|
|
[else (path->string path-string)]))
|
|
|
|
;; captures paths, strings, "unsaved editor", path-strings, symbols
|
|
|
|
|
|
|
|
source-name))
|
|
|
|
|
|
|
|
|
|
|
|
(define (infer-parser-mode reader-mode reader-here-path)
|
|
|
|
(define (infer-parser-mode reader-mode reader-here-path)
|
|
|
|
(if (eq? reader-mode default-mode-auto)
|
|
|
|
(if (eq? reader-mode default-mode-auto)
|
|
|
@ -34,19 +35,21 @@
|
|
|
|
(syntax->datum (custom-read-syntax (object-name p) p)))
|
|
|
|
(syntax->datum (custom-read-syntax (object-name p) p)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define (custom-read-syntax #:reader-mode [reader-mode #f] path-string p)
|
|
|
|
(define (custom-read-syntax #:reader-mode [reader-mode #f] source-name input-port)
|
|
|
|
(define source-stx (let ([read-inner (make-at-reader
|
|
|
|
(define source-stx (let ([read-inner (make-at-reader
|
|
|
|
#:command-char (setup:command-char)
|
|
|
|
#:command-char (setup:command-char)
|
|
|
|
#:syntax? #t
|
|
|
|
#:syntax? #t
|
|
|
|
#:inside? #t)])
|
|
|
|
#:inside? #t)])
|
|
|
|
(read-inner path-string p)))
|
|
|
|
(read-inner source-name input-port)))
|
|
|
|
(define reader-here-path (path-string->here-path path-string))
|
|
|
|
(define pollen-require-path (source-name->pollen-require-path source-name))
|
|
|
|
|
|
|
|
(define reader-here-path (format "~a" pollen-require-path))
|
|
|
|
(define parser-mode-from-reader (infer-parser-mode reader-mode reader-here-path))
|
|
|
|
(define parser-mode-from-reader (infer-parser-mode reader-mode reader-here-path))
|
|
|
|
|
|
|
|
|
|
|
|
(strip-context
|
|
|
|
(strip-context
|
|
|
|
(with-syntax* ([POLLEN-MOD-NAME 'pollen-module]
|
|
|
|
(with-syntax* ([POLLEN-MOD-NAME 'pollen-module]
|
|
|
|
;; the next two exist only in the reader because they are specific to file-based Pollen sources.
|
|
|
|
;; the next two exist only in the reader because they are specific to file-based Pollen sources.
|
|
|
|
;; an inline Pollen submodule doesn't have "pollen.rkt" or `here-path`
|
|
|
|
;; an inline Pollen submodule doesn't have "pollen.rkt" or `here-path`
|
|
|
|
[POLLEN-REQUIRE-AND-PROVIDES (require+provide-directory-require-files path-string)]
|
|
|
|
[POLLEN-REQUIRE-AND-PROVIDES (require+provide-directory-require-files pollen-require-path)]
|
|
|
|
[HERE-PATH reader-here-path]
|
|
|
|
[HERE-PATH reader-here-path]
|
|
|
|
[HERE-KEY (setup:here-path-key)]
|
|
|
|
[HERE-KEY (setup:here-path-key)]
|
|
|
|
[SOURCE-LINES source-stx]
|
|
|
|
[SOURCE-LINES source-stx]
|
|
|
|