mktables: Always strip off returned comments in tables
authorKarl Williamson <public@khwilliamson.com>
Mon, 30 Dec 2013 22:43:12 +0000 (15:43 -0700)
committerKarl Williamson <public@khwilliamson.com>
Tue, 31 Dec 2013 15:27:15 +0000 (08:27 -0700)
mktables generates (among other things) many perl .pl files which when
executed, return a string containing many lines.  Each line may end
with '#' comments.  Previously, it didn't always strip off those
comments to the caller, which it assumed uses a 'do' statement to
execute these, and the comments are automatically ignored.  However, it
turns out that the 'mkheader' script in Unicode::Normalize doesn't cope
with these comments.  This usually doesn't get called except once when
normally these comments aren't generated, but if it does, things don't
just compile.  So, just strip off the comments, rather than letting the
'do' handle it.

lib/unicore/mktables

index 10e8acf..d3d590f 100644 (file)
@@ -5522,14 +5522,10 @@ END
         # affect what gets output before it, therefore pre_body() isn't called
         # until after all other processing of the table is done.
 
-        # The main body looks like a 'here' document.  If annotating, get rid
-        # of the comments before passing to the caller, as some callers, such
-        # as charnames.pm, can't cope with them.  (Outputting range counts
-        # also introduces comments, but these don't show up in the tables that
-        # can't cope with comments, and there aren't that many of them that
-        # it's worth the extra real time to get rid of them).
+        # The main body looks like a 'here' document.  If there are comments,
+        # get rid of them when processing it.
         my @OUT;
-        if ($annotate) {
+        if ($annotate || $output_range_counts) {
             # Use the line below in Perls that don't have /r
             #push @OUT, 'return join "\n",  map { s/\s*#.*//mg; $_ } split "\n", <<\'END\';' . "\n";
             push @OUT, "return <<'END' =~ s/\\s*#.*//mgr;\n";