From 181fd071ee58b4b59257a2a162ea0a928057aa8d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 15 Apr 2014 16:47:05 +0200 Subject: [PATCH] [afblue.pl]: Minor improvements. * src/tools/afblue.pl: Allow whitespace before comments. Ignore whitespace in strings. --- ChangeLog | 7 +++++++ src/tools/afblue.pl | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce0ef1361..c0dc27a13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-04-15 Werner Lemberg + + [afblue.pl]: Minor improvements. + + * src/tools/afblue.pl: Allow whitespace before comments. + Ignore whitespace in strings. + 2014-04-14 Werner Lemberg [autofit] Improve coverage handling. diff --git a/src/tools/afblue.pl b/src/tools/afblue.pl index 58aa2a055..60fe6966a 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; # '#' '\n' my $preprocessor_re = qr/ ^ \# /x; -# '/' '/' '\n' -my $comment_re = qr| ^ // |x; +# [] '/' '/' '\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;