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
.
Note that the first (unnamed) ruleset in a mode is called
“MAIN”.mode
::ruleset
MATCH_TYPE
- Controls how the start and
end of the sequence will be highlighted. See the section called “The MATCH_TYPE Attribute” for more information.
ESCAPE
- specifies a character sequence
for escaping characters. The first character following the escape
sequence is not considered as input for syntax highlighting,
thus being highlighted with rule's token.
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>