Browse Source

Implement total submissions, FuncDef counts and type string

Lucas de Souza 5 năm trước cách đây
mục cha
commit
1f0b989cd4
3 tập tin đã thay đổi với 23 bổ sung11 xóa
  1. 9 2
      analyser.py
  2. 10 9
      cjson.py
  3. 4 0
      files.py

+ 9 - 2
analyser.py

@@ -6,7 +6,7 @@ from pycparser import c_ast
 
 INT_TYPES = ['int', 'short', 'float']
 FLOAT_TYPES = ['float', 'double']
-STRING_TYPES = ['char']
+STRING_TYPES = ['char', 'string']
 
 VALID_TPYES = list()
 VALID_TPYES.extend(INT_TYPES)
@@ -116,7 +116,12 @@ class ASTAnalyser:
 
     for v in vectors:
       type = normalizeType(v.type)
-      if type in self.declarationsVectors:
+      if type == 'string':
+        if type in self.declarations:
+          self.declarations[type] += 1
+        else:
+          self.declarations[type] = 1
+      elif type in self.declarationsVectors:
         self.declarationsVectors[type] += 1
       else:
         self.declarationsVectors[type] = 1
@@ -155,6 +160,8 @@ class ASTAnalyser:
           self.constantInitCount[init.value] = 1
   
   def proccessFuncDef (self, node):
+    name = node.__class__.__name__
+    self.incCmdCount(name)
     commandList = node.body.block_items
     for cmd in commandList:
       self.proccessCommand(cmd)

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 10 - 9
cjson.py


+ 4 - 0
files.py

@@ -22,6 +22,10 @@ def filesFromFolder (path, foldername):
     print("Directory %s not found at %s." % (foldername, path))
     return []
 
+def countFolders (path, foldername = ""):
+  files = filesFromFolder(path, foldername)
+  return len(files)
+
 def highestFileName (path, foldername = ""):
   files = filesFromFolder(path, foldername)
   return max(files, key=int)