chiark / gitweb /
toplevel-find: Support new //// toplevels-from: which precedes a include
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 9 Feb 2016 21:51:49 +0000 (21:51 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 9 Feb 2016 21:51:49 +0000 (21:51 +0000)
toplevel-find

index 72a2de3..58c3554 100755 (executable)
@@ -5,6 +5,12 @@ my $base = $ARGV[0];
 $base =~ m/^\-/ and die;
 open F, "$base.scad" or die "$base.scad $!";
 while (<F>) {
+    if (m#^//// toplevels-from:#) {
+       defined($_ = <F>) or die $!;
+       m#^include\s+\<(\S+)>\s*$# or die;
+       open F, "$1" or die "$1 $!";
+       next;
+    }
     next unless m#^\s*module\s+(\w+)\b.*////toplevel\b#;
     print "$base,$1\n" or die $!;
 }