Commit 9d5529e
committed
Update \DDD parsing
Previously we followed PCRE's parsing of this syntax
such that it may either be an octal sequence or
backreference depending on a list of heuristics.
However this model is complicated and not particularly
intuitive, especially as there are other engines
that disambiguate using subtly different rules.
Instead, always parse `\DDD` as a backreference,
unless it begins with `0`, in which case it is an
octal sequence. This matches ICU and Java's
behavior. Once we start validating group references,
we can then start emitting an error on invalid
backreferences using this syntax, and suggest
prefixing with 0 if an octal sequence is desired.1 parent 04ad64a commit 9d5529e
File tree
3 files changed
+39
-59
lines changed- Sources/_MatchingEngine/Regex/Parse
- Tests/RegexTests
3 files changed
+39
-59
lines changedLines changed: 14 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
| 282 | + | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
323 | 324 | | |
324 | 325 | | |
325 | 326 | | |
| |||
1341 | 1342 | | |
1342 | 1343 | | |
1343 | 1344 | | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
1353 | | - | |
1354 | | - | |
1355 | | - | |
| 1345 | + | |
1356 | 1346 | | |
1357 | | - | |
1358 | | - | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
1363 | | - | |
| 1347 | + | |
| 1348 | + | |
1364 | 1349 | | |
1365 | 1350 | | |
1366 | 1351 | | |
| |||
1497 | 1482 | | |
1498 | 1483 | | |
1499 | 1484 | | |
1500 | | - | |
1501 | | - | |
1502 | | - | |
1503 | | - | |
| 1485 | + | |
| 1486 | + | |
1504 | 1487 | | |
1505 | 1488 | | |
1506 | 1489 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
1021 | 1021 | | |
1022 | 1022 | | |
1023 | 1023 | | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | 1024 | | |
1028 | 1025 | | |
1029 | 1026 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
| 336 | + | |
337 | 337 | | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
343 | 345 | | |
344 | 346 | | |
345 | 347 | | |
| |||
797 | 799 | | |
798 | 800 | | |
799 | 801 | | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
| |||
813 | 813 | | |
814 | 814 | | |
815 | 815 | | |
816 | | - | |
| 816 | + | |
817 | 817 | | |
818 | 818 | | |
819 | | - | |
820 | | - | |
821 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
822 | 823 | | |
823 | 824 | | |
824 | 825 | | |
825 | 826 | | |
826 | 827 | | |
827 | 828 | | |
828 | 829 | | |
829 | | - | |
830 | | - | |
| 830 | + | |
| 831 | + | |
831 | 832 | | |
832 | 833 | | |
833 | 834 | | |
| |||
852 | 853 | | |
853 | 854 | | |
854 | 855 | | |
855 | | - | |
| 856 | + | |
856 | 857 | | |
857 | 858 | | |
858 | 859 | | |
| |||
862 | 863 | | |
863 | 864 | | |
864 | 865 | | |
865 | | - | |
| 866 | + | |
866 | 867 | | |
867 | 868 | | |
868 | 869 | | |
| |||
876 | 877 | | |
877 | 878 | | |
878 | 879 | | |
879 | | - | |
880 | | - | |
881 | | - | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
882 | 883 | | |
883 | 884 | | |
884 | | - | |
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
| |||
0 commit comments