Carl Friedrich Bolz avatar Carl Friedrich Bolz committed 74a4979

give shapes a str that summarizes them

Comments (0)

Files changed (1)

prolog/interpreter/specialterm.py

 conssig = signature.Signature.getsignature(".", 2)
 
 class ArgumentDescr(object):
+    char = "b"
     def compatible_with(self, obj):
         return False
 
         obj._raw_set_argument_at(i, erase(val))
 
 class AnyArgumentDescr(ArgumentDescr):
+    char = "*"
     def compatible_with(self, obj):
         return True
 
 class VarArgumentDescr(ArgumentDescr):
+    char = "X"
     def compatible_with(self, obj):
         return isinstance(obj, term.BindingVar)
 
         return res
 
 class NumberArgumentDescr(ArgumentDescr):
+    char = "n"
     def compatible_with(self, obj):
         if not isinstance(obj, term.Number):
             return False
     def __init__(self, signature, args):
         self.signature = signature
         self.args = args
+        self.str = "".join([a.char for a in args])
         self.cache = None
 
     def argument_at(self, i, obj):
     cls.__name__ = termcls.__name__ + "ArgumentDescr"
     return cls()
 
-
-all_argument_descrs.extend([make_specialized_argument_descr(cls)
-            for cls in specialized_term_classes])
-all_argument_descrs.append(make_specialized_argument_descr(term.Atom))
-all_argument_descrs.append(make_specialized_argument_descr(Cons))
+def make_arg_descrs():
+    for i, cls in enumerate(specialized_term_classes):
+        descr = make_specialized_argument_descr(cls)
+        descr.char = str(i + 1)
+        assert len(descr.char) == 1
+        all_argument_descrs.append(descr)
+    all_argument_descrs.append(make_specialized_argument_descr(term.Atom))
+    all_argument_descrs[-1].char = "a"
+    all_argument_descrs.append(make_specialized_argument_descr(Cons))
+    all_argument_descrs[-1].char = "."
+make_arg_descrs()
 
 all_argument_descrs = unroll.unrolling_iterable(all_argument_descrs)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.