slight error parsing Perl

Issue #135 resolved
Former user created an issue

There's a subtlety in Perl parsing that Pygments gets wrong: reserved words can be safely used as hash keys, without any kind of quoting or escaping. Here's the example I created to highlight the (more extreme) version of this bug in BBedit. The "y" is being parsed as the operator y.


use strict;

my %foo;

$foo{a} = 1;

$foo{x} = 0;

my %bar = (y=>1,z=>1,x=>1);

$foo{y} = f1() + f2() + f3();

sub f1 {return 0}

sub f2 {return 1}

sub f3 {return 2}

Reported by

Comments (2)

  1. gbrandl

    I'm afraid introducing a special case here is too complicated -- we'll have to live with these errors. After all, the only thing that can parse perl is perl :)

  2. Log in to comment