Chapter 9. Rules

Table of Contents

Cheat Sheet
ADD
COPY
DELIMIT
EXTERNAL
ADDCOHORT
COPYCOHORT
REMCOHORT
SPLITCOHORT
MERGECOHORTS
MOVE, SWITCH
REPLACE
APPEND
SUBSTITUTE
SETVARIABLE
REMVARIABLE
MAP
UNMAP
PROTECT
UNPROTECT
SELECT
REMOVE
IFF
RESTORE
Tag Lists Can Be Sets
Named Rules
Flow Control: JUMP, ANCHOR
WITH
Rule Options
NEAREST
ALLOWLOOP
ALLOWCROSS
DELAYED
IMMEDIATE
IGNORED
LOOKDELAYED
LOOKIGNORED
LOOKDELETED
UNMAPLAST
UNSAFE
SAFE
REMEMBERX
RESETX
KEEPORDER
VARYORDER
ENCL_INNER
ENCL_OUTER
ENCL_FINAL
ENCL_ANY
WITHCHILD
NOCHILD
ITERATE
NOITERATE
REVERSE
SUB:N
OUTPUT
REPEAT
NOMAPPED
NOPARENT

Firstly, the CG-2 optional seperation keywords IF and TARGET are completely ignored by VISL CG-3, so only use them for readability. The definitions are given in the following format:

      KEYWORD <required_element> [optional_element] ;
      ...and | separates mutually exclusive choices.
    

Cheat Sheet

All rules can take an optional wordform tag before the rule keyword.

  Reading & Tag manipulations:
      ADD <tags> [BEFORE|AFTER <tags>] <target> [contextual_tests] ;
      MAP <tags> [BEFORE|AFTER <tags>] <target> [contextual_tests] ;
      SUBSTITUTE <locate tags> <replacement tags> <target> [contextual_tests] ;
      UNMAP <target> [contextual_tests] ;

      REPLACE <tags> <target> [contextual_tests] ;
      APPEND <tags> <target> [contextual_tests] ;
      COPY <extra tags> [EXCEPT <except tags>] [BEFORE|AFTER <tags>] <target> [contextual_tests] ;

      SELECT <target> [contextual_tests] ;
      REMOVE <target> [contextual_tests] ;
      IFF <target> [contextual_tests] ;
      RESTORE <restore_target> <target> [contextual_tests] ;

  Dependency manipulation:
      SETPARENT <target> [contextual_tests]
          TO|FROM <contextual_target> [contextual_tests] ;
      SETCHILD <target> [contextual_tests]
          TO|FROM <contextual_target> [contextual_tests] ;

  Relation manipulation:
      ADDRELATION <name> <target> [contextual_tests]
          TO|FROM <contextual_target> [contextual_tests] ;
      ADDRELATIONS <name> <name> <target> [contextual_tests]
          TO|FROM <contextual_target> [contextual_tests] ;
      SETRELATION <name> <target> [contextual_tests]
          TO|FROM <contextual_target> [contextual_tests] ;
      SETRELATIONS <name> <name> <target> [contextual_tests]
          TO|FROM <contextual_target> [contextual_tests] ;
      REMRELATION <name> <target> [contextual_tests]
          TO|FROM <contextual_target> [contextual_tests] ;
      REMRELATIONS <name> <name> <target> [contextual_tests]
          TO|FROM <contextual_target> [contextual_tests] ;

  Cohort manipulation:
      ADDCOHORT <cohort tags> BEFORE|AFTER [WITHCHILD <child_set>|NOCHILD]
          <target> [contextual_tests] ;
      COPYCOHORT <added tags> [EXCEPT <removed tags>] <target> [contextual_tests]
          TO [BEFORE|AFTER] [WITHCHILD <child_set>|NOCHILD] <contextual targets> ;
      COPYCOHORT <added tags> [EXCEPT <removed tags>] [BEFORE|AFTER] [WITHCHILD <child_set>|NOCHILD]
          <target> [contextual_tests] FROM <contextual targets> ;
      REMCOHORT <target> [contextual_tests] ;
      SPLITCOHORT <cohort recipe> <target> [contextual_tests] ;
      MERGECOHORTS <cohort recipe> <target> [contextual_tests] WITH <contextual targets> ;

      MOVE [WITHCHILD <child_set>|NOCHILD] <target> [contextual_tests]
          BEFORE|AFTER [WITHCHILD <child_set>|NOCHILD] <contextual_target> [contextual_tests] ;
      SWITCH <target> [contextual_tests] WITH <contextual_target> [contextual_tests] ;

  Window manipulation:
      DELIMIT <target> [contextual_tests] ;
      EXTERNAL ONCE|ALWAYS <program> <target> [contextual_tests] ;

  Variable manipulation:
      SETVARIABLE [OUTPUT] <name> <value> <target> [contextual_tests] ;
      REMVARIABLE [OUTPUT] <name> <target> [contextual_tests] ;

  Flow control:
      JUMP <anchor_name> <target> [contextual_tests] ;
      WITH <target> [contextual_tests] { [rules] } ;
    

