Break the recursion between seqChild, RegExpTerm and TRegExpSequence

This commit is contained in:
Chris Smowton
2022-03-28 17:05:09 +01:00
committed by Joe Farebrother
parent 0d13864bc8
commit bc17d4b91f

View File

@@ -20,7 +20,11 @@ private newtype TRegExpParent =
/** A sequence term */
TRegExpSequence(Regex re, int start, int end) {
re.sequence(start, end) and
exists(seqChild(re, start, end, 1)) // if a sequence does not have more than one element, it should be treated as that element instead.
// Only create sequence nodes for sequences with two or more children.
exists(int mid |
re.item(start, mid) and
re.item(mid, _)
)
} or
/** An alternation term */
TRegExpAlt(Regex re, int start, int end) {