Add language-index-desc and reader-index-desc

Subtypes of module-index-desc.
Used to tell if a module implements a #lang or a #reader module.
This commit is contained in:
Ben Greenman 2016-06-24 23:54:19 -04:00
parent 06e254f169
commit 5505a5557a
3 changed files with 36 additions and 16 deletions

View File

@ -2049,6 +2049,16 @@ rendered document.}
Indicates that the index entry corresponds to a module definition via
@racket[defmodule] and company.}
@deftogether[(
@defstruct[(language-index-desc module-path-index-desc)]{}
@defstruct[(reader-index-desc module-path-index-desc)]{}
)]{
Indicates that the index entry corresponds to a module definition via
@racket[defmodule] with the @racket[#:lang] or @racket[#:reader] option.
For example, a module definition via @racket[defmodulelang] has a
@racket[language-index-desc] index entry and a module definition via
@racket[defmodulereader] has a @racket[reader-index-desc] index entry.}
@defstruct[exported-index-desc ([name symbol?]
[from-libs (listof module-path?)])]{

View File

@ -5,6 +5,8 @@
(provide-structs
[module-path-index-desc ()]
[(language-index-desc module-path-index-desc) ()]
[(reader-index-desc module-path-index-desc) ()]
[exported-index-desc ([name symbol?]
[from-libs (listof module-path?)])]
[(method-index-desc exported-index-desc) ([method-name symbol?]

View File

@ -221,30 +221,36 @@
(add-between (map tt pkgs) ", "))))))))))
(define (flow-width f) (apply max (map block-width f)))
(define libs-specs
;; make-desc : element -> flow
;; index-desc : module-path-index-desc
(let-values ([(make-desc index-desc)
(case lang
[(#f)
(values (lambda (modname) (list (racket (#,req #,modname))))
the-module-path-index-desc)]
[(#t)
(values (lambda (modname) (list (hash-lang) spacer modname))
the-language-index-desc)]
[(reader)
(values (lambda (modname) (list (racketmetafont "#reader") spacer modname))
the-reader-index-desc)]
[(just-lang)
(values (lambda (modname) (list (hash-lang) spacer modname))
the-language-index-desc)]
[else (error 'defmodule "unknown mode: ~e" lang)])])
(map
(lambda (name modpath)
(define modname (if link-target?
(make-defracketmodname name modpath)
(make-defracketmodname name modpath index-desc)
name))
(list
(make-flow
(list
(make-omitable-paragraph
(cons
spacer
(case lang
[(#f)
(list (racket (#,req #,modname)))]
[(#t)
(list (hash-lang) spacer modname)]
[(reader)
(list (racketmetafont "#reader") spacer modname)]
[(just-lang)
(list (hash-lang) spacer modname)]
[else (error 'defmodule "unknown mode: ~e" lang)])))))
(cons spacer (make-desc modname)))))
'cont))
names
modpaths))
modpaths)))
(make-splice
(cons
@ -278,8 +284,10 @@
(flow-paragraphs (decode-flow content)))))))
(define the-module-path-index-desc (make-module-path-index-desc))
(define the-language-index-desc (make-language-index-desc))
(define the-reader-index-desc (make-reader-index-desc))
(define (make-defracketmodname mn mp)
(define (make-defracketmodname mn mp index-desc)
(let ([name-str (datum-intern-literal (element->string mn))]
[path-str (datum-intern-literal (element->string mp))])
(make-index-element #f
@ -287,7 +295,7 @@
(intern-taglet `(mod-path ,path-str))
(list name-str)
(list mn)
the-module-path-index-desc)))
index-desc)))
(define-syntax (declare-exporting stx)
(syntax-parse stx