Browse Source

Merge pull request #1493 from achlipala/master

Extensible line-counting for measuring source code
Brittany Mazza 10 years ago
parent
commit
546aeb46df
2 changed files with 11 additions and 0 deletions
  1. 6 0
      frameworks/Ur/urweb/cloc_defs.txt
  2. 5 0
      toolset/benchmark/benchmarker.py

+ 6 - 0
frameworks/Ur/urweb/cloc_defs.txt

@@ -0,0 +1,6 @@
+Ur/Web
+    filter call_regexp_common Pascal
+    extension ur
+    extension urs
+    end_of_line_continuation \\$
+    3rd_gen_scale 3.00

+ 5 - 0
toolset/benchmark/benchmarker.py

@@ -773,6 +773,11 @@ class Benchmarker:
       
       
       try:
       try:
         command = "cloc --list-file=%s/source_code --yaml" % testlist[0].directory
         command = "cloc --list-file=%s/source_code --yaml" % testlist[0].directory
+
+        if os.path.exists(os.path.join(testlist[0].directory, "cloc_defs.txt")):
+          command += " --read-lang-def %s" % os.path.join(testlist[0].directory, "cloc_defs.txt")
+          logging.info("Using custom cloc definitions for %s", framework)
+
         # Find the last instance of the word 'code' in the yaml output. This should
         # Find the last instance of the word 'code' in the yaml output. This should
         # be the line count for the sum of all listed files or just the line count
         # be the line count for the sum of all listed files or just the line count
         # for the last file in the case where there's only one file listed.
         # for the last file in the case where there's only one file listed.