drracket icon indicating copy to clipboard operation
drracket copied to clipboard

Documentation of list of recognized syntax-coloring token types/styles is incomplete

Open gfbee opened this issue 5 years ago • 1 comments

https://github.com/racket/drracket/blob/7ae87809bc2e7d5849f27dd3689f837cd4c7ade9/drracket/scribblings/tools/lang-tools.scrbl#L62-L72

(map first (racket:get-color-prefs-table)) shows 'text and 'hash-colon-keyword are missing, which if included match the ten that have entries in the “Color / Racket” preferences tab. That table is hard-coded (and the preferences tab derived from it) : https://github.com/racket/gui/blob/0fbbf759d3f244458378a639f653971fdff76668/gui-lib/framework/private/racket.rkt#L294

An 'sexp-comment token (a parsed “#;” in the racket lexer) is also styled, as a 'comment : https://github.com/racket/gui/blob/0fbbf759d3f244458378a639f653971fdff76668/gui-lib/framework/private/racket.rkt#L335-L349

A 'white-space token is styled as 'parenthesis, which presumably has no visible effect if the lexer only produces that for invisible lexemes with invisible glyphs. Not changing styles at the boundary is to reduce memory usage : https://github.com/racket/gui/commit/2da0f724923b300ab98a508018604f7d71863d62

Some 'symbol tokens get translated to 'keyword tokens based on the “Editing / Indenting” prefs, which affects their coloring : https://github.com/racket/gui/blob/0fbbf759d3f244458378a639f653971fdff76668/gui-lib/framework/private/racket.rkt#L1376-L1431

gfbee avatar May 12 '20 05:05 gfbee

This issue has been mentioned on Racket Discourse. There might be relevant details there:

https://racket.discourse.group/t/dsl-coloring-question/3970/2