|
Group Nodes
The group nodes all aim to provide a method for grouping scheme nodes allowed to exist in the context of a group. Main principle of these group nodes is to simplify colouring schemes. Typically languages that suit hilighting will have classes of keywords or operators, each of which will require a common colouring scheme. When a scheme node exists in the context of a syntax node parent, each of it's peers may potentially possess a unique colour scheme. When in a group, all scheme nodes will exhibit the same colour scheme. The actual colour scheme may be modified using the group node or any of the child scheme nodes. Any such change will affect the color scheme of all the group children.
For convenience group nodes may all have a descriptive name which need not be unique. It is suggested that the name chosen reflect some meaningful description of the group contained.
Special Group Node
- - Scope Group
The scope group is a special group that provides different functionality from the other group nodes. Unlike all of the other group nodes which do not have start/end character sequences of their own, the scope group actually uses both sequences to demarcate a region of distinct language scope. This demarcation works like the multiline comment scheme, except that the colour scheme used for the start/end sequences is different from the content of the scope group. Inside the scope group, a default scheme is mandatory, and a different set of keywords, comments and such may be specified in a similar manner to a syntax type.
A scope group cannot yet implement it's own multiline comments, nor may it implement other child scope groups. Scope groups can be useful in two ways.
Firstly, the case of an embedded scripting language is an obvious candidate for such treatment. Osmium ships with an HTML syntax format which embeds PHP into an HTML document, and it is a useful demonstration of such an embedding capability. This HTML format also demonstrates the other use of scope groups.
Typically it can be difficult to separate some keywords and operators, and constraining keywords and operators to the scope of an HTML tag declaration solves this problem. In addition languages that have many keywords can become slow to process for syntax hilighting. Constraining keywords by scope group reduces the size of the search set, and can dramatically improve performance.
Other Group Nodes
- - Operator Group
The operator group provides a scheme for grouping operator scheme nodes where all of the scheme nodes share a common colour scheme. The operator group may have as many or as few operator scheme nodes as is required, but it may only parent operator scheme nodes.
- - Line Bracket Group
The line bracket group provides a scheme for grouping line bracket scheme nodes where all of the scheme nodes share a common colour scheme. The line bracket group may have as many or as few line bracket scheme nodes as is required, but it may only parent line bracket scheme nodes.
- - Line Comment Group
The line comment group provides a scheme for grouping line comment scheme nodes where all of the scheme nodes share a common colour scheme. The line comment group may have as many or as few line comment scheme nodes as is required, but it may only parent line comment scheme nodes.
- - Keyword Group
The keyword group provides a scheme for grouping keyword scheme nodes where all of the scheme nodes share a common colour scheme. The keyword group may have as many or as few keyword scheme nodes as is required, but it may only parent keyword scheme nodes.
|