summaryrefslogtreecommitdiff
path: root/src/haddock
diff options
context:
space:
mode:
authorpeb <unknown>2005-02-09 19:45:54 +0000
committerpeb <unknown>2005-02-09 19:45:54 +0000
commit9afbd25b64607e68fe6275fb6b743159001ca984 (patch)
treec1c7f0f1bd7f83d721f4e55318160edd1f0eee1b /src/haddock
parentc467ef8d0323d896778c6ed68ce0b23441f3a65a (diff)
"Committed_by_peb"
Diffstat (limited to 'src/haddock')
-rw-r--r--src/haddock/haddock-check.perl46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/haddock/haddock-check.perl b/src/haddock/haddock-check.perl
new file mode 100644
index 000000000..cea2a6cb1
--- /dev/null
+++ b/src/haddock/haddock-check.perl
@@ -0,0 +1,46 @@
+
+# checking that a file is haddocky
+
+# limitations:
+# - does not check that 'type' declarations really are put in the export list
+# - there might be some problems with nested comments
+
+for $file (@ARGV) {
+ $file =~ s/\.hs//;
+
+ open F, "<$file.hs";
+ $_ = join "", <F>;
+ close F;
+
+ # print "- $file\n";
+
+ # removing comments:
+ s/\{-.*?-\}//gs;
+ s/--.*?\n/\n/g;
+
+ # export list:
+ if (/\nmodule\s+(\w+)\s+\((.*?)\)\s+where/s) {
+ ($module, $exportlist) = ($1, $2);
+
+ # removing modules from exportlist:
+ $exportlist =~ s/module\s+[A-Z]\w*//gs;
+
+ # type signatures:
+ while (/\n([a-z]\w*)\s*::/gs) {
+ $function = $1;
+ $exportlist =~ s/\b$function\b//;
+ }
+
+ while ($exportlist =~ /\b(\w+)\b/gs) {
+ $function = $1;
+ next if $function =~ /^[A-Z]/;
+ printf "%-30s | No type signature for '%s'\n", $file, $1;
+ }
+
+ } else {
+ printf "%-30s | No export list\n", $file;
+ }
+
+}
+
+