forked from GitHub/gf-core
"Committed_by_peb"
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
-- Creating and using lock fields in reused resource grammars.
|
-- Creating and using lock fields in reused resource grammars.
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module Lockfield where
|
module Lockfield (lockRecType, unlockRecord, lockLabel) where
|
||||||
|
|
||||||
import Grammar
|
import Grammar
|
||||||
import Ident
|
import Ident
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# checking that a file is haddocky
|
# checking that a file is haddocky
|
||||||
|
|
||||||
# limitations:
|
# limitations:
|
||||||
# - does not check that 'type' declarations really are put in the export list
|
# - does not check that type aliases are put in the export list
|
||||||
# - there might be some problems with nested comments
|
# - there might be some problems with nested comments
|
||||||
|
|
||||||
for $file (@ARGV) {
|
for $file (@ARGV) {
|
||||||
@@ -14,30 +14,39 @@ for $file (@ARGV) {
|
|||||||
|
|
||||||
# print "- $file\n";
|
# print "- $file\n";
|
||||||
|
|
||||||
# removing comments:
|
# removing comments
|
||||||
s/\{-.*?-\}//gs;
|
s/\{-.*?-\}//gs;
|
||||||
s/--.*?\n/\n/g;
|
s/--.*?\n/\n/g;
|
||||||
|
|
||||||
# export list:
|
# export list
|
||||||
if (/\nmodule\s+(\w+)\s+\((.*?)\)\s+where/s) {
|
if (/\nmodule\s+(\w+)\s+\((.*?)\)\s+where/s) {
|
||||||
($module, $exportlist) = ($1, $2);
|
($module, $exportlist) = ($1, $2);
|
||||||
|
|
||||||
# removing modules from exportlist:
|
# removing modules from exportlist
|
||||||
$exportlist =~ s/module\s+[A-Z]\w*//gs;
|
$exportlist =~ s/module\s+[A-Z]\w*//gs;
|
||||||
|
|
||||||
# type signatures:
|
# type signatures
|
||||||
while (/\n([a-z]\w*)\s*::/gs) {
|
while (/\n([a-z]\w*)\s*::/gs) {
|
||||||
$function = $1;
|
$function = $1;
|
||||||
$exportlist =~ s/\b$function\b//;
|
$exportlist =~ s/\b$function\b//;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# type aliases
|
||||||
|
while (/\ntype\s+(\w+)/gs) {
|
||||||
|
$type = $1;
|
||||||
|
next if $exportlist =~ /\b$type\b/;
|
||||||
|
printf "%-30s | Type alias not in export list: %s\n", $file, $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
# exported functions without type signatures
|
||||||
while ($exportlist =~ /\b(\w+)\b/gs) {
|
while ($exportlist =~ /\b(\w+)\b/gs) {
|
||||||
$function = $1;
|
$function = $1;
|
||||||
next if $function =~ /^[A-Z]/;
|
next if $function =~ /^[A-Z]/;
|
||||||
printf "%-30s | No type signature for '%s'\n", $file, $1;
|
printf "%-30s | No type signature for function: %s\n", $file, $function;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
# modules without export lists
|
||||||
printf "%-30s | No export list\n", $file;
|
printf "%-30s | No export list\n", $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ GF/
|
|||||||
AppPredefined
|
AppPredefined
|
||||||
Compute
|
Compute
|
||||||
Grammar
|
Grammar
|
||||||
|
Lockfield
|
||||||
LookAbs
|
LookAbs
|
||||||
Lookup
|
Lookup
|
||||||
MMacros
|
MMacros
|
||||||
|
|||||||
Reference in New Issue
Block a user