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

Bug#373649: enscript sh and ksh highlighting problem with escaped quotes



Package: enscript
Version: 1.6.4-7

Binary package hint: enscript

Take the following script:

#!/usr/bin/ksh
echo \"foo=bar\"/\"baz=quux\"
echo "and here's some other stuff"
for i in foo bar baz quux
do
  echo $i
done

...which I've also attached. In gview, those escaped double-quotes are
handled properly, and syntax hightlighting works. With enscript, using
either sh or ksh highlighting, the first double-quote turns on the
highlighting for "this is quoted stuff", but the rest are ignored until
the first unescaped double-quote is encountered.

The enscript command line was "cat enscriptbug | enscript
--highlight=ksh --color -r -p enscriptbug.ps"


Attached is a patch.  I submitted this bug in Malone since it affects
Ubuntu, and found that the package maintainer listed there is an
invalid debian.org address; might want to address that too.  Also
submitted to gnu.org, but no response.


-- 
   Shawn McMahon    | "I can see the light at the end of the tunnel.
   EIV Consulting   | And now that I have some light, I can see the
 http://www.eiv.com | tunnel needs painting too." - Steve Jackson
diff -Naur enscript-1.6.4.orig/states/hl/ksh.st enscript-1.6.4/states/hl/ksh.st
--- enscript-1.6.4.orig/states/hl/ksh.st	2006-06-04 07:53:21.000000000 -0400
+++ enscript-1.6.4/states/hl/ksh.st	2006-06-04 07:54:24.000000000 -0400
@@ -34,6 +34,17 @@
     reference_face (false);
   }
 
+  /* Ignore escaped quote marks */
+  /\\\"/ {
+    language_print ($0);
+  }
+  /\\\'/ {
+    language_print ($0);
+  }
+  /\\\`/ {
+    language_print ($0);
+  }
+
   /* Keywords:
      (build-re '(: alias bg break continue cd command eval exec exit export
      fc fg getopts hash jobs kill let login newgrp print pwd read readonly
diff -Naur enscript-1.6.4.orig/states/hl/sh.st enscript-1.6.4/states/hl/sh.st
--- enscript-1.6.4.orig/states/hl/sh.st	2006-06-04 07:53:21.000000000 -0400
+++ enscript-1.6.4/states/hl/sh.st	2006-06-04 07:54:39.000000000 -0400
@@ -30,6 +30,17 @@
     reference_face (false);
   }
 
+  /* Ignore escaped quote marks */
+  /\\\"/ {
+    language_print ($0);
+  }
+  /\\\'/ {
+    language_print ($0);
+  }
+  /\\\`/ {
+    language_print ($0);
+  }
+
   /* Keywords. */
   /\b(CDPATH|HOME|IFS|MAIL((CHECK)?|(PATH)?)|P(ATH|S(1|2))|SH(ACCT|ELL)|\
 break|c(ase|d|ontinue)|do(ne)?|e(cho|lse|sac|val|x(ec|it|port))|f(i|or)|\

Attachment: pgpGx7Sl4QrDj.pgp
Description: PGP signature


Reply to: