The IMPORT
tag, which must be placed inside a
RULES
tag, loads all rules defined in a given ruleset
into the current ruleset; in other words, it has the same effect as
copying and pasting the imported ruleset.
The only required attribute DELEGATE
must be
set to the name of a ruleset. To import a ruleset defined in the current
mode, just specify its name. To import 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
One quirk is that the definition of the imported ruleset is not
copied to the location of the IMPORT
tag, but rather
to the end of the containing ruleset. This has implications with
rule-ordering; see the section called “Rule Ordering Requirements”.
Here is an example from the PHP mode, which extends the inline JavaScript highlighting to support embedded PHP:
<RULES SET="JAVASCRIPT+PHP"> <SPAN TYPE="MARKUP" DELEGATE="php::PHP"> <BEGIN><?php</BEGIN> <END>?></END> </SPAN> <SPAN TYPE="MARKUP" DELEGATE="php::PHP"> <BEGIN><?</BEGIN> <END>?></END> </SPAN> <SPAN TYPE="MARKUP" DELEGATE="php::PHP"> <BEGIN><%=</BEGIN> <END>%></END> </SPAN> <IMPORT DELEGATE="javascript::MAIN"/> </RULES>