ADD

      [wordform] ADD <tags> <target> [contextual_tests] ;
    

Appends tags to matching readings. Will not block for adding further tags, but can be blocked if a reading is considered mapped either via rule type MAP or from input.

      ADD (@func £other) TARGET (target) IF (-1 KC) ;
    

COPY

      [wordform] COPY <extra tags> [EXCEPT <except tags>] <target> [contextual_tests] ;
    

Duplicates a reading and adds tags to it. If you don't want to copy previously copied readings, you will have to keep track of that yourself by adding a marker tag. Optionally excludes certain tags from the copy.

      COPY (¤copy tags) TARGET (target) - (¤copy) ;
      COPY (¤copy tags) EXCEPT (not these tags) TARGET (target) - (¤copy) ;
    

DELIMIT

      [wordform] DELIMIT <target> [contextual_tests] ;
    

This will work as an on-the-fly sentence (disambiguation window) delimiter. When a reading matches a DELIMIT rule's context it will cut off all subsequent cohorts in the current window immediately restart disambiguating with the new window size. This is not and must not be used as a substitute for the DELIMITERS list, but can be useful for cases where the delimiter has to be decided from context.

EXTERNAL

      [wordform] EXTERNAL ONCE <program> <target> [contextual_tests] ;
      [wordform] EXTERNAL ALWAYS <program> <target> [contextual_tests] ;
    

Opens up a persistent pipe to the program and passes it the current window. The ONCE version will only be run once per window, while ALWAYS will be run every time the rule is seen. See the Externals chapter for technical and protocol information.

      EXTERNAL ONCE /usr/local/bin/waffles (V) (-1 N) ;
      EXTERNAL ALWAYS program-in-path (V) (-1 N) ;
      EXTERNAL ONCE "program with spaces" (V) (-1 N) ;
    

ADDCOHORT

      [wordform] ADDCOHORT <cohort tags> BEFORE|AFTER [WITHCHILD <child_set>|NOCHILD]
          <target> [contextual_tests] ;
    

Inserts a new cohort before or after the target. See also addcohort-attach.

WITHCHILD uses the children of the cohort you're targeting as edges so you can avoid creating cohorts in the middle of another dependency group. If you specify WITHCHILD you will need to provide a set that the children you want to apply must match. The (*) set will match all children.

      ADDCOHORT ("<wordform>" "baseform" tags) BEFORE (@waffles) ;
      ADDCOHORT ("<wordform>" "baseform" tags) AFTER (@waffles) ;
    

COPYCOHORT

      [wordform] COPYCOHORT <added tags> [EXCEPT <removed tags>] <target> [contextual_tests]
          TO [BEFORE|AFTER] [WITHCHILD <child_set>|NOCHILD] <contextual targets> ;
      [wordform] COPYCOHORT <added tags> [EXCEPT <removed tags>] [BEFORE|AFTER] [WITHCHILD <child_set>|NOCHILD]
          <target> [contextual_tests] FROM <contextual targets> ;
    

Copies the current cohort to before or after the contextual target. Or copies a contextual target cohort to before or after the current cohort. The added tags is not optional, but you can specify * to not actually add any tags.

