[ Adding the mailing list back. ] If you just want to get the program as an expression, unexpanded, then you can use open-input-text-editor on the definitions text and 'read' (or read-syntax). But I don't recommend this approach (as, in the general case, you'll find yourself implementing a half-baked macro expander...).
You can put syntax properties on the result of your expander for the state-machine macro and then search for those properties in the expanded text. Maybe that will help? Robby On Wed, Apr 3, 2013 at 9:27 PM, Nick Main <david.nick.m...@gmail.com> wrote: > Thanks - I got a simple example > of drracket:module-language-tools:add-online-expansion-handler to work. > > It looks really useful, however it appears to be called after normal macro > expansion has occurred. This makes it hard to recognize the "state-machine" > forms that I want to handle, since they have already been expanded away. > > --Nick > > > On Wed, Apr 3, 2013 at 5:53 PM, Robby Findler <ro...@eecs.northwestern.edu > > wrote: > >> You want to hook into the online expansion, right? You can register a >> handler that's called after online expansion completes in the place where >> it runs and then its results are passed back to a handler you register on >> the other side, back in DrRacket's main place. This is how online check >> syntax works. >> >> >> http://docs.racket-lang.org/tools/drracket_module-language-tools.html?q=drracket%20online#%28def._%28%28lib._drracket%2Ftool-lib..rkt%29._drracket~3amodule-language-tools~3aadd-online-expansion-handler%29%29 >> >> This goes only one direction, tho, from the code to your view. Making the >> view manipulations change the source text would have to be some more >> mundane type thing where you just override various GUI callbacks and then >> work at the character/string level with the text% object in the definitions >> window. >> >> hth, >> Robby >> >> >> On Wed, Apr 3, 2013 at 7:21 PM, Nick Main <david.nick.m...@gmail.com>wrote: >> >>> I am developing a DrRacket plugin that adds a diagrammatic view to the >>> IDE (roughly the same place as the Module Browser). >>> The diagram is a visualization of certain forms in the current text >>> editor. Ultimately I would like to make the connection be bi-directional - >>> manipulating the diagram will change values in the text editor. >>> >>> The initial use-case is a state-machine visualizer (and later, editor). >>> >>> My current approach uses a macro to define the state-machine. I would >>> like to drive the generation of the diagram from the uses of the macro >>> (during background expansion), rather than writing my own code to detect >>> text changes and parse the contents of the editor. >>> >>> I am trying to find an easy way to communicate from the macro execution >>> to the DrRacket plugin, but nothing has surfaced so far. >>> If all else fails I could open up a socket connection in the macro and >>> talk to the plugin that way (I assume). >>> Are there any cheaper ways to poke a hole through the macro sandbox ? >>> >>> --Nick >>> >>> ____________________ >>> Racket Users list: >>> http://lists.racket-lang.org/users >>> >>> >> >
____________________ Racket Users list: http://lists.racket-lang.org/users