$rulenum

Purpose

Fetch the current rule number that code is being executed in.

Syntax

returnedString = variableType("$rulenum")

returnedString - type: integer
variableType - type: G
 

Returns

Current rule number within the current pass of the analyzer.

Remarks

 With $passnum, yields the pass and rule number.  $rulenum is unique in the current pass, but not across the passes of the analyzer.  In each pass, rule numbering is 1, 2, 3 ...

Example

 

@POST

# Print current pass number and rule number.

"output.txt" <<  G("$passnum") << ", " << G("$rulenum") << "\n";

@RULES

_xNIL <- _clause @@

 

When this rule matches, output.txt contains lines such as

33, 1

See Also

$passnum, Special Variables