-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite_repeat, used for rewriting nested repeats contained a comment that said repeats can only be combined if the range of the result is not more than the sum of the ranges of the inputs, but the assertion actually tested the opposite: it tested that the range of the result is more than the sum of the ranges of the inputs. This assertion does not universally hold either way: a{2}{2} can be rewritten to a{4}, but the range as calculated of the latter (0) is equal to the sum of the ranges of the inputs (also 0). Separate from the assert, the rewrite was not performed in some cases where it is valid to do so. It is valid whenever the inner repeat has a lower bound of 0 or 1, whenever the inner repeat has no upper bound and the outer repeat has a positive lower bound, and whenever the outer range has a lower bound equal to the upper bound. The last case was missing. An example is a{2,3}{2}, which would previously be preserved in that form, but is now rewritten as a{4,6}.
- Loading branch information
Showing
3 changed files
with
31 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
^a{2}{2}$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
0 -> 1 'a'; | ||
1 -> 2 'a'; | ||
2 -> 3 'a'; | ||
3 -> 4 'a'; | ||
|
||
start: 0; | ||
end: 4; |