# disjunctive_substitution function library

Dependencies: alter_script, lib_2da, lib_anon, lib_array, lib_fn, lib_ini, lib_sfo, lib_sugar, lib_tools, lib_ui

Functions used which are flagged as internal: ALTER_SCRIPT_BLOCK

## Description

This contains the single 'disjunctive_substitution' function, which does substitution into BCS and DLG blocks without breaking Boolean logic.

## Public functions

disjunctive_substitution(telemetry:b, script:s, dialog:s, match:s, replace:s, exclude_array_script:s="NO_ARRAY", exclude_array_dialog:s="NO_ARRAY")=() action

For each bcs in the space-separated list 'script', and each dlg in the space-separated list 'dialog', swap 'match' for 'replace', keeping to the rules of Boolean algebra.

The syntax for 'replace' is either "OR()line1|line2|..." or "line1|line2|...".

If 'script'='all', process all scripts except those listed in 'exclude_array_script'; likewise for dialogs.

Set telemetry=1 to get some debugging information.

## Internal functions

These should not be called from outside the library itself.

disjunctive_eliminate_logic_redundancies(line:s)=(output:s) patch

disjunctive_get_trigger_array()=(rest_of_block:s, trigger_array:a) patch

disjunctive_substitute_helper(line:s)=(found_match:s, array_is_or:s, array_length:s, swapped_array:a) patch

disjunctive_substitution_bcs(telemetry:b, script:s, match:s, replace:s, exclude_array:s="NO_ARRAY")=() action

disjunctive_substitution_bcs_helper()=() patch

disjunctive_substitution_core(trigger_array:s)=(output:s) patch

disjunctive_substitution_dlg(telemetry:b, dialog:s, match:s, replace:s, exclude_array:s="NO_ARRAY")=() action

disjunctive_substitution_dlg_helper()=() patch

parse_disjunctive_match_input(replace:s)=(swap_is_or:s, replace_array:a) action