[racket] How to associate a custom syntax color lexer with a new module language

From: Danny Yoo (dyoo at hashcollision.org)
Date: Fri Jun 22 10:08:20 EDT 2012

> However it seems that DrRacket never calls the get-info function in question.
> To check this, I added a displayln call to print a message each get-info
> is called, and I never see any output from this.

Odd; I'm seeing output!  So I can't duplicate what you're seeing:
DrRacket appears to be running the get-info function on my end.

Here's what I'm seeing on the console when I try running on one of
your test files "testing.rkt":

---
kepler ~/work/bracket/bracket/lang $ drracket ../tests/testing.rkt
(reader/get-info #<input-port> bracket/lang/reader #f #f 1)
(reader/get-info drracket:toolbar-buttons #f)
(reader/get-info drscheme:toolbar-buttons #f)
(reader/get-info drracket:opt-out-toolbar-buttons ())
(reader/get-info #<input-port> bracket/lang/reader #f #f 1)
close
close
(reader/get-info #<input-port> bracket/lang/reader #f #f 1)
(reader/get-info #<input-port> bracket/lang/reader 1 0 1)
(reader/get-info color-lexer #f)
exception in colorer thread: #(struct:exn:fail:contract:arity "context
expected 1 value, received 5 values: \"\\n\" 'white-space #f
#<position> #<position>" #<continuation-mark-set>)

 === context ===
/home/dyoo/local/racket-5.2.1/lib/racket/collects/syntax-color/module-lexer.rkt:25:0:
module-lexer
/home/dyoo/local/racket-5.2.1/lib/racket/collects/framework/private/racket.rkt:1281:26
/home/dyoo/local/racket-5.2.1/lib/racket/collects/framework/private/color.rkt:292:4:
re-tokenize method in ...rk/private/color.rkt:66:2
/home/dyoo/local/racket-5.2.1/lib/racket/collects/framework/private/color.rkt:455:17

Posted on the users mailing list.