
s2p fails with quotes in char classes
: The below sed script comes as macros/fixmacros.sed in groff 1.03.
:
: s/^\([.'][ ]*[^\\ ][^ \\]\)\([^ ]\)/\1 \2/
: s/^\(\\![.'][ ]*[^\\ ][^ \\]\)\([^ ]\)/\1 \2/
: s/\([.'][ ]*i[ef] *[^ ]* [.'][ ]*[^\\0-9 ][^ \\]\)\([^ ]\)/\1 \2/
: s/\([.'][ ]*i[ef] *[^ ]* \\{[.'][ ]*[^\\0-9 ][^ \\]\)\([^ ]\)/\1 \2/
: s/\([.'][ ]*[da]s *[^ \\][^ \\]\)\([^ ]\)/\1 \2/
: s/\\\*\[/\\*[[]/
:
: Running s2p on it produces on stderr:
:
: /tmp/sperl23359.c:31: unterminated character constant
: /tmp/sperl23359.c:33: unterminated string or character constant
: /tmp/sperl23359.c:36: unterminated character constant
: /tmp/sperl23359.c:38: unterminated string or character constant
: /tmp/sperl23359.c:51: unterminated character constant
: /tmp/sperl23359.c:53: unterminated string or character constant
: /tmp/sperl23359.c:50: unterminated #else conditional
:
: If I change all of the single quotes in the sed script to some other
: character, s2p works. If I change them back to single quotes in the
: resulting perl script, that script also works. So there seems to be a
: bug in s2p.
The problem is that s2p is using the C preprocessor to postprocess its
output, and your cpp is being persnickety. The time is rapidly approaching
when I will have to include a preprocessor with Perl, sigh.
Larry