[Parse] Eliminate backtracking in collection expression parsing

Parsing collection literal expression used to take exponential time
depending on the nesting level of the first element.

Stop using 'parseList()' because using it complicates libSyntax parsing.

rdar://problem/45221238 / https://bugs.swift.org/browse/SR-9220
rdar://problem/38913395 / https://bugs.swift.org/browse/SR-7283
This commit is contained in:
Rintaro Ishizaki
2018-12-21 15:28:42 +09:00
parent edc20104e3
commit 22652f9e88
7 changed files with 139 additions and 133 deletions

View File

@@ -0,0 +1,9 @@
// RUN: %scale-test -parse --begin 0 --end 10 --step 1 --select NumASTBytes %s
%for i in range(1, N + 1):
[
%end
1
%for i in range(1, N + 1):
]
%end