#272 Syntax colouring wrong for ? within qq {} block

Chris Beck

If I have the following block

my $sql = qq {
select * from table where key = ?

then the rest of the file treats the ? as the beginning
of a $test ? $true : $false block for the purposes of

if I remove the space between the qq and the { then the
problem does not occur.


  • Jan Ploski

    Jan Ploski - 2006-07-20

    Logged In: YES

    The problem is that the 'qq' is not recognised as a quote
    operator if there is a whitespace following it instead of a
    delimiter character.

    I'm afraid it will have to stay this way - no whitespace
    after quote operators in front of delimiters. If this bug
    was fixed, then typing "qq" in front of a space (and, as a
    matter of fact, also typing "q", "m", "s" etc.) would
    immediately cause the parser to interpret it as the start
    of a quote expression. This is undesired because it causes
    major delays when editing a large file: you start out
    typing "my $x" somewhere in the middle of the file, and
    after you press "m" the whole rest of the file is coloured
    differently because the parser thinks you are about to
    enter a m/atch/. I could make an exception for qq, qx, qw,
    and qr, but I am not sure if it is a good idea. It would
    make the parser's behaviour inconsistent.

  • Nobody/Anonymous

    Logged In: NO

    it fails also with this expression

    my $back = (
    $ENV{REQUEST_URI} =~ '/query/logoff.cgi'
    ? $self->query->param('back') || $self->global->config->appDir
    : uri_escape( $ENV{REQUEST_URI} )

    if I remove the ? everything is ok.

  • Jan Ploski

    Jan Ploski - 2006-10-27

    Logged In: YES

    This latest problem has easy workarounds. For example write m'/query/logoff.cgi' to convince EPIC that you
    are matching a regular expression or put parentheses around the left-hand-side expression of ?, as follows:

    ($ENV{REQUEST_URI} =~ '/query/logoff.cgi') ? ...

  • carl manaster

    carl manaster - 2006-12-26

    Logged In: YES
    Originator: NO

    I suspect this may be related; in the following code, everything after the question mark is colored in the keyword color:

    sub endsWithXxx($) {
    my $a = shift();
    return $a =~ ".*\.xxx" ? 1 : 0;

    sub notice_nothing_is_syntax_hilited($) {
    my $a = shift();



Log in to post a comment.