@@ -132,30 +132,10 @@ public void generatedTests() {
132
132
expectSyntaxError ("x{4294967296}" , "" , "x{4294967296}" , 0 , ErrorCode .InvalidQuantifier );
133
133
expectSyntaxError ("x{4294967297}" , "" , "x{4294967297}" , 0 , ErrorCode .InvalidQuantifier );
134
134
test ("x??" , "" , "x" , 0 , true , 0 , 0 );
135
- expectSyntaxError ("x{2}+" , "" , "x" , 0 , ErrorCode .InvalidQuantifier );
136
- expectSyntaxError ("x{2}+" , "" , "xx" , 0 , ErrorCode .InvalidQuantifier );
137
- expectSyntaxError ("x{2}+" , "" , "xxx" , 0 , ErrorCode .InvalidQuantifier );
138
- expectSyntaxError ("x{2}+" , "" , "xxxx" , 0 , ErrorCode .InvalidQuantifier );
139
- expectSyntaxError ("x{2}*" , "" , "xxxx" , 0 , ErrorCode .InvalidQuantifier );
140
- expectSyntaxError ("x{2}*?" , "" , "xxxx" , 0 , ErrorCode .InvalidQuantifier );
141
- expectSyntaxError ("x{2}*???" , "" , "xxxx" , 0 , ErrorCode .InvalidQuantifier );
142
135
test ("\\ A*x\\ Z+" , "" , "x" , 0 , true , 0 , 1 );
143
136
test ("\\ A*x\\ Z+" , "" , "xx" , 0 , true , 1 , 2 );
144
137
test ("\\ A+x\\ Z+" , "" , "xx" , 0 , false );
145
- expectSyntaxError ("x????" , "" , "x?" , 0 , ErrorCode .InvalidQuantifier );
146
- expectSyntaxError ("x????" , "" , "xx?" , 0 , ErrorCode .InvalidQuantifier );
147
- expectSyntaxError ("x??????" , "" , "x?" , 0 , ErrorCode .InvalidQuantifier );
148
- expectSyntaxError ("x??????" , "" , "xx?" , 0 , ErrorCode .InvalidQuantifier );
149
138
test ("x{2}?" , "" , "xxxxx" , 0 , true , 0 , 2 );
150
- expectSyntaxError ("x{2}??" , "" , "xxxxx" , 0 , ErrorCode .InvalidQuantifier );
151
- expectSyntaxError ("x{2}+" , "" , "xxxxx" , 0 , ErrorCode .InvalidQuantifier );
152
- expectSyntaxError ("x{2}*" , "" , "xxxxx" , 0 , ErrorCode .InvalidQuantifier );
153
- expectSyntaxError ("x???" , "" , "x" , 0 , ErrorCode .InvalidQuantifier );
154
- expectSyntaxError ("x{2}*??" , "" , "xxxx" , 0 , ErrorCode .InvalidQuantifier );
155
- expectSyntaxError ("x???" , "" , "x?" , 0 , ErrorCode .InvalidQuantifier );
156
- expectSyntaxError ("x???" , "" , "xx?" , 0 , ErrorCode .InvalidQuantifier );
157
- expectSyntaxError ("x?????" , "" , "x?" , 0 , ErrorCode .InvalidQuantifier );
158
- expectSyntaxError ("x?????" , "" , "xx?" , 0 , ErrorCode .InvalidQuantifier );
159
139
test ("(a{0,1})*b\\ 1" , "" , "aab" , 0 , true , 0 , 3 , 2 , 2 );
160
140
test ("(a{0,1})*b\\ 1" , "" , "aaba" , 0 , true , 0 , 3 , 2 , 2 );
161
141
test ("(a{0,1})*b\\ 1" , "" , "aabaa" , 0 , true , 0 , 3 , 2 , 2 );
@@ -994,7 +974,6 @@ public void generatedTests() {
994
974
test ("a(()|()|b|()|())*c" , "" , "abbc" , 0 , true , 0 , 4 , 3 , 3 , 3 , 3 , -1 , -1 , -1 , -1 , -1 , -1 );
995
975
test ("a(()|()|()|b|())*c" , "" , "abbc" , 0 , true , 0 , 4 , 3 , 3 , 3 , 3 , -1 , -1 , -1 , -1 , -1 , -1 );
996
976
test ("a(()|()|()|()|b)*c" , "" , "abbc" , 0 , true , 0 , 4 , 3 , 3 , 3 , 3 , -1 , -1 , -1 , -1 , -1 , -1 );
997
- expectSyntaxError ("a??+" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
998
977
test ("()??()??()??()??()??()??()??()??\\ 3\\ 5\\ 7" , "" , "a" , 0 , true , 0 , 0 , -1 , -1 , -1 , -1 , 0 , 0 , -1 , -1 , 0 , 0 , -1 , -1 , 0 , 0 , -1 , -1 );
999
978
test ("()*" , "" , "a" , 0 , true , 0 , 0 , 0 , 0 );
1000
979
test ("(a|)*" , "" , "a" , 0 , true , 0 , 1 , 1 , 1 );
@@ -1017,24 +996,11 @@ public void generatedTests() {
1017
996
expectSyntaxError ("[y-\\ {][y-\\ {]" , "" , "I" , 0 , ErrorCode .InvalidCharacterClass );
1018
997
test ("a?" , "" , "aaa" , 0 , true , 0 , 1 );
1019
998
test ("a??" , "" , "aaa" , 0 , true , 0 , 0 );
1020
- expectSyntaxError ("a???" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1021
999
test ("a+?" , "" , "aaa" , 0 , true , 0 , 1 );
1022
- expectSyntaxError ("a+??" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1023
- expectSyntaxError ("a??+" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1024
- expectSyntaxError ("a?+" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1025
- expectSyntaxError ("a?+?" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1026
- expectSyntaxError ("a?+??" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1027
- expectSyntaxError ("a?*??" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1028
- expectSyntaxError ("(a?)*??" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1029
1000
test ("((a?)*)??" , "" , "aaa" , 0 , true , 0 , 0 , -1 , -1 , -1 , -1 );
1030
1001
test ("((a?)*?)?" , "" , "aaa" , 0 , true , 0 , 0 , 0 , 0 , -1 , -1 );
1031
- expectSyntaxError ("a?*?" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1032
- expectSyntaxError ("a*??" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1033
- expectSyntaxError ("a+*?" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1034
1002
test ("(a+)*?" , "" , "aaa" , 0 , true , 0 , 0 , -1 , -1 );
1035
1003
test ("((a+)*)?" , "" , "aaa" , 0 , true , 0 , 3 , 0 , 3 , 0 , 3 );
1036
- expectSyntaxError ("a+*??" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1037
- expectSyntaxError ("a++?" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1038
1004
expectSyntaxError ("[[.\\ a.]]" , "" , "." , 0 , ErrorCode .InvalidCharacterClass );
1039
1005
test ("[[...]]" , "" , "." , 0 , true , 0 , 1 );
1040
1006
test ("[[...]]" , "" , "[" , 0 , false );
@@ -1049,12 +1015,6 @@ public void generatedTests() {
1049
1015
test ("[[...]a]a" , "" , "a" , 0 , false );
1050
1016
test ("[[...]a]?a" , "" , "a" , 0 , true , 0 , 1 );
1051
1017
test ("[[...]a]|a" , "" , "a" , 0 , true , 0 , 1 );
1052
- expectSyntaxError ("a++?" , "" , "aaa" , 0 , ErrorCode .InvalidQuantifier );
1053
- expectSyntaxError ("\\ D|++?" , "" , "9" , 0 , ErrorCode .InvalidQuantifier );
1054
- expectSyntaxError ("\\ D|++?^" , "" , "9" , 0 , ErrorCode .InvalidQuantifier );
1055
- expectSyntaxError ("\\ S|\\ D|++?^(3)" , "" , "9" , 0 , ErrorCode .InvalidQuantifier );
1056
- expectSyntaxError ("\\ S|\\ D|++?^((3)|[R-_\\ (/])t[[:alnum:]]c" , "" , "9" , 0 , ErrorCode .InvalidQuantifier );
1057
- expectSyntaxError ("(\\ d)|5+*?|[[:lower:]][[=l=]]^%" , "" , "\u0169 \u2113 %" , 0 , ErrorCode .InvalidQuantifier );
1058
1018
test ("[[===]]" , "" , "=" , 0 , true , 0 , 1 );
1059
1019
expectSyntaxError ("[[=\\ ==]]" , "" , "=" , 0 , ErrorCode .InvalidCharacterClass );
1060
1020
expectSyntaxError ("[[=\\ ==]]" , "" , "\\ " , 0 , ErrorCode .InvalidCharacterClass );
@@ -1099,23 +1059,12 @@ public void generatedTests() {
1099
1059
test ("\\ [[b-b]" , "" , "[b-b]" , 0 , true , 0 , 2 );
1100
1060
test ("\\ [c-b]" , "" , "[c-b]" , 0 , true , 0 , 5 );
1101
1061
expectSyntaxError ("\\ [[c-b]" , "" , "[c-b]" , 0 , ErrorCode .InvalidCharacterClass );
1102
- expectSyntaxError ("()?*" , "" , "c" , 0 , ErrorCode .InvalidQuantifier );
1103
- expectSyntaxError ("()?*|" , "" , "c" , 0 , ErrorCode .InvalidQuantifier );
1104
- expectSyntaxError ("()?*||" , "" , "c" , 0 , ErrorCode .InvalidQuantifier );
1105
- expectSyntaxError ("()?*||a" , "" , "b" , 0 , ErrorCode .InvalidQuantifier );
1106
- expectSyntaxError ("()?*||^a\\ Zb" , "" , "c" , 0 , ErrorCode .InvalidQuantifier );
1107
1062
test ("ac??bc?" , "" , "abc" , 0 , true , 0 , 3 );
1108
1063
test ("ac??bc?" , "" , "acbc" , 0 , true , 0 , 4 );
1109
1064
test ("a?" , "" , "a" , 0 , true , 0 , 1 );
1110
1065
test ("a??" , "" , "a" , 0 , true , 0 , 0 );
1111
- expectSyntaxError ("a???" , "" , "a" , 0 , ErrorCode .InvalidQuantifier );
1112
- expectSyntaxError ("(a)???" , "" , "a" , 0 , ErrorCode .InvalidQuantifier );
1113
1066
test ("(a?)??" , "" , "a" , 0 , true , 0 , 0 , -1 , -1 );
1114
1067
test ("(a??)?" , "" , "a" , 0 , true , 0 , 0 , 0 , 0 );
1115
- expectSyntaxError ("(a???)" , "" , "a" , 0 , ErrorCode .InvalidQuantifier );
1116
- expectSyntaxError ("a{0,1}??" , "" , "a" , 0 , ErrorCode .InvalidQuantifier );
1117
- expectSyntaxError ("a??{0,1}" , "" , "a" , 0 , ErrorCode .InvalidQuantifier );
1118
- expectSyntaxError ("a{0,1}?{0,1}" , "" , "a" , 0 , ErrorCode .InvalidQuantifier );
1119
1068
test ("(a{0,1})*" , "" , "aaaaaa" , 0 , true , 0 , 6 , 6 , 6 );
1120
1069
test ("(a{0,2})*" , "" , "aaaaaa" , 0 , true , 0 , 6 , 6 , 6 );
1121
1070
test ("(a{1,2})*" , "" , "aaaaaa" , 0 , true , 0 , 6 , 4 , 6 );
@@ -1665,6 +1614,8 @@ public void generatedTests() {
1665
1614
test ("(e?\\ D[xg]){87,87}z" , "" ,
1666
1615
"axaxeageagageaxeaxeaxageaxagageaxeaxagageagaxaxeagaxeaxagagaxeagageaxeaxeagageaxeaxagaxaxaxageageagageagaxaxaxageaxageaxeageaxaxaxaxaxagaxagageaxeageageageaxeaxeaxageaxaxeaxeagaxagageaxeageaxeaxaxeaxageaxaxeagaxageageaz" ,
1667
1616
0 , false );
1617
+ test ("((b\\ 2{1400,1400})+|)*a" , "" , "a" , 0 , true , 0 , 1 , 0 , 0 , -1 , -1 );
1618
+ test ("\\ S(\\ w?\\ W){8,9}\\ Z" , "" , "-a--------- ---------" , 0 , true , 13 , 22 , 21 , 22 );
1668
1619
test ("(a{1100,1100})\\ 1" , "i" , "a" .repeat (2400 ), 0 , true , 0 , 2200 , 0 , 1100 );
1669
1620
test ("[a]\\ S{213,213}bcdz" , "" , "a" .repeat (215 ) + ("bcxd" + "a" .repeat (213 )).repeat (3 ), 0 , false );
1670
1621
@@ -1700,4 +1651,52 @@ public void orcl38190286() {
1700
1651
test ("[[:alpha:]]" , "" , Collections .emptyMap (), Encodings .UTF_16 , "\uDDF2 " , 0 , false );
1701
1652
test ("[[:alpha:]]" , "" , Collections .emptyMap (), Encodings .UTF_16 , "\uD839 \uDDF2 " , 0 , false );
1702
1653
}
1654
+
1655
+ @ Test
1656
+ public void bqTransitionExplosion () {
1657
+ test ("(a(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b(b|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|){2,2}c)de" , "" , Map .of ("regexDummyLang.QuantifierUnrollLimitGroup" , "1" ),
1658
+ "abbbbbbbcdebbbbbbbf" , 0 , true , 0 , 11 , 0 , 9 , 8 , 8 , 2 , 8 , 3 , 8 , 4 , 8 , 5 , 8 , 6 , 8 , 7 , 8 , 8 , 8 );
1659
+ }
1660
+
1661
+ @ Test
1662
+ public void testNestedQuantifierBailout () {
1663
+ expectUnsupported ("()?*" );
1664
+ expectUnsupported ("()?*|" );
1665
+ expectUnsupported ("()?*||" );
1666
+ expectUnsupported ("()?*||a" );
1667
+ expectUnsupported ("(a)???" );
1668
+ expectUnsupported ("(a?)*??" );
1669
+ expectUnsupported ("(a???)" );
1670
+ expectUnsupported ("a*??" );
1671
+ expectUnsupported ("a+*?" );
1672
+ expectUnsupported ("a+*??" );
1673
+ expectUnsupported ("a++?" );
1674
+ expectUnsupported ("a+??" );
1675
+ expectUnsupported ("a?*?" );
1676
+ expectUnsupported ("a?*??" );
1677
+ expectUnsupported ("a?+" );
1678
+ expectUnsupported ("a?+?" );
1679
+ expectUnsupported ("a?+??" );
1680
+ expectUnsupported ("a??+" );
1681
+ expectUnsupported ("a???" );
1682
+ expectUnsupported ("a??{0,1}" );
1683
+ expectUnsupported ("a{0,1}??" );
1684
+ expectUnsupported ("a{0,1}?{0,1}" );
1685
+ expectUnsupported ("()?*||^a\\ Zb" );
1686
+ expectUnsupported ("\\ D|++?" );
1687
+ expectUnsupported ("\\ D|++?^" );
1688
+ expectUnsupported ("(\\ d)|5+*?|[[:lower:]][[=l=]]^%" );
1689
+ expectUnsupported ("\\ S|\\ D|++?^(3)" );
1690
+ expectUnsupported ("\\ S|\\ D|++?^((3)|[R-_\\ (/])t[[:alnum:]]c" );
1691
+ expectUnsupported ("x???" );
1692
+ expectUnsupported ("x????" );
1693
+ expectUnsupported ("x?????" );
1694
+ expectUnsupported ("x??????" );
1695
+ expectUnsupported ("x{2}*" );
1696
+ expectUnsupported ("x{2}*?" );
1697
+ expectUnsupported ("x{2}*??" );
1698
+ expectUnsupported ("x{2}*???" );
1699
+ expectUnsupported ("x{2}+" );
1700
+ expectUnsupported ("x{2}??" );
1701
+ }
1703
1702
}
0 commit comments