This is the function you want, I think: + +(define (sym->original-syntax sym srcloc) + (define p (open-input-string (symbol->string sym))) + (port-count-lines! p) + (match-define (list source-name line column position span) srcloc) + (set-port-next-location! p line column position) + (read-syntax source-name p))
On Tue, Jul 3, 2012 at 12:44 PM, Jens Axel Søgaard <[email protected]> wrote: > 2012/7/3 Robby Findler <[email protected]> >> >> Another possibility is that the identifiers that your reader produces >> are not syntax-original?. You have to use 'read-syntax' to actually >> produce the identifiers to get that mark on them. > > > That's definitely it. But since I am not using read-syntax, > how do I get the right mark? The docs for syntax-original? > says > > Returns #t if stx has the property that read-syntax attaches to > thesyntax objects > that they generate ... > > So it is not clear what property I should set in my own read-syntax. > > I have specified my own read-syntax in lang/reader.rkt. > The reader uses the source location lexer/parser from the > parser location and then wraps result in a module. > > https://github.com/soegaard/bracket/blob/master/bracket/lang/reader.rkt > >> >> There are some unreleased changes to datalog that improve this aspect of >> it: >> >> >> http://git.racket-lang.org/plt/commit/bf95ee10523daabea4925073ff035bf57ecad59f >> >> there are few followup commits that clean up that one but not, I >> think, relating to this issue. > > > I see a few changes in order to store the source location in the tokens, > but I am already doing that - and error messages find the proper places > so it seems that part works. > > https://github.com/soegaard/bracket/blob/master/bracket/lang/parser.rkt > > /Jens Axel > ____________________ Racket Users list: http://lists.racket-lang.org/users

