Skip to content

Commit

Permalink
mention jump positions in section for WITH rules
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-martian committed May 30, 2023
1 parent 9d14e1b commit 24840f1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions manual/rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@
<primary>WITH</primary>
</indexterm>
<screen>
WITH &lt;target&lt; [contextual_tests] { [rules] } ;
WITH &lt;target&gt; [contextual_tests] { [rules] } ;
</screen>
<para>
Matches a pattern and runs a list of rules on the matched cohort only.
Expand All @@ -643,7 +643,7 @@
SETPARENT (det def) TO (1* (n)) ;
</screen>
<para>
Additionally, WITH creates magic sets _C1_ through _C9_ referring to the cohorts matched by the outer contextual tests. If _MARK_ is set, it will also be accessible to the inner rules.
Additionally, WITH creates magic sets _C1_ through _C9_ referring to the cohorts matched by the outer contextual tests. If _MARK_ is set, it will also be accessible to the inner rules. These sets are also accessible with the jump contextual positions jC1 through jC9 and jM.
</para>
<screen>
# the following input
Expand All @@ -666,6 +666,12 @@
"silly" adj #2-&gt;3
"&lt;example&gt;"
"example" n sg #3-&gt;3

# this rule is approximately equivalent
WITH (n) IF (-1 (adj)) (-2 (det def)) {
SETCHILD (*) TO (jC1 (*)) (NOT p (*)) ;
SETCHILD (*) TO (jC2 (*)) (NOT p (*)) ;
} ;
</screen>
<para>
Note that rules inside WITH are only run once each time WITH is run, unless they have REPEAT, and thus without REPEAT, the rule above would otherwise attach only the adjective.
Expand Down

0 comments on commit 24840f1

Please sign in to comment.