| 1 |
In the rules files (grammar, inc/*) support rules start with an _, and are |
| 2 |
only used in the file in which they are defined. |
| 3 |
|
| 4 |
An action block equal to an '|' character applies the final action block to |
| 5 |
each of the rules. Other than that, the / operator has the lowest priority, |
| 6 |
so once we've seen a rule having a / operator it can be handled as such. For / |
| 7 |
rules the action always becomes: |
| 8 |
1. define an internal start condition |
| 9 |
2. match the concatenated a/b -> ab rule |
| 10 |
3. start the internal start condition, matching b on successively |
| 11 |
longer tails of the matched text |
| 12 |
4. match a on the head preceding the tail that first matched b |
| 13 |
5. push-back the tail beyond the text matching a |
| 14 |
6. execute the actions associated with the / rule. |
| 15 |
|
| 16 |
|
| 17 |
The / patterns are recognized in regexoreof, which is called from mscompound |
| 18 |
and optmsrule. |
| 19 |
|
| 20 |
An mscompound or optmsrule either encounters one rule, or multiple rules, |
| 21 |
combined by | operators at the end of lines. Single rules are handled by |
| 22 |
Parser::addRule, which are combined when an end-of-line | operator is |
| 23 |
encountered by by Parser::orAction. |
| 24 |
|
| 25 |
Since we don't know what the action blocks are once we've seen a / rule, the |
| 26 |
lhs and rhs patterns of /-rules are stored within the rules using the /, as |
| 27 |
they are required later. |
| 28 |
|
| 29 |
Parser::orAction merely flags an or-action for the last rule but one, no |
| 30 |
further actions are required with /-rules. Parser::addRule receives, in |
| 31 |
addition to its standard stuff, also the d_useLOP flag, and d_lhs and d_rhs, |
| 32 |
which are only used when the /-operator was actually used. |
| 33 |
|
| 34 |
Following the orAction or single addRule call, either an action block follows |
| 35 |
(handled by parser::assignBlock), or the rules are without actions (handled by |
| 36 |
Parser::noActions). |
| 37 |
|
| 38 |
Parser::noActions calls d_rules.noActions -> to be investigated |
| 39 |
Parser::assignBlock calls d_rules.assignBlock -> to be investigated |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
Other rules are defined in files having names equal to the (lowercase, w/o |
| 44 |
underscores) name of the rule. |
| 45 |
|
| 46 |
|
| 47 |
Rules are parsed by inc/rules. Each rule consists of an |
| 48 |
optional MS-rule (optMs_rule) |
| 49 |
or a |
| 50 |
msCompound (ms rules in a compound block) |
| 51 |
|
| 52 |
An optMS_rule may be a plain rule (without action) or a rule + action |
| 53 |
|