[plt-scheme] Re: What to augment, how to highlight ?
Oh, sorry. I am thoughtless. I modified my code thanks to your
comments and it is good.Thanks :)
I still have a question :
Now, with the "start-colorer" method my regular expressions are
colored. However, if I write a character not recognized by the lexer,
Drscheme send an exception like :
exception in colorer thread: #4(struct:exn:fail:read "lexer: No match
found in input starting with: é" #<continuation-mark-set>
(#6(struct:srcloc #f 1 0 1)))
How say to the lexer that it doesn't have to color caracters they are
not recognize.
Example of the lexer :
(define get-word
(lexer
(int
(values lexeme 'number lexeme (position-offset start-pos)
(position-offset end-pos)))
(float
(values lexeme 'number lexeme (position-offset start-pos)
(position-offset end-pos)))
(statement
(values lexeme 'keyword lexeme (position-offset start-pos)
(position-offset end-pos)))
(str
(values lexeme 'string lexeme (position-offset start-pos)
(position-offset end-pos)))
(var
(values lexeme 'var lexeme (position-offset start-pos) (position-
offset end-pos)))
(whitespace
(values lexeme 'whitespace lexeme (position-offset start-pos)
(position-offset end-pos)))
((eof)
(values lexeme 'eof #f #f #f))))
Perhaps, i try to catch the exception like this :
(with-handlers ([exn:fail:read? (lambda (exn) (void))])
(send this start-colorer (lambda (s) (symbol->string s)) get-word
`())))
But this don't perform :(
Thanks,
Laurent