changeset 152:cf44c73dc17f

editor_info: Now outputs info in a new format. secret: line pos length Means that the expression at that position contains secret information. values: line pos length (from to) Means that the variable at the given location contains values in that range.
author Sigurd Meldgaard <stm@daimi.au.dk>
date Thu, 03 Dec 2009 14:55:06 +0100
parents d4601a70d734
children 79093516662c
files pysmcl/editor_info.py
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/editor_info.py	Thu Dec 03 14:52:17 2009 +0100
+++ b/pysmcl/editor_info.py	Thu Dec 03 14:55:06 2009 +0100
@@ -6,9 +6,6 @@
 from pysmcl.pretty_print import  expr_string, pprint
 from pysmcl.range_analysis import RangeAnalysis
 
-def is_ideal_functionality(function_def):
-    return any([decorator.id == 'ideal_functionality' for decorator in function_def.decorator_list])
-
 def main():
     try:
         prog = ast.parse(file(sys.argv[1]).read())
@@ -31,10 +28,14 @@
                         r = j.out_values["range"]
                     if isinstance(j, ast.expr):
                         if expr_secret(j, e):
-                            print "%d %d %d" % (j.lineno, j.col_offset,
-                                                len(expr_string(j)))
-                    if isinstance(j, ast.Name) and not isinstance(j.parent, ast.Call):
-                        pass#                        print "%s has values in %s" % (j.id, str(r[j.id]))
+                            s = expr_string(j)
+                            print "secret: %d %d %d (%s)" % (j.lineno, j.col_offset,
+                                                len(s), s)
+                    if(isinstance(j, ast.Name) and not 
+                       (isinstance(j.parent, ast.Call) and j is j.parent.func)):
+
+                        print "values: %d %d %d %s" % (j.lineno, j.col_offset,
+                                                len(expr_string(j)), str(r[j.id]))
 
 
 if __name__ == "__main__":