The SPAN rule, which must be placed inside a RULES tag, highlights text between a start and end string. The start and end strings are specified inside child elements of the SPAN tag. The following attributes are supported:
TYPE - The token type to highlight the span with. See the section called “Token Types” for a list of token types.
AT_LINE_START - If set to TRUE, the span will only be highlighted if the start sequence occurs at the beginning of a line.
AT_WHITESPACE_END - If set to TRUE, the span will only be highlighted if the start sequence is the first non-whitespace text in the line.
AT_WORD_START - If set to TRUE, the span will only be highlighted if the start sequence occurs at the beginning of a word.
DELEGATE - text inside the span will be highlighted with the specified ruleset. To delegate to a ruleset defined in the current mode, just specify its name. To delegate to a ruleset defined in another mode, specify a name of the form mode::ruleset. Note that the first (unnamed) ruleset in a mode is called “MAIN”.
EXCLUDE_MATCH - If set to TRUE, the start and end sequences will not be highlighted, only the text between them will.
NO_ESCAPE - If set to TRUE, the ruleset's escape character will have no effect before the span's end string. Otherwise, the presence of the escape character will cause that occurrence of the end string to be ignored.
NO_LINE_BREAK - If set to TRUE, the span will not cross line breaks.
NO_WORD_BREAK - If set to TRUE, the span will not cross word breaks.
Note that the AT_LINE_START, AT_WHITESPACE_END and AT_WORD_START attributes can also be used on the BEGIN and END elements. Setting these attributes to the same value on both elements has the same effect as setting them on the SPAN element.
Here is a SPAN that highlights Java string literals, which cannot include line breaks:
<SPAN TYPE="LITERAL1" NO_LINE_BREAK="TRUE"> <BEGIN>"</BEGIN> <END>"</END> </SPAN> |
Here is a SPAN that highlights Java documentation comments by delegating to the “JAVADOC” ruleset defined elsewhere in the current mode:
<SPAN TYPE="COMMENT2" DELEGATE="JAVADOC"> <BEGIN>/**</BEGIN> <END>*/</END> </SPAN> |
Here is a SPAN that highlights HTML cascading stylesheets inside <STYLE> tags by delegating to the main ruleset in the CSS edit mode:
<SPAN TYPE="MARKUP" DELEGATE="css::MAIN"> <BEGIN><style></BEGIN> <END></style></END> </SPAN> |