Source Syntax
recover-source-syntax
8.15.0.10

Source Syntax🔗ℹ

 (require syntax/source-syntax) package: source-syntax

procedure

(recover-source-syntax orig 
  expanded 
  [#:traverse-now? now?]) 
  (-> syntax? (or/c syntax? #f))
  orig : syntax?
  expanded : syntax?
  now? : boolean? = #f
Returns a procedure that accepts a syntax object from expanded and returns the outermost syntax object in orig that has the same location as the given syntax object. If no syntax object in orig has the same location as the given syntax object, the procedure repeats with the parent of the given syntax object.

Example:
> (let* ([orig #'(λ (x [y 0]) (+ x y))]
         [expanded (expand orig)]
         [recovered ((recover-source-syntax orig expanded) expanded)])
    (syntax? recovered))

#t