From: Bruno Haible Date: Thu, 14 Dec 2006 12:32:12 +0000 (+0000) Subject: Fix sed_remove_comments. X-Git-Tag: v0.17~592 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec0042bb40ab75d649ceb8f462f7eb631ce88949;p=thirdparty%2Fgettext.git Fix sed_remove_comments. --- diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog index 58e76a131..628bfca3d 100644 --- a/gnulib-local/ChangeLog +++ b/gnulib-local/ChangeLog @@ -1,3 +1,9 @@ +2006-12-13 Bruno Haible + + * build-aux/moopp (sed_remove_comments): Fix handling of character + constants. Example: '"' /* comment */ '"' + (sed_remove_comments_ERE): New variable. + 2006-12-13 Bruno Haible * modules/ostream (Makefile.am): List all generated files in the moopp diff --git a/gnulib-local/build-aux/moopp b/gnulib-local/build-aux/moopp index 463e8302a..d744f8ba8 100755 --- a/gnulib-local/build-aux/moopp +++ b/gnulib-local/build-aux/moopp @@ -83,27 +83,50 @@ esac sed_remove_empty_lines='/^$/d' # A sed expression that removes ANSI C and ISO C99 comments. -sed_remove_comments=' +sed_remove_comments=" /[/][/*]/{ ta :a - s,^\(\([^"/]\|"\([^\"]\|[\].\)*"\|[/][^"/*]\|[/]"\([^\"]\|[\].\)*"\)*\)//.*,\1, + s,^\\(\\([^\"'/]\\|\"\\([^\\\"]\\|[\\].\\)*\"\\|'\\([^\\']\\|[\\].\\)*'\\|[/][^\"'/*]\\|[/]\"\\([^\\\"]\\|[\\].\\)*\"\\|[/]'\\([^\\']\\|[\\].\\)*'\\)*\\)//.*,\\1, te - s,^\(\([^"/]\|"\([^\"]\|[\].\)*"\|[/][^"/*]\|[/]"\([^\"]\|[\].\)*"\)*\)/[*]\([^*]\|[*][^/*]\)*[*][*]*/,\1 , + s,^\\(\\([^\"'/]\\|\"\\([^\\\"]\\|[\\].\\)*\"\\|'\\([^\\']\\|[\\].\\)*'\\|[/][^\"'/*]\\|[/]\"\\([^\\\"]\\|[\\].\\)*\"\\|[/]'\\([^\\']\\|[\\].\\)*'\\)*\\)/[*]\\([^*]\\|[*][^/*]\\)*[*][*]*/,\\1 , ta - /^\([^"/]\|"\([^\"]\|[\].\)*"\|[/][^"/*]\|[/]"\([^\"]\|[\].\)*"\)*[/][*]/{ - s,^\(\([^"/]\|"\([^\"]\|[\].\)*"\|[/][^"/*]\|[/]"\([^\"]\|[\].\)*"\)*\)/[*].*,\1 , + /^\\([^\"'/]\\|\"\\([^\\\"]\\|[\\].\\)*\"\\|'\\([^\\']\\|[\\].\\)*'\\|[/][^\"'/*]\\|[/]\"\\([^\\\"]\\|[\\].\\)*\"\\|[/]'\\([^\\']\\|[\\].\\)*'\\)*[/][*]/{ + s,^\\(\\([^\"'/]\\|\"\\([^\\\"]\\|[\\].\\)*\"\\|'\\([^\\']\\|[\\].\\)*'\\|[/][^\"'/*]\\|[/]\"\\([^\\\"]\\|[\\].\\)*\"\\|[/]'\\([^\\']\\|[\\].\\)*'\\)*\\)/[*].*,\\1 , tu :u n - s,^\([^*]\|[*][^/*]\)*[*][*]*/,, + s,^\\([^*]\\|[*][^/*]\\)*[*][*]*/,, tv - s,^.*$,, + s,^.*\$,, bu :v } :e -}' +}" +# The same thing as an extended regular expression, for use with +# sed --regexp-extended. +sed_remove_comments_ERE=" +/[/][/*]/{ + ta + :a + s,^(([^\"'/]|\"([^\\\"]|[\\].)*\"|'([^\\']|[\\].)*'|[/][^\"'/*]|[/]\"([^\\\"]|[\\].)*\"|[/]'([^\\']|[\\].)*')*)//.*,\\1, + te + s,^(([^\"'/]|\"([^\\\"]|[\\].)*\"|'([^\\']|[\\].)*'|[/][^\"'/*]|[/]\"([^\\\"]|[\\].)*\"|[/]'([^\\']|[\\].)*')*)/[*]([^*]|[*][^/*])*[*][*]*/,\\1 , + ta + /^([^\"'/]|\"([^\\\"]|[\\].)*\"|'([^\\']|[\\].)*'|[/][^\"'/*]|[/]\"([^\\\"]|[\\].)*\"|[/]'([^\\']|[\\].)*')*[/][*]/{ + s,^(([^\"'/]|\"([^\\\"]|[\\].)*\"|'([^\\']|[\\].)*'|[/][^\"'/*]|[/]\"([^\\\"]|[\\].)*\"|[/]'([^\\']|[\\].)*')*)/[*].*,\\1 , + tu + :u + n + s,^([^*]|[*][^/*])*[*][*]*/,, + tv + s,^.*\$,, + bu + :v + } + :e +}" # func_check_impl_syntax file # Check the syntax of the source implementation file.