[afblue.pl]: Minor improvements. * src/tools/afblue.pl: Allow whitespace before comments. Ignore whitespace in strings.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/ChangeLog b/ChangeLog
index ce0ef13..c0dc27a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-04-15 Werner Lemberg <wl@gnu.org>
+
+ [afblue.pl]: Minor improvements.
+
+ * src/tools/afblue.pl: Allow whitespace before comments.
+ Ignore whitespace in strings.
+
2014-04-14 Werner Lemberg <wl@gnu.org>
[autofit] Improve coverage handling.
diff --git a/src/tools/afblue.pl b/src/tools/afblue.pl
index 58aa2a0..60fe696 100644
--- a/src/tools/afblue.pl
+++ b/src/tools/afblue.pl
@@ -63,8 +63,8 @@ my $enum_element_re = qr/ ^ \s* ( [A-Za-z0-9_]+ ) \s* $ /x;
# '#' <preprocessor directive> '\n'
my $preprocessor_re = qr/ ^ \# /x;
-# '/' '/' <comment> '\n'
-my $comment_re = qr| ^ // |x;
+# [<ws>] '/' '/' <comment> '\n'
+my $comment_re = qr| ^ \s* // |x;
# empty line
my $whitespace_only_re = qr/ ^ \s* $ /x;
@@ -159,6 +159,9 @@ sub convert_ascii_chars
# A series of ASCII characters in the printable range.
my $s = shift;
+ # We ignore spaces.
+ $s =~ s/ //g;
+
my $count = $s =~ s/\G(.)/'$1', /g;
$curr_offset += $count;
$curr_elem_size += $count;