{"size": 945, "ext": "scrbl", "max_stars_repo_path": "typed-racket-doc/source-syntax/scribblings/source-syntax.scrbl", "max_stars_repo_name": "wargrey/typed-racket", "max_stars_repo_stars_event_min_datetime": "2015-01-07T11:59:09.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T16:16:38.000Z", "max_issues_repo_path": "typed-racket-doc/source-syntax/scribblings/source-syntax.scrbl", "max_issues_repo_name": "wargrey/typed-racket", "max_issues_repo_issues_event_min_datetime": "2015-01-05T13:22:22.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T11:15:00.000Z", "max_forks_repo_path": "typed-racket-doc/source-syntax/scribblings/source-syntax.scrbl", "max_forks_repo_name": "wargrey/typed-racket", "max_forks_repo_forks_event_min_datetime": "2015-01-07T19:02:44.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-21T13:53:31.000Z"}
{"max_stars_count": 498, "max_issues_count": 977, "max_forks_count": 117, "avg_line_length": 37.8, "max_line_length": 80, "alphanum_fraction": 0.653968254}
#lang scribble/manual
@require[scribble/example (for-label racket/base racket/contract)]

@title{Source Syntax}

@defmodule[syntax/source-syntax]{}

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

@examples[#:eval (make-base-eval '(require syntax/source-syntax))
  (let* ([orig #'(λ (x [y 0]) (+ x y))]
         [expanded (expand orig)]
         [recovered ((recover-source-syntax orig expanded) expanded)])
    (syntax? recovered))
]
