A rule set is a group of rules that may match, filter, and execute actions to process data received from an adapter’s front end.
An ASL rule consists of blocks of patterns, filters, and actions. Patterns select the data to process by applying a pattern matching to the incoming datastream. Filters control whether actions are performed on matched data. Actions process the data.
An ASL rule has the basic form:
<RULE-NAME> { <pattern-list> } filter { <filter-list> } do { <action-list> }
Rules begin with a rule name. A rule name must consist of alphanumeric characters and/or an underscore (_). The first character of a rule cannot be a number.
In this guide, by convention, no rule names contain lowercase letters.
Pattern, filter, and action blocks comprise the contents of a rule. None of the blocks are required.
Certain ASL words are reserved and should not be used, as described in “Reserved words” on page 149.
Braces surround the pattern list and demarcate the pattern block. A pattern block can contain one or more action blocks, but cannot contain any filter blocks. For actions performed before any pattern matching, an action block can be included inside of the pattern block before any pattern matching statements.
The word “filter” followed by a brace ( { ) marks the beginning of a filter block. Another brace ( } ) marks the end. A rule can contain no more than one filter block, and that block must appear after the pattern block.
The word “do” followed by a brace ( { ) marks the beginning of an action block. Another brace ( } ) marks the end. A rule can contain multiple action blocks placed inside a pattern block or outside of a pattern block. However, only one action block can appear outside of a pattern block.
In this example, the following rule associates a specific pattern with a specific action:
<RULE-NAME> { <pattern-list> do {<action-list>} <pattern-list> do {<action-list>} <pattern-list> do {<action-list>} }
The pattern block shown in the example encompasses all of the patterns and all of the action blocks. In order to add a filter block, the brace marking the end of the pattern block has to follow the last pattern list. Filter information can be added before the last action block.
<RULE-NAME> { <pattern-list> do {<action-list>} <pattern-list> do {<action-list>} <pattern-list> } filter {<filter-list>} do {<action-list>}
Rules can be called from other rules or in an action block. Rules cannot be called from a filter.
<RULE-NAME> { <OTHER-RULE> } filter { <filter-list> } do { <action-list> }
Patterns and called rules can be interspersed with action blocks.
<RULE-NAME> { <pattern-list> do {<action-list>} <OTHER-RULE> }
Rules referenced by other rules are considered subordinate to the rule that references them. The rule that references a subordinate rule is referred to as superior. The flow of control of ASL processing passes from superior rules to subordinate rules and back.