[racket] color partial lexemes

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Aug 2 17:36:30 EDT 2011

On Tue, Aug 2, 2011 at 4:18 PM, Jon Rafkind <rafkind at cs.utah.edu> wrote:
> On 08/02/2011 12:57 PM, Jon Rafkind wrote:
>
> Oh sorry, I realize I was talking about two different things. I set up a
> test case that creates a color:text% and explicitly calls `start-colorer'
> with the pairs, style, and get-token things I defined, but for implementing
> a language I only have access to #:info.
>
> I think some new keys can be passed to the #:info function that can get a
> new pair list and style function. I'll work on a patch for that.
>
>
> After searching a handful of paths it seems the only way to make this work
> is to hook into the 'run' button. I imagine that start-colorer can be called
> each time 'run' is invoked and at which time the #:info function can be
> probed for the `pairs', `token-sym->symbol' and possibly the lexer as well.
>
> A cursory glance at module-lexer looks like its going through the whole
> process of getting the lexer by 1. calling `read-language' and 2. calling
> (get-info 'color-lexer). This seems like redundant work if the #lang hasn't
> changed. Hooking into the run button could do most of this work once.
>

No, it doesn't do that. It detects when you edit the region around the
#lang (this is why the docs say not to read too far into the port;
that's how it knows).

I don't think we want to tie this to the run button. DrRacket already
sets up the right stuff to know when to check to change the colorer;
we should just continue to use that.

Can you be more precise about what is not working for you?

Robby


Posted on the users mailing list.