fix implementation of ZERO_OR_MORE (Kleene star) in dfa-gen.sml

This commit is contained in:
2025-10-06 14:45:28 +01:00
parent 2779b61c1f
commit 9dd44c8eca
2 changed files with 16 additions and 3400 deletions

View File

@@ -337,9 +337,20 @@ struct
end
else
getFollowsForPositionAndChar (r, pos, curChr)
| ZERO_OR_ONE child =>
getFollowsForPositionAndCharLoop (pos, regex, child, curChr)
| ZERO_OR_MORE child =>
let
val result = getFollowsForPositionAndChar (child, pos, curChr)
val {sawConcat, follows, charIsMatch} = result
in
if charIsMatch then
{ sawConcat = false
, follows = firstpos (child, follows)
, charIsMatch = true
}
else
result
end
| ZERO_OR_ONE child =>
getFollowsForPositionAndCharLoop (pos, regex, child, curChr)
| ONE_OR_MORE child =>
getFollowsForPositionAndCharLoop (pos, regex, child, curChr)

3401
temp.txt

File diff suppressed because it is too large Load Diff