[plt-scheme] Syntax coloring problem.

From: vladimir9 at wanadoo.fr (vladimir9 at wanadoo.fr)
Date: Wed Jan 12 12:29:46 EST 2005


I have just finished my parser (with lex/yacc) for a mini-Basic language and i want to color the syntax in its definitions editor (object of class color:text%).

I'm trying to use (send a-color:text start-colorer token-sym-style get-token pairs) where token-sym-style is symbol->string and get-token is my lexer function. It recognizes the token "LET" for example but i doesn't change the color. 

I don't understand what i need to do.  Do i need a style-list ? or something like that?
For example in my get-lexeme function i have :

 ["LET" (values lexeme '_let_  #f (position-offset start-pos) (position-offset end-pos))] 

Also i have made a style-delta with a blue foreground color :

(define _let_ (make-object style-delta% 'change-normal-color))
(send _let_ set-delta-foreground "navy")

The result is not good because if my text color is red (for example) by default, when i have typed "LET" the text color of the whole editor becomes black. 

I would be very gratefull if you could give me a little advice.


Posted on the users mailing list.