To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.admin.generalOpen lugnet.admin.general in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Administrative / General / 13644
13643  |  13645
Subject: 
Bug fix for disappearing backslash (was: Re: Disappearing backslash?)
Newsgroups: 
lugnet.admin.general
Date: 
Wed, 2 Aug 2006 20:44:18 GMT
Viewed: 
6372 times
  
In lugnet.admin.general, Steve Bliss wrote:
In lugnet.admin.general, Rene Hoffmeister wrote:
E.g. \ldraw\par\ts\s would become ldraw\parts\s too...
Wow, that's really weird.  Ya gotta love PML...

Hmm, that *is* weird.  This isn't actually a PML thing, though, but an FTX
thing.  The FTX-to-HTML converter runs as a seperate self-contained module;
all PML parsing occurs prior to the FTX-to-HTML conversion.

The backslash in FTX was intended to work with things like [ ] { } < > | _
rather than with letters, and was later replaced by the backtick, which
happens to exhibit the same strange behavior.

This behavior is definitely a bug in Fibblesnork::Text::Munge -- and it
looks like it's been there for 8 years (sorry).

The problem is that the $esc flag isn't being cleared in the s{}{}egx
substitution when a character is encountered that isn't a special character
(`\{}[]_|<>¬), because it's only matching on special characters.

Consequently, the $esc flag is toggled at every occurrence of the backslash
or backtick when it's accidentally used before a letter.

Thus, if you write \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z,
the backslash will show for every other letter, e.g.: bdfhjlnprtvxz, which
is why it's been so perplexingly unpredictable -- it has nothing to do with
the actual letter being escaped.

One way to fix the bug without introducing a gross inefficiency in the
s{}{}egx operation would be to pre-collapse any errant escapements just
prior to executing the s{}{}egx.  Something like this:

   my $ESCAPERS =
      " \\`
      | \\\\
      ";

   my $ESCAPABLES =
      " \\`
      | \\\
      | \\\{
      | \\\}
      | \\\[
      | \\\]
      | \\\|
      | \\_
      | &lt;
      | &gt;
      | &not;
      | \s
      ";

   ...

   s{(?:$ESCAPERS)(?!$ESCAPABLES)}{}go;

This simply removes any \ or ` characters which happen to accidentally
be followed by a character that's not defined as being escapable.

Note:  It *may* make more sense, for practical reasons, to actually keep
backslashes in front of letters, instead of removing them, in which case
the following could be done instead:

   s{($ESCAPERS)($ESCAPABLES)}{$1$1$2}go;

--Todd



Message has 1 Reply:
  Re: Bug fix for disappearing backslash (was: Re: Disappearing backslash?)
 
(...) I miss my Todd Lehman. Good to see you around buddy! (18 years ago, 9-Aug-06, to lugnet.admin.general)

Message is in Reply To:
  Re: Disappearing backslash? (was: parts i'd like to see in Lcad/MLcad)
 
(...) Wow, that's really weird. Ya gotta love PML... Steve (18 years ago, 2-Aug-06, to lugnet.admin.general)

23 Messages in This Thread:





Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR