syntax:labels

This is an old revision of the document!


LABELS

<LABELS>
   <Label group="Sub" match="\<sub[s[]+(\w+)[s]]*(\([^)]*\))" name="\2" descr="\1 \2 \3" image="8" scope="1">
      <Image if="\1" equal="sub" value="8"/>
   </Label>
   <Label group="Class" match="\<\s+class\s+(\w+)\s*" name="\2" descr="Class \2" image="4" scope="1">
      <SubImage if="\1" equal="public" value="1"/>
   </Label>
</LABELS>

Labels give you a way fo quick navigation inside the document with Navigation Bar (can be also called as Function List). It can be as a method or function definition, as include definition. Generally it can be any part of the code you want to refer.
Labels are described with help of regular expression.
HippoEDIT uses BOOST regular expression engine, which use Perl regular expression syntax.
For testing of the label definition I am using RegexLib service.

Group of the label, currently not used, but would be used later for displaying labels in Function List window grouped by label name.

Value: any string

Regular expression describing the label. Expression can be multi line and greedy. You can use sub matches (grouping) for later referring.

Value: any valid regular expression. :!: - obligatory

Any string describing found label. name is displayed in left filtered list in Navigation Bar. You can refer to results of the match using regular expression replace tags as \0 complete match, \1 - first group, \2 second and so on…

Value: any string

Wider description of found label. descr is displayed in right (description) field in Navigation Bar. You can refer to results of the match using regular expression replace tags as \0 complete match, \1 - first group, \2 second and so on…

Value: any string

Additional regular expression for better resolving of the description. Applied to result of the match. If exist, results of descr_match would be used for description back references.

Value: any valid regular expression

Image associated with label. Image is displayed as in left list of Navigation Bar as in right description field.

Value: enumeration from 5 till 20
Default: none=default=0

Sub image associated with label (image drawn on top of main image). Usually used for visualization of label visibility (public, protected, private).

Value: enumeration from 2 till 4
Default: none=default=0

Defines relation of the label to any scope.

  • 0 - not related to scope;
  • 1 - label includes relevant scope start,
  • 2 - scope includes relevant scope end.

If label is related to scope (1|2) HippoEDIT would try to find appropriate scope and associate label with it. Then you would see label description as name of the scope while navigating in Navigation Bar and in Scroll Info Tip.

Value: 0|1|2
Default: 0

If set, then label would be used in Smart Navigate and when Go button pressed in Navigation Bar. For example to navigate to include file or to definition of label.

Value: true|false
Default: true

Indicates, if label shall be shown in description field of Navigation Bar if you place cursor on it in text editor. Works as navigation flag for rest. Can be used if you use label only for highlighting purposes.

Value: true|false
Default: true

Defines image id to be shown on indicator margin in-front of label. Image id corresponds to image number for one of margin icons. Used for example, for displaying scope exits indicators.

Value: [-1..20]
Default: -1

Technical flag, providing additional context for HippoEDIT, to select right logic for label. Can be any from predefined strings. Currently only used for scope exist.

Value: exit_scope|exit_all
Default: nothing

Style id, to be used for syntax highlighting of label contents, when label parsing is done.

Value: one of styles defined in this or parent syntax schema
Default: nothing

Replacement regular expression, used to extract dynamic keyword for syntax highlighting. The result of replacement shall match conditions, used for defining keywords (except of multi word support). Keywords extracted in such way are global, and can be highlighted in all containers which accept style provided in style attribute.

Value: any replacement regular expression
Default: contents of label name

In addition to listed before properties, you can have some overriding of the label properties, depending on regular expression match.

<Skip if="\2" equal="if"/>

If you want to skip some labels depending on result of the match, you can use a Skip condition defined inside of Label node.

if

Regular expression with back references to match which would be compared to equal
Value: some regular expression string with back references to match

equal

String to compare with result of regular expression replace from attribute if
If if equals to equal the label would be skipped.

<Scope if="\2" equal="if"/>

If you want to skip some labels depending on result of the match, you can use a Skip condition defined inside of Label node.

if

Regular expression with back references to match which would be compared to equal
Value: some regular expression string with back references to match

equal

String to compare with result of regular expression replace from attribute if

value

Enumeration value allowed for the label scope attribute.

If if equals to equal the label scope attribute replaced by value defined in attribute value.

<Image if="\1" equal="sub" value="8"/>
<SubImage if="\1" equal="private" value="3"/>
<Marker if="\1" equal="return" value="19"/>

If you want to adopt image or sub_image based on result of label match, you can use Image/SubImage condition defined inside of Label node.

if

Regular expression with back references to match which would be compared to equal

Value: some regular expression string with back references to match

equal

String to compare with result of regular expression replace from attribute if

value

Enumeration value of the image, sub image or marker.

If if equals to equal the label would have image or sub image defined in value.

<Highlight in="\1" all="\w+" style="variable" global="false"/>

If you need some more control of how label can be highlighted or want to define more than one highlighting rule for same label, you can use this condition.

in

Regular expression with back references to extract label part to be highlighted as keyword. If not defined, highlight attribute used for extracting. If highlight attribute is empty, whole matched label text used for processing.

all

Regular expression, which, if defined, applies to in part and used for collecting all matches of all regexp in in attribute to be used as keywords for highlighting.

first

Regular expression, which, if defined, applies to in part and used for collecting first match of first regexp in in attribute to be used as keyword for highlighting.

Style id, which overwrites global style attributes defined for label.

Indicates, that keywords are global, and shall be used in whole document, independent from scope. Currently only true value is supported.

To restrict label for some style, you can also use Containers node inside Label node.

<Containers open="preprocessor"/>