The newly added cohort will be dependency-attached to the nearest cohort towards the target. Relations are not currently copied.

WITHCHILD uses the children of the cohort you're targeting as edges so you can avoid creating cohorts in the middle of another dependency group. If you specify WITHCHILD you will need to provide a set that the children you want to apply must match. The (*) set will match all children.

      CopyCohort (copied) Except (snip) Before WithChild (*) (target) From (1* (from) - (copied)) ;
    

REMCOHORT

      [wordform] REMCOHORT <target> [contextual_tests] ;
    

This will entirely remove a cohort with all its readings from the window. Dependency will be forwarded so that the tree remains intact. Named relations will be deleted.

SPLITCOHORT

      [wordform] SPLITCOHORT <cohort recipe> <target> [contextual_tests] ;
    

Splits a cohort into multiple new cohorts, with a recipe for which of the new cohorts shall inherit tags, dependency, or named relations. The cohorts are listed in any order you want, and you may use regex captures to fill in wordforms and baseforms. You can list as many cohorts as you want.

You can also designate their relative place in the dependency tree with x->y tags, where x must be the sequential number of the new cohorts starting from 1, and y is which new cohort it should link to. Special value c for x may be used to designate that the cohort should inherit all children, and value p for y designates it is the head of the local tree. You may use c->p to give the same cohort both roles. The default is that first cohort is the head and last cohort is the tail, and the new cohorts form a simple chain.

Similarly, you can use tag R:* to designate which cohort should inherit the named relations. If R:* is not listed, the cohort marked c-> will be used. Thus if neither is listed, default is that the last cohort inherits them.

      # Split hyphenated tokens with exactly two parts
      SPLITCOHORT (
        # inherit tags with *, and inherit dependency children with c->2
        "<$1>"v "$1"v tags * tags c->2
        # inherit named relations with R:*, and inherit dependency parents with 2->p
        "<$2>"v "$2"v tags go here R:* 2->p
        ) ("<([^-]+)-([^-]+)>"r other tags) (1* (context)) ;
    

MERGECOHORTS

      [wordform] MERGECOHORTS <cohort recipe> <target> [contextual_tests] WITH <contextual targets> ;
    

Removes the target cohort and all cohorts matched by the contextual targets and inserts a new cohort in the target's position. The removed cohorts need not be sequential. In the cohort recipe, the special tag * will copy all tags from the insert position cohort to that spot.

      # Given input
      "<March>"
        "March" month
      "<2nd>"
        "2nd" ordinal

      # The rule
      MergeCohorts ("<$1 $2>"v "$1 $2"v date) ("<(.+)>"r month) WITH (1 ("<(.+)>"r ordinal)) ;

      # would yield
      "<March 2nd>"
        "March 2nd" date
    

Each contextual target is a contextual test where by default the last matched cohort is the cohort you want removed. In a longer chain, you can override which cohort is to be removed with modifier w such as (1w ("word") LINK 1 (condition on word)). Each contextual target can only contribute 1 cohort for the merge - multiple w in a single test is not possible.

Also, modifier A will override where the insertion is to take place - if set, the insertion happens after the cohort marked as A. Modifier A does not imply w - it is possible to insert in a different position than any removed cohort. A will suppress that contextual target from yielding a cohort, but w can force it.

      WITH examples:
      # Normal, last cohort in the chain, "word", is marked for removal
        (1 ("the") LINK 1 ("word"))

      # Sets the insert position after "the" and requires "word" follows that cohort
      # Does not mark any cohort for removal
        (1A ("the") LINK 1 ("word"))

      # Marks "the" for removal, and merely requires "word" follows that cohort
        (1w ("the") LINK 1 ("word"))

      # Sets the insert position after "the" and requires "word" follows that cohort
      # Also marks "word" for removal
        (1A ("the") LINK 1w ("word"))
    

MergeCohorts does not currently handle dependencies or named relations.

