[racket] color partial lexemes

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Aug 2 14:25:48 EDT 2011

I don't think that's currently possible. Patches welcome, of course, or if
you have a concrete missing thing (I'm inferring that everything is ok at
the moment from the below but I'm not positive about that) I can add
something.

Robby

On Tuesday, August 2, 2011, Jon Rafkind <rafkind at cs.utah.edu> wrote:
> Ok the last mystery is how can I control the pair matching and colors that
lexemes should have? If I call `start-colorer' on the color:text% I can pass
in the style function and the list of matching lexemes but with the
module-reader I only have control over the lexer via #:info.
>
> Currently I have
>
> (define (style what)
>   (case what
>     [(number) "framework:syntax-color:scheme:constant"]
>     [(string) "framework:syntax-color:scheme:string"]
>     [(identifier) "framework:syntax-color:scheme:symbol"]
>     [(parens) "framework:syntax-color:scheme:parenthesis"]
>     [else "Standard"]))
>
> (define pairs '([ |(| |)| ]
>                        [ |[| |]| ]
>                        [ |{| |}| ]
>                       ))
>
> And although my current `pairs' list matches what the text-mode-mixin has
I may add things to the list in the future.
>
> On 08/02/2011 10:56 AM, Robby Findler wrote:
>
> No. It should back up to the previous lexeme and start there.
>
> Robby
>
> On Tuesday, August 2, 2011, Jon Rafkind <rafkind at cs.utah.edu> wrote:
>> On 08/01/2011 06:40 PM, Matthew Flatt wrote:
>>> At Mon, 01 Aug 2011 18:13:11 -0600, Jon Rafkind wrote:
>>>> How do I deal with partial lexemes when using the color:text colorer?
It
>>>> seems that if my lexer cannot produce a valid token then it will throw
>>>> an error and the color thread will keep calling `get-token' in a busy
loop.
>>>>
>>>> Is there some magic thing I can return from `get-token' to tell the
>>>> colorer that it should not progress to the next position?
>>> A coloring lexer's job is to never fail. It should instead categorize
>>> bad input as 'error and be ready to continue.
>>>
>>> Continuing can mean categorizing all further input as 'error, but it's
>>> usually better to continue in some other way.
>>>
>>
>> It seems the colorer re-tokenizes the entire input stream each time I
>> enter a character. Is that the expected behavior?
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://lists.racket-lang.org/listinfo/users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110802/b4658bdb/attachment.html>

Posted on the users mailing list.