macro-stepper: clarified "from" in hiding rules, added todo list

original commit: a91e9e7bf630a9a6ee35adaf61f58f56d268b200
This commit is contained in:
Ryan Culpepper 2010-06-24 17:33:14 -06:00
parent ddc9d3e953
commit 3bcff8e3d1
2 changed files with 25 additions and 7 deletions

View File

@ -1,9 +1,12 @@
#lang scheme/base
(require scheme/match)
(require scheme/match
scheme/string)
(provide mpi->list
mpi->string)
mpi->string
self-mpi?)
;; mpi->list : module-path-index -> list
(define (mpi->list mpi)
(cond [(module-path-index? mpi)
(let-values ([(path relto) (module-path-index-split mpi)])
@ -18,12 +21,16 @@
(if (module-path-index? mpi)
(let ([mps (mpi->list mpi)])
(cond [(pair? mps)
(apply string-append
(format "~s" (car mps))
(map (lambda (x) (format " <= ~s" x)) (cdr mps)))]
(string-join (map (lambda (x) (format "~s" x)) mps)
" <= ")]
[(null? mps) "this module"]))
(format "~s" mpi)))
;; self-mpi? : module-path-index -> bool
(define (self-mpi? mpi)
(let-values ([(path relto) (module-path-index-split mpi)])
(eq? path #f)))
;; --
(provide mpi->mpi-sexpr

View File

@ -16,6 +16,15 @@
(define mode:standard "Standard")
(define mode:custom "Custom ...")
#|
TODO
- allow entry of more policies
- visual feedback on rules applying to selected identifier
(need to switch from list to editor)
|#
;; macro-hiding-prefs-widget%
(define macro-hiding-prefs-widget%
@ -255,11 +264,13 @@
(match condition
[`(free=? ,id)
(let ([b (identifier-binding id)])
(or #;(identifier->string id)
(or #| (identifier->string id) |#
(cond [(list? b)
(let ([mod (caddr b)]
[name (cadddr b)])
(format "'~s' from ~a" name (mpi->string mod)))]
(if (self-mpi? mod)
(format "'~a' defined in this module" name)
(format "'~s' imported from ~a" name (mpi->string mod))))]
[else
(symbol->string (syntax-e id))])))]
[_