MOVE, SWITCH

      [wordform] MOVE [WITHCHILD <child_set>|NOCHILD] <target> [contextual_tests]
          AFTER [WITHCHILD <child_set>|NOCHILD] <contextual_target> [contextual_tests] ;
      [wordform] MOVE [WITHCHILD <child_set>|NOCHILD] <target> [contextual_tests]
          BEFORE [WITHCHILD <child_set>|NOCHILD] <contextual_target> [contextual_tests] ;
      [wordform] SWITCH <target> [contextual_tests] WITH <contextual_target> [contextual_tests] ;
    

Allows re-arranging of cohorts. The option WITHCHILD will cause the movement of the cohort plus all children of the cohort, maintaining their internal order. Default is NOCHILD which moves only the one cohort. SWITCH does not take options.

If you specify WITHCHILD you will need to provide a set that the children you want to apply must match. The (*) set will match all children.

The first WITHCHILD specifies which children you want moved - the target cohorts. The second WITHCHILD uses the children of the cohort you're moving to as edges so you can avoid moving into another dependency group - the anchor cohorts.

WITHCHILD will match direct children only and then gobble up all descendents of the matched children. If the target cohort is a descendent of the anchor, all target cohorts are removed from the anchor cohorts. Otherwise, the inverse is done. This allows maximal movement while retaining chosen subtree integrity.

REPLACE

      [wordform] REPLACE <tags> <target> [contextual_tests] ;
    

Removes all tags from a reading except the base form, then appends the given tags. Cannot target readings that are considered mapped due to earlier MAP rules or from input.

      REPLACE (<v-act> V INF @func) TARGET (target);
    

APPEND

      [wordform] APPEND <tags> <target> [contextual_tests] ;
    

Appends a reading to the matched cohort, so be sure the tags include a baseform.

      APPEND ("jump" <v-act> V INF @func) TARGET (target);
    

SUBSTITUTE

      [wordform] SUBSTITUTE <locate tags> <replacement tags> <target> [contextual_tests] ;
    

Replaces the tags in the first list with the tags in the second list. If none of the tags in the first list are found, no insertion is done. If only some of the tags are found, the insertion happens at the last removed tag, which may cause tags to be out of your desired order. To prevent this, also have important tags as part of the target. This works as in VISLCG, but the replacement tags may be the * tag to signify a nil replacement, allowing for clean removal of tags in a reading. For example, to remove TAG do:

      SUBSTITUTE (TAG) (*) TARGET (TAG) ;
    

SETVARIABLE

      [wordform] SETVARIABLE [OUTPUT] <name> <value> <target> [contextual_tests] ;
    

Sets a global variable to a given value. If you don't care about the value you can just set it to 1 or *.

If you provide the optional OUTPUT flag, then an equivalent STREAMCMD:SETVAR will be output before the currently active window.

      SETVARIABLE (news) (*) (@headline) ;
      SETVARIABLE (year) (1764) ("Jozef") (-2 ("Arch") LINK 1 ("Duke")) ;
    

REMVARIABLE

      [wordform] REMVARIABLE [OUTPUT] <name> <target> [contextual_tests] ;
    

Unsets a global variable.

If you provide the optional OUTPUT flag, then an equivalent STREAMCMD:REMVAR will be output before the currently active window.

      REMVARIABLE (news) (@stanza) ;
      REMVARIABLE (year) (@timeless) ;
    

MAP

      [wordform] MAP <tags> <target> [contextual_tests] ;
    

Appends tags to matching readings, and blocks other MAP, ADD, and REPLACE rules from targetting those readings. Cannot target readings that are considered mapped due to earlier MAP rules or from input.

      MAP (@func £other) TARGET (target) IF (-1 KC) ;
    

UNMAP

      [wordform] UNMAP <target> [contextual_tests] ;
    

Removes the mapping tag of a reading and lets ADD and MAP target the reading again. By default it will only act if the cohort has exactly one reading, but marking the rule UNSAFE lets it act on multiple readings.

      UNMAP (TAG) ;
      UNMAP UNSAFE (TAG) ;
    

PROTECT

      [wordform] PROTECT <target> [contextual_tests] ;
    

Protects the matched reading from removal and modification. Once protected, no other rule can target the reading, except UNPROTECT.

UNPROTECT

      [wordform] UNPROTECT <target> [contextual_tests] ;
    

