All rules (combinations of RE describing tt(Pattern) objects and associated
action blocks) are accessible from the tt(Rules) object. The tt(Rules) object
contains a reference to the em(states) (see link(here)(STATES)), and a vector
tt(d_rules) containing the information about each of the rules, and a hash
table linking a final state index back to its rule number (see figure
ref(RULESFIG))

            figure(images/rules)(The Rules class)(RULESFIG)

When the parser has recognized a rule it calls tt(Rules::add). A tt(Rule)
object is added to tt(d_rules), storing begin and end state indices, a flag
indicating whether or not this rule's RE started at BOL. A rule also contains
the code of any action block that's associated with it (empty if there are no
actions), see also section ref(BLOCKS).

tt(Rules::add) also stores the association between the rule's final state and
rule index in its tt(unordered_map d_finalToRule). Furthermore, it calls
tt(d_startConditions.add(ruleIdx)) to store the rule index at the currently
active start conditions. See section ref(STARTCOND) for the class
tt(StartConditions). 

States of rules using the LOP need access to the rule to which they
belong. For those rules tt(Rules::setRuleIndices) is called to assign the
link(State's)(STATE) tt(d_rule) field. 

label(RULE)
The tt(Rule) object themselves have an organization shown in figure
ref(RULEFIG). 

Rules starting with tt(^) can only be matched at em(begin-of-line)
(BOL). The data member tt(d_bol) of such rules is set to tt(true).

Rules that are matched in some DFA state are em(viable): such rules can be
matched. See section ref(VIABLE) for a description of the algorithm that is
used for finding (non)viable rules.

            figure(images/rule)(The Rule class data members)(RULEFIG)








