summaryrefslogtreecommitdiffstats
path: root/vendor/regex-automata/data/tests/fowler/fowler-to-toml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
commit5363f350887b1e5b5dd21a86f88c8af9d7fea6da (patch)
tree35ca005eb6e0e9a1ba3bb5dbc033209ad445dc17 /vendor/regex-automata/data/tests/fowler/fowler-to-toml
parentAdding debian version 1.66.0+dfsg1-1. (diff)
downloadrustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.tar.xz
rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/regex-automata/data/tests/fowler/fowler-to-toml')
-rwxr-xr-xvendor/regex-automata/data/tests/fowler/fowler-to-toml76
1 files changed, 0 insertions, 76 deletions
diff --git a/vendor/regex-automata/data/tests/fowler/fowler-to-toml b/vendor/regex-automata/data/tests/fowler/fowler-to-toml
deleted file mode 100755
index 5f1d91fcb..000000000
--- a/vendor/regex-automata/data/tests/fowler/fowler-to-toml
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-
-from __future__ import absolute_import, division, print_function
-import argparse
-import os.path as path
-
-
-def read_tests(f):
- basename, _ = path.splitext(path.basename(f))
- tests = []
- prev_pattern = None
-
- for lineno, line in enumerate(open(f), 1):
- fields = list(filter(None, map(str.strip, line.split('\t'))))
- if not (4 <= len(fields) <= 5) \
- or 'E' not in fields[0] or fields[0][0] == '#':
- continue
-
- terse_opts, pat, text, sgroups = fields[0:4]
- groups = [] # groups as integer ranges
- if sgroups == 'NOMATCH':
- groups = []
- elif ',' in sgroups:
- noparen = map(lambda s: s.strip('()'), sgroups.split(')('))
- for g in noparen:
- s, e = map(str.strip, g.split(','))
- groups.append([int(s), int(e)])
- break
- else:
- # This skips tests that should result in an error.
- # There aren't many, so I think we can just capture those
- # manually. Possibly fix this in future.
- continue
-
- opts = []
- if text == "NULL":
- text = ""
- if pat == 'SAME':
- pat = prev_pattern
- if '$' in terse_opts:
- pat = pat.encode('utf-8').decode('unicode_escape')
- text = text.encode('utf-8').decode('unicode_escape')
- text = text.encode('unicode_escape').decode('utf-8')
- opts.append('escaped')
- else:
- opts.append('escaped')
- text = text.encode('unicode_escape').decode('utf-8')
- if 'i' in terse_opts:
- opts.append('case-insensitive')
-
- pat = pat.encode('unicode_escape').decode('utf-8')
- pat = pat.replace('\\\\', '\\')
- tests.append({
- 'name': '"%s%d"' % (basename, lineno),
- 'options': repr(opts),
- 'pattern': "'''%s'''" % pat,
- 'input': "'''%s'''" % text,
- 'matches': str(groups),
- })
- prev_pattern = pat
- return tests
-
-
-if __name__ == '__main__':
- parser = argparse.ArgumentParser(
- description='Generate match tests from an AT&T POSIX test file.')
- aa = parser.add_argument
- aa('datfile', help='A dat AT&T POSIX test file.')
- args = parser.parse_args()
-
- tests = read_tests(args.datfile)
- for t in tests:
- print('[[tests]]')
- for k, v in t.items():
- print('%s = %s' % (k, v))
- print('')