changeset 12231:44379732c06b draft

<b_jonas> fetch /hackenv/bin/whatis https://hack.esolangs.org/get/bin/whatis
author HackEso <hackeso@esolangs.org>
date Thu, 05 Dec 2019 20:05:28 +0000
parents fb0eea93d4e9
children 0124f9ed4c49
files bin/whatis
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/bin/whatis	Thu Dec 05 13:42:21 2019 +0000
+++ b/bin/whatis	Thu Dec 05 20:05:28 2019 +0000
@@ -13,11 +13,14 @@
         foundv.append(False)
     with open(os.environ.get("HACKENV","/hackenv") + "/share/whatis", errors="surrogateescape") as whatisdb:
         for line in whatisdb:
-            parts = re.match(r"([^()]+)\(([0-9A-Z_a-z]+)\)", line)
+            parts = re.match(r"([^()]+)\(([0-9A-Z_a-z])([0-9A-Z_a-z]*)\)", line)
             if parts:
                 match = False
                 for argind, argfold in enumerate(argfoldv):
-                    if argfold == parts.group(1).casefold():
+                    if (argfold == parts.group(1).casefold() or
+                        argfold == parts.group(1) + "(" + parts.group(2) + parts.group(3) + ")" or
+                        argfold == parts.group(1) + "(" + parts.group(3) + ")") \
+                    :
                         match = True
                         foundv[argind] = True
                 if match:
@@ -25,3 +28,4 @@
         for arg, found in zip(argorg, foundv):
             if not found:
                 print(arg + ": nothing appropriate.")
+