[go: up one dir, main page]

PatternFinder right-side reduction fails

PatternFinder fails to reduce expressions from the right when the matching literal suffix is shorter than the literal itself.

For example:

..go5, ..go6

Assume that '..' is some complex expression

The algorithm will find 'go' and reduce the expressions to (..5)go, (..6)go.

This is incorrect.

The result must be (..)go(5|6)

Test case

yield return new object[]
{
  new []
  {
    "Azero1go5",
    "Azero1go6",
    "Azero2go5",
    "Azero2go6",
    "Azero3go5",
    "Azero3go6",
    "Bzero1go5",
    "Bzero1go6",
    "Bzero2go5",
    "Bzero2go6",
    "Bzero3go5",
    "Bzero3go6",
    "Czero1go5",
    "Czero1go6",
    "Czero2go5",
    "Czero2go6",
    "Czero3go5",
    "Czero3go6",
  }
};