Lifts the protection of PROTECT, so that other rules can once again target the reading.

SELECT

      [wordform] SELECT <target> [contextual_tests] ;
    

Deletes all readings in the cohort except the ones matching the target set.

REMOVE

      [wordform] REMOVE <target> [contextual_tests] ;
    

Deletes the readings matching the target set.

IFF

      [wordform] IFF <target> [contextual_tests] ;
    

If the contextual tests are satisfied, select the readings matching the target set. Otherwise, remove the readings matching the target set. This had so little utility that VISLCG did not implement it. We have chosen to implement it in CG-3 because there was no reason to omit it, but admit there are almost no uses for it.

RESTORE

      [wordform] RESTORE [DELAYED|IGNORED] <restore_target> <target> [contextual_tests] ;
    

Restores readings that were previously removed. Only restores the readings matching the restore_target set. If either of the flags DELAYED or IGNORED are enabled, the rule will look in those special buffers for the readings restore. If neither flag, or the IMMEDIATE flag, is enabled, the rule will restore ordinarily remove readings.

      RESTORE (@func) TARGET (target) IF (-1 KC) ;
      RESTORE DELAYED (@func) TARGET (target) IF (-1 KC) ;
      RESTORE IGNORED (@func) TARGET (target) IF (-1 KC) ;
    

Tag Lists Can Be Sets

For the rule types MAP, ADD, REPLACE, APPEND, COPY, SUBSTITUTE, ADDRELATION(S), SETRELATION(S), and REMRELATION(S), the tag lists can be sets instead, including $$sets and &&sets. This is useful for manipulating tags that you want to pull in from a context.

The sets are resolved and reduced to a list of tags during rule application. If the set reduces to multiple tags where only one is required (such as for the Relation rules), only the first tag is used.

      LIST ROLE = <human> <anim> <inanim> (<bench> <table>) ;
      MAP $$ROLE (target tags) (-1 KC) (-2C $$ROLE) ;
    

Named Rules

      [wordform] MAP:rule_name <tag> <target> [contextual_tests] ;
      [wordform] SELECT:rule_name <target> [contextual_tests] ;
    

In certain cases you may want to name a rule to be able to refer to the same rule across grammar revisions, as otherwise the rule line number may change. It is optional to name rules, and names do not have to be unique which makes it easier to group rules for statistics or tracing purposes. The name of a rule is used in tracing and debug output in addition to the line number.

Flow Control: JUMP, ANCHOR

JUMP will allow you to mark named anchors and jump to them based on a context. In this manner you can skip or repeat certain rules.

      ANCHOR <anchor_name> ;
      SECTION [anchor_name ;]
      [wordform] JUMP <anchor_name> <target> [contextual_tests] ;
    

An anchor can be created explicitly with keyword ANCHOR. Sections can optionally be given a name which will make them explicit anchor points. All named rules are also anchor points, but with lower precedence than explicit anchors, and in the case of multiple rules with the same name the first such named rule is the anchor point for that name. There are also two special anchors START and END which represent line 0 and infinity respectively; jumping to START will re-run all currently active rules, while jumping to END will skip all remaining rules.

WITH

      WITH <target> [contextual_tests] { [rules] } ;
    

Matches a pattern and runs a list of rules on the matched cohort only.

      WITH (det def) {
        MAP @det (*) ;
        SETPARENT (*) TO (1* (n)) ;
      } ;

      # is equivalent to

      MAP @det (det def) ;
      SETPARENT (det def) TO (1* (n)) ;
    

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. When using linked tests, the values of these magic sets can be controled with the w contextual specifier.

      # the following input
      "<the>"
        "the" det def
      "<silly>"
        "silly" adj
      "<example>"
        "example" n sg

      # to this rule
      WITH (n) IF (-1 (adj)) (-2 (det def)) {
        SETCHILD REPEAT (*) TO (-1* _C1_ OR _C2_) (NOT p (*)) ;
      } ;

      # would output
      "<the>"
        "the" det def #1->3
      "<silly>"
        "silly" adj #2->3
      "<example>"
        "example" n sg #3->3

      # this rule is approximately equivalent
      WITH (n) IF (-1 (adj)) (-2 (det def)) {
        SETCHILD (*) TO (jC1 (*)) (NOT p (*)) ;
        SETCHILD (*) TO (jC2 (*)) (NOT p (*)) ;
      } ;
    

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.

