Macro Language Reference > Macros > Window > wsh
  
wsh
Description
Defines the syntax highlighting system for the Stream Editor.
 
Example 342. Example of the Syntax Highlighting System for the Stream Editor
Below is a simple example taken from wsh.3ad:
wsh class "ic" "ic_text" ".ic"
wsh colour "ic_text" black
wsh colour "ic_keyword" blue
wsh colour "ic_string" {55,25,0}
wsh state "ic_text" "ic_text"
wsh state "ic_string" "ic_string"
wsh trans "ic_text" swords 1011 colour "ic_keyword"
wsh trans "ic_text" char """" colour 1 statepush "ic_string"
wsh trans "ic_string" string """"""
wsh trans "ic_string" char """" colour 0 statepop
Syntax
wsh keyword:keyw+
keyword
One of the defined configurable syntax highlighting keywords and its relevant parameters. See associated keywords for further information.
Additional Information
The ssh.3ad file in the PTC ALD directory controls the coloring of text in the Stream Editor. In this way, the ssh.3ad file is the syntax highlighting system's .ini file.
The default setup for the syntax highlighting system is defined in the system file ssh.3ad which is loaded at startup. Using the wsh macro and associated keywords it is possible to modify the ssh.3ad file to provide your own customized syntax highlighting. An example of a syntax highlighting state is within an XML tag. The syntax highlighting system examines the input text stream with states and their associated color handle defined for each particular context.
The color aliases are simply a name and color pair. This gives a way of indirectly referring to a particular color. Different types of input stream can have different syntax highlighting associated with them by defining classes for each sort. Each class specifies a starting state. The text can be matched in a variety of ways such as whole words, raw text, characters and character codes. Each state has a separate of transitions performing one of these types of match. These transitions can optionally specify a color for the matched text and can also optionally specify a new state to enter (a stack of states is maintained - allowing for 'nested matching'). This allows for a powerful method of configuring the desired colorization.