s2p fails with quotes in char classes 
Author Message
 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.
--



Wed, 30 Mar 1994 03:38:29 GMT  
 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



Sat, 02 Apr 1994 02:37:20 GMT  
 s2p fails with quotes in char classes

Quote:

> The time is rapidly approaching
> when I will have to include a preprocessor with Perl, sigh.

That time arrived long ago.  Fortunately, there aren't too many -P
scripts around.  And for the few that do exist, isn't
        " /usr/local/lib/gcc-cpp -traditional"
good enough?
--



Sat, 02 Apr 1994 15:06:23 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Why no regex char class for punc chars???

2. exec a command that has a single quote char

3. Automatic quoting special chars in string for reg exp

4. matching . *and* \n in a char class

5. RegExp Char Class

6. backslash escaping not metacharacters in a char class

7. different handling of = on unix and windows (in char class)

8. different handling of = on unix and windows (in char class)

9. Defining regular expression char class

10. Regexp char class: mixing ranges and negation?

11. regex: ? in char class problem

12. "=>" fails to quote

 

 
Powered by phpBB® Forum Software