@@ -126,30 +126,30 @@ public void generatedTests() {
126
126
expectSyntaxError ("x{4294967296}" , "" , "" , getTRegexEncoding (), "x{4294967296}" , 0 , "invalid interval in regular expression" );
127
127
expectSyntaxError ("x{4294967297}" , "" , "" , getTRegexEncoding (), "x{4294967297}" , 0 , "invalid interval in regular expression" );
128
128
test ("x??" , "" , "x" , 0 , true , 0 , 0 );
129
- test ("x{2}+" , "" , "x" , 0 , false );
130
- test ("x{2}+" , "" , "xx " , 0 , true , 0 , 2 );
131
- test ("x{2}+" , "" , "xxx " , 0 , true , 0 , 2 );
132
- test ("x{2}+" , "" , "xxxx " , 0 , true , 0 , 4 );
133
- test ("x{2}*" , "" , "xxxx " , 0 , true , 0 , 4 );
134
- test ("x{2}*?" , "" , "xxxx " , 0 , true , 0 , 0 );
135
- test ("x{2}*???" , "" , "xxxx " , 0 , true , 0 , 0 );
129
+ expectSyntaxError ("x{2}+" , "" , "" , getTRegexEncoding (), " x" , 0 , "nested quantifier in regular expression" );
130
+ expectSyntaxError ("x{2}+" , "" , "" , getTRegexEncoding (), "xx" , 0 , "nested quantifier in regular expression" );
131
+ expectSyntaxError ("x{2}+" , "" , "" , getTRegexEncoding (), "xxx" , 0 , "nested quantifier in regular expression" );
132
+ expectSyntaxError ("x{2}+" , "" , "" , getTRegexEncoding (), "xxxx" , 0 , "nested quantifier in regular expression" );
133
+ expectSyntaxError ("x{2}*" , "" , "" , getTRegexEncoding (), "xxxx" , 0 , "nested quantifier in regular expression" );
134
+ expectSyntaxError ("x{2}*?" , "" , "" , getTRegexEncoding (), "xxxx" , 0 , "nested quantifier in regular expression" );
135
+ expectSyntaxError ("x{2}*???" , "" , "" , getTRegexEncoding (), "xxxx" , 0 , "nested quantifier in regular expression" );
136
136
test ("\\ A*x\\ Z+" , "" , "x" , 0 , true , 0 , 1 );
137
137
test ("\\ A*x\\ Z+" , "" , "xx" , 0 , true , 1 , 2 );
138
138
test ("\\ A+x\\ Z+" , "" , "xx" , 0 , false );
139
- test ("x????" , "" , "x? " , 0 , true , 0 , 0 );
140
- test ("x????" , "" , "xx? " , 0 , true , 0 , 0 );
141
- test ("x??????" , "" , "x? " , 0 , true , 0 , 0 );
142
- test ("x??????" , "" , "xx? " , 0 , true , 0 , 0 );
139
+ expectSyntaxError ("x????" , "" , "" , getTRegexEncoding (), "x?" , 0 , "nested quantifier in regular expression" );
140
+ expectSyntaxError ("x????" , "" , "" , getTRegexEncoding (), "xx?" , 0 , "nested quantifier in regular expression" );
141
+ expectSyntaxError ("x??????" , "" , "" , getTRegexEncoding (), "x?" , 0 , "nested quantifier in regular expression" );
142
+ expectSyntaxError ("x??????" , "" , "" , getTRegexEncoding (), "xx?" , 0 , "nested quantifier in regular expression" );
143
143
test ("x{2}?" , "" , "xxxxx" , 0 , true , 0 , 2 );
144
- test ("x{2}??" , "" , "xxxxx " , 0 , true , 0 , 2 );
145
- test ("x{2}+" , "" , "xxxxx " , 0 , true , 0 , 4 );
146
- test ("x{2}*" , "" , "xxxxx " , 0 , true , 0 , 4 );
147
- test ("x???" , "" , "x " , 0 , true , 0 , 0 );
148
- test ("x{2}*??" , "" , "xxxx " , 0 , true , 0 , 0 );
149
- test ("x???" , "" , "x? " , 0 , true , 0 , 0 );
150
- test ("x???" , "" , "xx? " , 0 , true , 0 , 0 );
151
- test ("x?????" , "" , "x? " , 0 , true , 0 , 0 );
152
- test ("x?????" , "" , "xx? " , 0 , true , 0 , 0 );
144
+ expectSyntaxError ("x{2}??" , "" , "" , getTRegexEncoding (), "xxxxx" , 0 , "nested quantifier in regular expression" );
145
+ expectSyntaxError ("x{2}+" , "" , "" , getTRegexEncoding (), "xxxxx" , 0 , "nested quantifier in regular expression" );
146
+ expectSyntaxError ("x{2}*" , "" , "" , getTRegexEncoding (), "xxxxx" , 0 , "nested quantifier in regular expression" );
147
+ expectSyntaxError ("x???" , "" , "" , getTRegexEncoding (), "x" , 0 , "nested quantifier in regular expression" );
148
+ expectSyntaxError ("x{2}*??" , "" , "" , getTRegexEncoding (), "xxxx" , 0 , "nested quantifier in regular expression" );
149
+ expectSyntaxError ("x???" , "" , "" , getTRegexEncoding (), "x?" , 0 , "nested quantifier in regular expression" );
150
+ expectSyntaxError ("x???" , "" , "" , getTRegexEncoding (), "xx?" , 0 , "nested quantifier in regular expression" );
151
+ expectSyntaxError ("x?????" , "" , "" , getTRegexEncoding (), "x?" , 0 , "nested quantifier in regular expression" );
152
+ expectSyntaxError ("x?????" , "" , "" , getTRegexEncoding (), "xx?" , 0 , "nested quantifier in regular expression" );
153
153
test ("(a{0,1})*b\\ 1" , "" , "aab" , 0 , true , 0 , 3 , 2 , 2 );
154
154
test ("(a{0,1})*b\\ 1" , "" , "aaba" , 0 , true , 0 , 3 , 2 , 2 );
155
155
test ("(a{0,1})*b\\ 1" , "" , "aabaa" , 0 , true , 0 , 3 , 2 , 2 );
@@ -988,7 +988,7 @@ public void generatedTests() {
988
988
test ("a(()|()|b|()|())*c" , "" , "abbc" , 0 , true , 0 , 4 , 3 , 3 , 3 , 3 , -1 , -1 , -1 , -1 , -1 , -1 );
989
989
test ("a(()|()|()|b|())*c" , "" , "abbc" , 0 , true , 0 , 4 , 3 , 3 , 3 , 3 , -1 , -1 , -1 , -1 , -1 , -1 );
990
990
test ("a(()|()|()|()|b)*c" , "" , "abbc" , 0 , true , 0 , 4 , 3 , 3 , 3 , 3 , -1 , -1 , -1 , -1 , -1 , -1 );
991
- test ("a??+" , "" , "aaa " , 0 , true , 0 , 0 );
991
+ expectSyntaxError ("a??+" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
992
992
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 );
993
993
test ("()*" , "" , "a" , 0 , true , 0 , 0 , 0 , 0 );
994
994
test ("(a|)*" , "" , "a" , 0 , true , 0 , 1 , 1 , 1 );
@@ -1011,24 +1011,24 @@ public void generatedTests() {
1011
1011
expectSyntaxError ("[y-\\ {][y-\\ {]" , "" , "" , getTRegexEncoding (), "I" , 0 , "invalid range in regular expression" );
1012
1012
test ("a?" , "" , "aaa" , 0 , true , 0 , 1 );
1013
1013
test ("a??" , "" , "aaa" , 0 , true , 0 , 0 );
1014
- test ("a???" , "" , "aaa " , 0 , true , 0 , 0 );
1014
+ expectSyntaxError ("a???" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1015
1015
test ("a+?" , "" , "aaa" , 0 , true , 0 , 1 );
1016
- test ("a+??" , "" , "aaa " , 0 , true , 0 , 1 );
1017
- test ("a??+" , "" , "aaa " , 0 , true , 0 , 0 );
1018
- test ("a?+" , "" , "aaa " , 0 , true , 0 , 3 );
1019
- test ("a?+?" , "" , "aaa " , 0 , true , 0 , 1 );
1020
- test ("a?+??" , "" , "aaa " , 0 , true , 0 , 1 );
1021
- test ("a?*??" , "" , "aaa " , 0 , true , 0 , 0 );
1022
- test ("(a?)*??" , "" , "aaa " , 0 , true , 0 , 0 , - 1 , - 1 );
1016
+ expectSyntaxError ("a+??" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1017
+ expectSyntaxError ("a??+" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1018
+ expectSyntaxError ("a?+" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1019
+ expectSyntaxError ("a?+?" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1020
+ expectSyntaxError ("a?+??" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1021
+ expectSyntaxError ("a?*??" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1022
+ expectSyntaxError ("(a?)*??" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1023
1023
test ("((a?)*)??" , "" , "aaa" , 0 , true , 0 , 0 , -1 , -1 , -1 , -1 );
1024
1024
test ("((a?)*?)?" , "" , "aaa" , 0 , true , 0 , 0 , 0 , 0 , -1 , -1 );
1025
- test ("a?*?" , "" , "aaa " , 0 , true , 0 , 0 );
1026
- test ("a*??" , "" , "aaa " , 0 , true , 0 , 0 );
1027
- test ("a+*?" , "" , "aaa " , 0 , true , 0 , 0 );
1025
+ expectSyntaxError ("a?*?" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1026
+ expectSyntaxError ("a*??" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1027
+ expectSyntaxError ("a+*?" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1028
1028
test ("(a+)*?" , "" , "aaa" , 0 , true , 0 , 0 , -1 , -1 );
1029
1029
test ("((a+)*)?" , "" , "aaa" , 0 , true , 0 , 3 , 0 , 3 , 0 , 3 );
1030
- test ("a+*??" , "" , "aaa " , 0 , true , 0 , 0 );
1031
- test ("a++?" , "" , "aaa " , 0 , true , 0 , 3 );
1030
+ expectSyntaxError ("a+*??" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1031
+ expectSyntaxError ("a++?" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1032
1032
expectSyntaxError ("[[.\\ a.]]" , "" , "" , getTRegexEncoding (), "." , 0 , "invalid collation class in regular expression" );
1033
1033
test ("[[...]]" , "" , "." , 0 , true , 0 , 1 );
1034
1034
test ("[[...]]" , "" , "[" , 0 , false );
@@ -1043,12 +1043,12 @@ public void generatedTests() {
1043
1043
test ("[[...]a]a" , "" , "a" , 0 , false );
1044
1044
test ("[[...]a]?a" , "" , "a" , 0 , true , 0 , 1 );
1045
1045
test ("[[...]a]|a" , "" , "a" , 0 , true , 0 , 1 );
1046
- test ("a++?" , "" , "aaa " , 0 , true , 0 , 3 );
1047
- test ("\\ D|++?" , "" , "9 " , 0 , true , 0 , 0 );
1048
- test ("\\ D|++?^" , "" , "9 " , 0 , true , 0 , 0 );
1049
- test ("\\ S|\\ D|++?^(3)" , "" , "9 " , 0 , true , 0 , 1 , - 1 , - 1 );
1050
- test ("\\ S|\\ D|++?^((3)|[R-_\\ (/])t[[:alnum:]]c" , "" , "9 " , 0 , true , 0 , 1 , - 1 , - 1 , - 1 , - 1 );
1051
- test ("(\\ d)|5+*?|[[:lower:]][[=l=]]^%" , "" , "\u0169 \u2113 %" , 0 , true , 0 , 0 , - 1 , - 1 );
1046
+ expectSyntaxError ("a++?" , "" , "" , getTRegexEncoding (), "aaa" , 0 , "nested quantifier in regular expression" );
1047
+ expectSyntaxError ("\\ D|++?" , "" , "" , getTRegexEncoding (), "9" , 0 , "nested quantifier in regular expression" );
1048
+ expectSyntaxError ("\\ D|++?^" , "" , "" , getTRegexEncoding (), "9" , 0 , "nested quantifier in regular expression" );
1049
+ expectSyntaxError ("\\ S|\\ D|++?^(3)" , "" , "" , getTRegexEncoding (), "9" , 0 , "nested quantifier in regular expression" );
1050
+ expectSyntaxError ("\\ S|\\ D|++?^((3)|[R-_\\ (/])t[[:alnum:]]c" , "" , "" , getTRegexEncoding (), "9" , 0 , "nested quantifier in regular expression" );
1051
+ expectSyntaxError ("(\\ d)|5+*?|[[:lower:]][[=l=]]^%" , "" , "" , getTRegexEncoding (), " \u0169 \u2113 %" , 0 , "nested quantifier in regular expression" );
1052
1052
test ("[[===]]" , "" , "=" , 0 , true , 0 , 1 );
1053
1053
expectSyntaxError ("[[=\\ ==]]" , "" , "" , getTRegexEncoding (), "=" , 0 , "invalid equivalence class in regular expression" );
1054
1054
expectSyntaxError ("[[=\\ ==]]" , "" , "" , getTRegexEncoding (), "\\ " , 0 , "invalid equivalence class in regular expression" );
@@ -1093,23 +1093,23 @@ public void generatedTests() {
1093
1093
test ("\\ [[b-b]" , "" , "[b-b]" , 0 , true , 0 , 2 );
1094
1094
test ("\\ [c-b]" , "" , "[c-b]" , 0 , true , 0 , 5 );
1095
1095
expectSyntaxError ("\\ [[c-b]" , "" , "" , getTRegexEncoding (), "[c-b]" , 0 , "invalid range in regular expression" );
1096
- test ("()?*" , "" , "c " , 0 , true , 0 , 0 , 0 , 0 );
1097
- test ("()?*|" , "" , "c " , 0 , true , 0 , 0 , 0 , 0 );
1098
- test ("()?*||" , "" , "c " , 0 , true , 0 , 0 , 0 , 0 );
1099
- test ("()?*||a" , "" , "b " , 0 , true , 0 , 0 , 0 , 0 );
1100
- test ("()?*||^a\\ Zb" , "" , "c " , 0 , true , 0 , 0 , 0 , 0 );
1096
+ expectSyntaxError ("()?*" , "" , "" , getTRegexEncoding (), "c" , 0 , "nested quantifier in regular expression" );
1097
+ expectSyntaxError ("()?*|" , "" , "" , getTRegexEncoding (), "c" , 0 , "nested quantifier in regular expression" );
1098
+ expectSyntaxError ("()?*||" , "" , "" , getTRegexEncoding (), "c" , 0 , "nested quantifier in regular expression" );
1099
+ expectSyntaxError ("()?*||a" , "" , "" , getTRegexEncoding (), "b" , 0 , "nested quantifier in regular expression" );
1100
+ expectSyntaxError ("()?*||^a\\ Zb" , "" , "" , getTRegexEncoding (), "c" , 0 , "nested quantifier in regular expression" );
1101
1101
test ("ac??bc?" , "" , "abc" , 0 , true , 0 , 3 );
1102
1102
test ("ac??bc?" , "" , "acbc" , 0 , true , 0 , 4 );
1103
1103
test ("a?" , "" , "a" , 0 , true , 0 , 1 );
1104
1104
test ("a??" , "" , "a" , 0 , true , 0 , 0 );
1105
- test ("a???" , "" , "a " , 0 , true , 0 , 0 );
1106
- test ("(a)???" , "" , "a " , 0 , true , 0 , 0 , - 1 , - 1 );
1105
+ expectSyntaxError ("a???" , "" , "" , getTRegexEncoding (), "a" , 0 , "nested quantifier in regular expression" );
1106
+ expectSyntaxError ("(a)???" , "" , "" , getTRegexEncoding (), "a" , 0 , "nested quantifier in regular expression" );
1107
1107
test ("(a?)??" , "" , "a" , 0 , true , 0 , 0 , -1 , -1 );
1108
1108
test ("(a??)?" , "" , "a" , 0 , true , 0 , 0 , 0 , 0 );
1109
- test ("(a???)" , "" , "a " , 0 , true , 0 , 0 , 0 , 0 );
1110
- test ("a{0,1}??" , "" , "a " , 0 , true , 0 , 0 );
1111
- test ("a??{0,1}" , "" , "a " , 0 , true , 0 , 0 );
1112
- test ("a{0,1}?{0,1}" , "" , "a " , 0 , true , 0 , 0 );
1109
+ expectSyntaxError ("(a???)" , "" , "" , getTRegexEncoding (), "a" , 0 , "nested quantifier in regular expression" );
1110
+ expectSyntaxError ("a{0,1}??" , "" , "" , getTRegexEncoding (), "a" , 0 , "nested quantifier in regular expression" );
1111
+ expectSyntaxError ("a??{0,1}" , "" , "" , getTRegexEncoding (), "a" , 0 , "nested quantifier in regular expression" );
1112
+ expectSyntaxError ("a{0,1}?{0,1}" , "" , "" , getTRegexEncoding (), "a" , 0 , "nested quantifier in regular expression" );
1113
1113
test ("(a{0,1})*" , "" , "aaaaaa" , 0 , true , 0 , 6 , 6 , 6 );
1114
1114
test ("(a{0,2})*" , "" , "aaaaaa" , 0 , true , 0 , 6 , 6 , 6 );
1115
1115
test ("(a{1,2})*" , "" , "aaaaaa" , 0 , true , 0 , 6 , 4 , 6 );
@@ -1373,6 +1373,20 @@ public void generatedTests() {
1373
1373
test ("($)*\\ s*" , "m" , "\n " , 0 , true , 0 , 0 , 0 , 0 );
1374
1374
test ("$*\\ s*" , "m" , "\n " , 0 , true , 0 , 0 );
1375
1375
test ("(^|(|a))b\\ z" , "" , "b" , 0 , true , 0 , 1 , 0 , 0 , -1 , -1 );
1376
+ test ("(a*()*)*" , "" , "aaa" , 0 , true , 0 , 3 , 3 , 3 , 3 , 3 );
1377
+ test ("(a*()+)+" , "" , "aaa" , 0 , true , 0 , 3 , 3 , 3 , 3 , 3 );
1378
+ test ("(a*()+?)+" , "" , "aaa" , 0 , true , 0 , 3 , 3 , 3 , 3 , 3 );
1379
+ test ("a((b|)+)+c" , "" , "abbbc" , 0 , true , 0 , 5 , 4 , 4 , 4 , 4 );
1380
+ test ("((a|)+)+(b)+c" , "" , "aaabc" , 0 , true , 0 , 5 , 3 , 3 , 3 , 3 , 3 , 4 );
1381
+ test ("(a*()+?b*?)+c" , "" , "aabaac" , 0 , true , 0 , 6 , 5 , 5 , 5 , 5 );
1382
+ test ("((\\ w|)()+)+" , "i" , "empty" , 0 , true , 0 , 5 , 5 , 5 , 5 , 5 , 5 , 5 );
1383
+ test ("(a?()?){3,4}" , "" , "aa" , 0 , true , 0 , 2 , 2 , 2 , 2 , 2 );
1384
+ test ("(a?()+){3,4}" , "" , "aa" , 0 , true , 0 , 2 , 2 , 2 , 2 , 2 );
1385
+ test ("(a*()+?)+" , "" , "aaa" , 0 , true , 0 , 3 , 3 , 3 , 3 , 3 );
1386
+ test ("a(b\\ 1|)*?()+c" , "" , "abc" , 0 , false );
1387
+ test ("()(a*\\ 1+)*" , "" , "aaa" , 0 , true , 0 , 3 , 0 , 0 , 3 , 3 );
1388
+ test ("(a(\\ 2b|)?)+\\ 1c" , "" , "aaabaaac" , 0 , true , 0 , 8 , 5 , 6 , 6 , 6 );
1389
+ test ("((|ab)+?w\\ Z|^c)de()d" , "" , "ffffff" , 0 , false );
1376
1390
test ("(a{1100,1100})\\ 1" , "i" , "a" .repeat (2400 ), 0 , true , 0 , 2200 , 0 , 1100 );
1377
1391
1378
1392
/* GENERATED CODE END - KEEP THIS MARKER FOR AUTOMATIC UPDATES */
0 commit comments