Questions about usage of the system and tools

Reserved words

Postby smalltalker89 » 30. Nov 2009, 23:08

Do reserved words appear in different colors in Smalltalk/X :?:
(I mean if there is an option to do it instead of the usual display...)
Posts: 3
Joined: 27. Nov 2009, 14:17

Re: Reserved words

Postby cgittinger » 1. Dec 2009, 12:17

there are not too many reserved words; however, there is some heuristic built into the SyntaxHighlighter to optionally use a different color for message selectors which are "know to be control flow messages" - i.e. if, while, for etc.

To see the effect, first choose a syntax highlighting style which actually defines different colors (in the Launcher's "system"->"settings" dialog, navigate to "tools"->"syntax color", select for example "green comments, blue controlFlow" and press the "Reset to" button.

Probably, that is already the style you had in your mind.

You can play around with individual syntax elements in this dialog (play with the "element", "color" and "emphasis" fields).

If you want to add more to this and want to change the algorithm or the set of selectors which are treated as control messages, take a look at the SyntaxHighlighter class, and especially its "controlFlowSelectors" method. If you need more of this, take a look at the sender of this method, and change the code there as you like.

If you want such code changes to be cross-image persistent, file them out into a subdirectory named "userPatches" below the "projects/smalltalk" directory (i.e. below where the executable is located).
Any file there will be read at cold-start time (i.e. when started without a snapshot image).

Posts: 61
Joined: 12. Nov 2008, 17:05

Return to General Help

Users browsing this forum: No registered users and 3 guests

Design by GB