Rule Options

Rules can have options that affect their behavior. Multiple options can be combined per rule and the order is not important, just separate them with space.

      # Remove readings with (unwanted) even if it is the last reading.
      REMOVE UNSAFE (unwanted) ;

      # Attach daughter to mother, even if doing so would cause a loop.
      SETPARENT ALLOWLOOP (daughter) TO (-1* (mother)) ;
    

NEAREST

Applicable for rules SETPARENT and SETCHILD. Not compatible with option ALLOWLOOP.

Normally, if SETPARENT or SETCHILD cannot attach because doing so would cause a loop, they will seek onwards from that position until a valid target is found that does not cause a loop. Setting NEAREST forces them to stop at the first found candidate.

ALLOWLOOP

Applicable for rules SETPARENT and SETCHILD. Not compatible with option NEAREST.

Normally, SETPARENT and SETCHILD cannot attach if doing so would cause a loop. Setting ALLOWLOOP forces the attachment even in such a case.

ALLOWCROSS

Applicable for rules SETPARENT and SETCHILD.

If command line flag --dep-no-crossing is on, SETPARENT and SETCHILD cannot attach if doing so would cause crossing branches. Setting ALLOWCROSS forces the attachment even in such a case.

DELAYED

Applicable for rules SELECT, REMOVE, RESTORE, and IFF. Not compatible with options IGNORED or IMMEDIATE.

Option DELAYED causes readings that otherwise would have been put in the deleted buffer to be put in a special delayed buffer, in the grey zone between living and dead. Delayed readings are removed at the end of the run.

Delayed readings can be looked at by contextual tests of rules that have option LOOKDELAYED, or if the contextual test has position 'd'.

IMMEDIATE

Applicable for rules SELECT, REMOVE, RESTORE, and IFF. Not compatible with option DELAYED or IGNORED.

Option IMMEDIATE causes readings that otherwise would have been put in the special delayed buffer to be put in the deleted buffer. This is mainly used to selectively override a global DELAYED flag as rules are by default immediate.

IGNORED

Applicable for rules REMOVE and RESTORE. Not compatible with options DELAYED or IMMEDIATE.

Option IGNORED causes readings that otherwise would have been put in the deleted buffer to be put in a special ignored buffer, in the grey zone between living and dead. Unlike delayed readings, ignored readings get restored at the end of the run.

Ignored readings can be looked at by contextual tests of rules that have option LOOKIGNORED, or if the contextual test has position 'I'.

LOOKDELAYED

Applicable for all rules.

Option LOOKDELAYED puts contextual position 'd' on all tests done by that rule, allowing them all to see delayed readings.

LOOKIGNORED

Applicable for all rules.

Option LOOKIGNORED puts contextual position 'I' on all tests done by that rule, allowing them all to see ignored readings.

LOOKDELETED

Applicable for all rules.

Option LOOKDELETED puts contextual position 'D' on all tests done by that rule, allowing them all to see deleted readings.

UNMAPLAST

Applicable for rules REMOVE and IFF. Not compatible with option SAFE.

Normally, REMOVE and IFF will consider mapping tags as separate readings, and attempting to remove the last mapping is the same as removing the last reading which requires UNSAFE. Setting flag UNMAPLAST causes it to instead remove the final mapping tag but leave the reading otherwise untouched.

A rule REMOVE UNMAPLAST @MappingList ; is logically equivalent to REMOVE @MappingList ; UNMAP @MappingList ;

UNSAFE

Regarding mapping, flag is applicable for rules REMOVE and IFF and UNMAP. Regarding dependency, flag is applicable for SETPARENT. Not compatible with option SAFE.

Normally, REMOVE and IFF cannot remove the last reading of a cohort. Setting option UNSAFE allows them to do so.

For UNMAP, marking it UNSAFE allows it to work on more than the last reading in the cohort.

For SETPARENT, UNSAFE counters a global safe-setparent option.

