ericP
ericP

Reputation: 1935

How do I fix "Unescaped left brace in regex is deprecated" error in Parse::Yapp?

The Parse::Yapp currently shiping on Ubuntu 16.04 (xenial) is slightly behind perl in that it uses unescaped '{'s in regular expressions. The error message indicates that it's in YappParse.yp which doesn't exist. In the interest of patching it locally until a new version of Parse::Yapp comes down the pipe, what template file is it in?

{yapp}

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\G{ <-- HERE / at YappParse.yp line 288.
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\G%{ <-- HERE / at YappParse.yp line 315.

Upvotes: 1

Views: 3791

Answers (3)

Dan Anderson
Dan Anderson

Reputation: 2345

This also occurs if you are calling a ksh shell script (such as print) from a non-ksh shell (such as bash).

Upvotes: -1

Schwern
Schwern

Reputation: 165546

Parse::Yapp hasn't had a release since 2001. I wouldn't hold my breath. Since it's effectively unmaintained I'd recommend either moving whatever you're using off of it or taking over maintenance. Consider something like Pegex or Regexp::Grammars instead.

Fortunately this problem has been reported twice, both contain patches. See rt.cpan.org 114776 and rt.cpan.org 10668.

Maintenance has been picked up and 1.20 appears to fix the problem.

Upvotes: 1

ericP
ericP

Reputation: 1935

perldb's stack trace revealed (or implied that) the file is Parse/Yapp/Parse.pm. Here's a patch:

diff -u /usr/share/perl5/Parse/Yapp/Parse.pm{~,}
--- /usr/share/perl5/Parse/Yapp/Parse.pm~   2001-05-20 07:19:57.000000000 -0400
+++ /usr/share/perl5/Parse/Yapp/Parse.pm    2016-09-18 02:12:09.116799976 -0400
@@ -880,7 +880,7 @@
         return($1, [ $1, $lineno[0] ]);
     };

-        $$input=~/\G{/gc
+        $$input=~/\G\{/gc
     and do {
         my($level,$from,$code);

@@ -907,7 +907,7 @@
         and return('START',[ undef, $lineno[0] ]);
             $$input=~/\G%(expect)/gc
         and return('EXPECT',[ undef, $lineno[0] ]);
-            $$input=~/\G%{/gc
+            $$input=~/\G%\{/gc
         and do {
             my($code);

Hopefully this will save others some detective work.

Upvotes: 1

Related Questions