]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.2/Demo/comparisons/regextest.py
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Demo / comparisons / regextest.py
diff --git a/AppPkg/Applications/Python/Python-2.7.2/Demo/comparisons/regextest.py b/AppPkg/Applications/Python/Python-2.7.2/Demo/comparisons/regextest.py
deleted file mode 100644 (file)
index 19617a3..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#! /usr/bin/env python\r
-\r
-# 1)  Regular Expressions Test\r
-#\r
-#     Read a file of (extended per egrep) regular expressions (one per line),\r
-#     and apply those to all files whose names are listed on the command line.\r
-#     Basically, an 'egrep -f' simulator.  Test it with 20 "vt100" patterns\r
-#     against a five /etc/termcap files.  Tests using more elaborate patters\r
-#     would also be interesting.  Your code should not break if given hundreds\r
-#     of regular expressions or binary files to scan.\r
-\r
-# This implementation:\r
-# - combines all patterns into a single one using ( ... | ... | ... )\r
-# - reads patterns from stdin, scans files given as command line arguments\r
-# - produces output in the format <file>:<lineno>:<line>\r
-# - is only about 2.5 times as slow as egrep (though I couldn't run\r
-#   Tom's test -- this system, a vanilla SGI, only has /etc/terminfo)\r
-\r
-import string\r
-import sys\r
-import re\r
-\r
-def main():\r
-    pats = map(chomp, sys.stdin.readlines())\r
-    bigpat = '(' + '|'.join(pats) + ')'\r
-    prog = re.compile(bigpat)\r
-\r
-    for file in sys.argv[1:]:\r
-        try:\r
-            fp = open(file, 'r')\r
-        except IOError, msg:\r
-            print "%s: %s" % (file, msg)\r
-            continue\r
-        lineno = 0\r
-        while 1:\r
-            line = fp.readline()\r
-            if not line:\r
-                break\r
-            lineno = lineno + 1\r
-            if prog.search(line):\r
-                print "%s:%s:%s" % (file, lineno, line),\r
-\r
-def chomp(s):\r
-    return s.rstrip('\n')\r
-\r
-if __name__ == '__main__':\r
-    main()\r