about summary refs log tree commit diff
path: root/src/grammar/testparser.py
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-10-01 07:56:52 +0000
committerbors <bors@rust-lang.org>2019-10-01 07:56:52 +0000
commit702b45e409495a41afcccbe87a251a692b0cefab (patch)
tree6dbfa88da0422f72926f0352a968d79bf84e8464 /src/grammar/testparser.py
parent42ec6831b019114a4b6f6b58bfb5bc2927d70388 (diff)
parent46bf6ad416cf922c410fed11e9f73c03c0015bcd (diff)
Auto merge of #64946 - Centril:rollup-66mj5o0, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #63674 (syntax: Support modern attribute syntax in the `meta` matcher)
 - #63931 (Stabilize macros in some more positions)
 - #64887 (syntax: recover trailing `|` in or-patterns)
 - #64895 (async/await: improve not-send errors)
 - #64896 (Remove legacy grammar)
 - #64907 (A small amount of tidying-up factored out from PR #64648)
 - #64928 (Add tests for some issues)
 - #64930 (Silence unreachable code lint from await desugaring)
 - #64935 (Improve code clarity)
 - #64937 (Deduplicate closure type errors)

Failed merges:

r? @ghost
Diffstat (limited to 'src/grammar/testparser.py')
-rwxr-xr-xsrc/grammar/testparser.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/src/grammar/testparser.py b/src/grammar/testparser.py
deleted file mode 100755
index 4b5a7fb9e10..00000000000
--- a/src/grammar/testparser.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-
-# ignore-tidy-linelength
-
-import sys
-
-import os
-import subprocess
-import argparse
-
-# usage: testparser.py [-h] [-p PARSER [PARSER ...]] -s SOURCE_DIR
-
-# Parsers should read from stdin and return exit status 0 for a
-# successful parse, and nonzero for an unsuccessful parse
-
-parser = argparse.ArgumentParser()
-parser.add_argument('-p', '--parser', nargs='+')
-parser.add_argument('-s', '--source-dir', nargs=1, required=True)
-args = parser.parse_args(sys.argv[1:])
-
-total = 0
-ok = {}
-bad = {}
-for parser in args.parser:
-    ok[parser] = 0
-    bad[parser] = []
-devnull = open(os.devnull, 'w')
-print("\n")
-
-for base, dirs, files in os.walk(args.source_dir[0]):
-    for f in filter(lambda p: p.endswith('.rs'), files):
-        p = os.path.join(base, f)
-        parse_fail = 'parse-fail' in p
-        if sys.version_info.major == 3:
-            lines = open(p, encoding='utf-8').readlines()
-        else:
-            lines = open(p).readlines()
-        if any('ignore-test' in line or 'ignore-lexer-test' in line for line in lines):
-            continue
-        total += 1
-        for parser in args.parser:
-            if subprocess.call(parser, stdin=open(p), stderr=subprocess.STDOUT, stdout=devnull) == 0:
-                if parse_fail:
-                    bad[parser].append(p)
-                else:
-                    ok[parser] += 1
-            else:
-                if parse_fail:
-                    ok[parser] += 1
-                else:
-                    bad[parser].append(p)
-        parser_stats = ', '.join(['{}: {}'.format(parser, ok[parser]) for parser in args.parser])
-        sys.stdout.write("\033[K\r total: {}, {}, scanned {}"
-                         .format(total, os.path.relpath(parser_stats), os.path.relpath(p)))
-
-devnull.close()
-
-print("\n")
-
-for parser in args.parser:
-    filename = os.path.basename(parser) + '.bad'
-    print("writing {} files that did not yield the correct result with {} to {}".format(len(bad[parser]), parser, filename))
-    with open(filename, "w") as f:
-        for p in bad[parser]:
-            f.write(p)
-            f.write("\n")