resyntax
resyntax copied to clipboard
A Racket refactoring engine
If I can get Resyntax to run on non-Racket files, then a great refactoring rule to have would be one that corrects common typos in Scribble documentation.
Saw some code in racket/drracket#691 where a rule like this would help: ```scheme #lang resyntax/test test: "for with set! refactorable to for/fold" -------------------- #lang racket (define (f n) (define xs...
```scheme #lang resyntax/test test: "hash-for-each should be refactored to for" -------------------- #lang racket (define (f h) (hash-for-each h (lambda (key val) (printf "key = ~a, val = ~a\n" key val))))...
```scheme #lang resyntax/test test: "build-list and explicit lambda should be refactored to for/list" -------------------- #lang racket (define (f n) (build-list n (lambda (i) (+ i (* i 2))))) -------------------- --------------------...
This rule: ```scheme (define-refactoring-rule redundant-or #:description "This `or` expression does nothing and can be replaced with its subexpression." #:literals (or) (or a1:id a2:id) #:when (free-identifier=? #'a1 #'a2) a1) ``` Fails...
Closes #153 and closes #369. I'm keeping this open as a draft for now. It relies on a patch to Racket to emit a `'disappeared-visit` syntax property. I'm not sure...
When using `syntax-parse`, ellipses-bound pattern variables are often converted to lists using `(syntax->list #'(var ...))` but they can be extracted as lists directly using `(attribute var)`. There should be a...
I recently learned that in `syntax-parse`, literals can be used with colon notation just like syntax classes. There ought to be a refactoring rule for this since I'm sure it's...
Resyntax relies on the expander to find what forms it should analyze. This means that macros which circumvent the expander, like `for`, `match`, and `syntax-parse`, can hide forms from Resyntax....
As brought up [here](https://github.com/racket/drracket/pull/687#discussion_r1798562422), it might be nice to have a rule for turning `and` into `cond` when doing so allows turning `let` into `define`. ```scheme #lang resyntax/test -------------------- #lang...