Checkpoint for a parser rewrite (#2364)

The intent of this approach is to eliminate recursion limits as a barrier for the parser. While it may not be urgent to address, I want to avoid pouring effort into a parser approach that we don't think will be usable long-term.

Right now this is passing a minor set of tests. It's intended to be enough to show how I'm thinking about flow control for the parser. I'm manually switching back and forth because it seemed like the easiest approach that avoids duplicating tests.
This commit is contained in:
Jon Ross-Perkins
2022-11-02 14:43:40 -07:00
committed by GitHub
parent b6094c6a98
commit 9107916b11
9 changed files with 550 additions and 1 deletions
+14 -1
View File
@@ -22,14 +22,27 @@ def glob_lit_tests(driver, data, test_file_exts, **kwargs):
exclude_directories = 1,
)
data.append("@llvm-project//llvm:lit")
suites = dict()
for f in test_files:
if f.split(".")[-1] not in test_file_exts:
continue
test = "%s.test" % f
native.py_test(
name = "%s.test" % f,
name = test,
srcs = ["//bazel/testing:lit_test.py"],
main = "//bazel/testing:lit_test.py",
data = data + [driver, f],
args = ["--package_name=%s" % native.package_name(), "--"],
**kwargs
)
# Cluster tests by directory in order to produce suites. For example,
# foo/bar/baz.carbon.test is added to suites :foo and :foo/bar.
dirs = f.split("/")[:-1]
for num_parts in range(1, 1 + len(dirs)):
dir = "/".join(dirs[:num_parts])
if dir not in suites:
suites[dir] = []
suites[dir].append(test)
for suite, tests in suites.items():
native.test_suite(name = suite, tests = tests)