Function removeDeadBranches

  • This removes dead branches in the AST.

    Dead branches are parts of the regex that can never accept on any given input string (e.g. []a|b => b).

    This operation may produce parent nodes with 0 alternatives. Quantifiers with 0 alternatives and a minimum of 0 will be replaced with the empty concatenation (e.g. a(?:[]b)?c => ac).


    This transformer should be used in combination with inline to handle trivial simplifications.

    Parameters

    Returns Transformer