SAFE

Regarding mapping, flag is applicable for rules REMOVE and IFF and UNMAP. Regarding dependency, flag is applicable for SETPARENT. Not compatible with option UNSAFE.

SAFE prevents REMOVE and IFF from removing the last reading of a cohort. Mainly used to selectively override global --unsafe mode.

For UNMAP, marking it SAFE only lets it act if the cohort has exactly one reading.

For SETPARENT, SAFE prevents running if the cohort already has a parent.

REMEMBERX

Applicable for all rules. Not compatible with option RESETX.

Makes the contextual option X carry over to subsequent tests in the rule, as opposed to resetting itself to the rule's target per test. Useful for complex jumps with the X and x options.

RESETX

Applicable for all rules. Not compatible with option REMEMBERX.

Default behavior. Resets the mark for contextual option x to the rule's target on each test. Used to counter a global REMEMBERX.

KEEPORDER

Applicable for all rules. Not compatible with option VARYORDER.

Prevents the re-ordering of contextual tests. Useful in cases where a unifying set is not in the target of the rule.

You almost certainly need KEEPORDER if you use regex capture and varstring in separate contextual tests, or if you use the special baseform or wordform regexes in unification in separate contextual tests.

VARYORDER

Applicable for all rules. Not compatible with option KEEPORDER.

Allows the re-ordering of contextual tests. Used to selectively override a global KEEPORDER flag as test order is by default fluid.

ENCL_INNER

Applicable for all rules. Not compatible with other ENCL_* options.

Rules with ENCL_INNER will only be run inside the currently active parantheses enclosure. If the current window has no enclosures, the rule will not be run.

ENCL_OUTER

Applicable for all rules. Not compatible with other ENCL_* options.

Rules with ENCL_OUTER will only be run outside the currently active parentheses enclosure. Previously expanded enclosures will be seen as outside on subsequent runs. If the current window has no enclosures, the rule will be run as normal.

ENCL_FINAL

Applicable for all rules. Not compatible with other ENCL_* options.

Rules with ENCL_FINAL will only be run once all parentheses enclosures have been expanded. If the current window has no enclosures, the rule will be run as normal.

ENCL_ANY

Applicable for all rules. Not compatible with other ENCL_* options.

The default behavior. Used to counter other glocal ENCL_* flags.

WITHCHILD

Applicable for rule type MOVE. Not compatible with option NOCHILD.

Normally, MOVE only moves a single cohort. Setting option WITHCHILD moves all its children along with it.

NOCHILD

Applicable for rule type MOVE. Not compatible with option WITHCHILD.

If the global option WITHCHILD is on, NOCHILD will turn it off for a single MOVE rule.

ITERATE

Applicable for all rule types. Not compatible with option NOITERATE.

If the rule does anything that changes the state of the window, ITERATE forces a reiteration of the sections. Normally, only changes caused by rule types SELECT, REMOVE, IFF, DELIMIT, REMCOHORT, MOVE, and SWITCH will rerun the sections.

NOITERATE

Applicable for all rule types. Not compatible with option ITERATE.

Even if the rule does change the state of the window, NOITERATE prevents the rule from causing a reiteration of the sections.

REVERSE

Applicable for rule types SETPARENT, SETCHILD, MOVE, SWITCH, ADDRELATION(S), SETRELATION(S), REMRELATION(S).

Reverses the active cohorts. E.g., effectively turns a SETPARENT into a SETCHILD.

OUTPUT

Applicable for rule types SETVARIABLE and REMVARIABLE.

Causes a STREAMCMD to be output for the given action.

REPEAT

Applicable for all rule types.

If the rule does anything that changes the state of the window, REPEAT forces the rule to run through the window again after the current pass. Does not by itself cause a full section reiteration. Useful for making SUBSTITUTE remove all matching tags instead of just one.

NOMAPPED

Applicable for all rule types.

NOMAPPED prevents the rule from running on mapped readings. A reading is considered mapped either via rule type MAP or from input.

NOPARENT

Applicable for all rule types.

NOMAPPED prevents the rule from running on cohorts that have a dependency parent.