proposit-core
    Preparing search index...

    Type Alias TGrammarConfig

    TGrammarConfig: TGrammarOptions & {
        autoNormalize: boolean | TAutoNormalizeConfig;
    }

    Grammar enforcement configuration for expression trees.

    Controls which structural rules are enforced and whether violations are automatically corrected.

    autoNormalize scope: Accepts boolean | TAutoNormalizeConfig.

    • true — enables all automatic normalizations (backward compatible).
    • false — disables all automatic normalizations (backward compatible).
    • TAutoNormalizeConfig — granular control over individual behaviors:
      • wrapInsertFormula: auto-insert formula buffers in addExpression, insertExpression, and wrapExpression.
      • negationInsertFormula: auto-insert a formula buffer when toggleNegation wraps a non-not operator in NOT.
      • collapseDoubleNegation: collapse NOT(NOT(x)) → x during toggleNegation and normalize.
      • collapseEmptyFormula: auto-collapse operators with 0/1 children and formulas whose bounded subtree has no binary operator after removeExpression.
      • repositionOnCollision: auto-redistribute sibling positions when a midpoint collision is detected.
      • absorbSameOperator: when an operator swap via updateExpression produces a same-operator nesting through a formula (e.g., AND → formula → AND), absorb the inner operator's children into the outer operator and remove the formula and inner operator.

    Formula collapse rule: A formula node is only justified if its bounded subtree (stopping at the next nested formula) contains a binary operator (and or or). Formulas wrapping only variables, not chains, or other non-binary subtrees are automatically collapsed when collapseEmptyFormula (or autoNormalize: true) is enabled.

    Type Declaration

    • autoNormalize: boolean | TAutoNormalizeConfig

      When true, auto-fix all violations. When an object, granular control.