bug-a2ps
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a2ps perl.ssh handles s{}{} poorly


From: JOHN MACDONALD, BLOOMBERG/ 731 LEXIN
Subject: a2ps perl.ssh handles s{}{} poorly
Date: Mon, 6 Nov 2006 16:16:35 -0500

I just ignored the fact that I didn't understand the file format and tried to
fix it anyway - this is working correctly for the tests I've run (and the 
original was not, so this is an improvement).  Here's a patch for 
sheets/perl.ssh that can be applied.  (The last time I submitted a patch to a2ps
 was about 15 years ago. :-)
(start of patch)
--- sheets/perl.ssh     2001-10-22 11:40:06.000000000 -0400
+++ /home/jmacd/.a2ps/perl.ssh  2006-11-06 16:11:04.505108000 -0500
@@ -121,7 +121,7 @@
      /\\)[^(]*\\(|/            # The separation
      /([^)]|\\\\.)*/           # Second part
      /)\\)/                    # Closer
-     \1 Keyword_strong, "(" Plain, \1 Plain, ")" Plain),
+     \1 Keyword_strong, "(" Plain, \2 Plain, ")" Plain),
 
     # Substitution and transliteration:
     # two regexps with {}{} as delimiter
@@ -131,7 +131,8 @@
      /\\}[^{]*\\{|/            # The separation
      /([^}]|\\\\.)*/           # Second part
      /)\\}/                    # Closer
-     "s" Keyword_strong, "{" Plain, \1 Plain, "}" Plain),
+     \1 Keyword_strong, "{" Plain, \2 Plain, "}" Plain),
+
 
     # Substitution and transliteration:
     # two regexps with [][] as delimiter
@@ -141,7 +142,7 @@
      /\\][^[]*\\[|/            # The separation
      /([^]]|\\\\.)*/           # Second part
      /)\\]/                    # Closer
-     "s" Keyword_strong, "[" Plain, \1 Plain, "]" Plain)
+     \1 Keyword_strong, "[" Plain, \2 Plain, "]" Plain)
 end operators
 
 sequences are
(end of patch)
----- Original Message -----
To: address@hidden
At: 11/06 15:49:38

The perl.ssh sheet (version 4.13) looks wrong in the way it defines the
"balanced bracketing" forms of the susbstitute/translate command.  When the
code looks like:  s{regexp}{replacement}
it displays as:   s{s}{replacement
The last line for each of the balanced delimiter forms of substitute in perl.ssh
looks like:
    "s" Keyword_strong, "{" Plain, \1 Plain, "}" Plain),
but the "s" should be \1 (to insert either s or tr, depending upon which of the
synonyms was actually used, and the rest should not be using \1 as the body but
I have to confess that I don't see how the existing info in the .ssh file
actually produces the right value for the replacement part, so I can't give an
exact fix.  The .ssh file obviously does not try to ahndle the full range of
possibilities (when the regexp portion of a substitue has balanced delimiters,
the replacement can have different balanced [or even repeated] delimiters, so
that all of the following mean the same:
s{a}{b}
s{a}[b]
s{a}(b}
s{a}/b/
s{a}'b'
s{a}"b"
(The last two differ as to whether variables are interpolated within the
replacement text.)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]