Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 16834
Status: resolved
Priority: 0/
Queue: PPI

People
Owner: Nobody in particular
Requestors: nospam-abuse [...] bloodgate.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.109
Fixed in: (no value)



Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Subject: "$a = 1 if ($a == 2)" vs "$a = 1 if $a == 2"
X-RT-Original-Encoding: iso-8859-1
Content-Length: 1605
Download (untitled) / with headers
text/plain 1.5k
PPI misses the PPI::Structure::Condition ( ... ) when you leave of the parantheses on "$a = 1 if ($a == 2)" vs "$a = 1 if $a == 2": "$a = 1 if $a == 2": PPI::Document PPI::Statement PPI::Token::Symbol '$s' PPI::Token::Whitespace ' ' PPI::Token::Operator '=' PPI::Token::Whitespace ' ' PPI::Token::Number '1' PPI::Token::Whitespace ' ' PPI::Token::Word 'if' PPI::Token::Whitespace ' ' PPI::Token::Symbol '$a' PPI::Token::Whitespace ' ' PPI::Token::Operator '==' PPI::Token::Whitespace ' ' PPI::Token::Number '9' "$a = 1 if ($a == 2)": PPI::Document PPI::Statement PPI::Token::Symbol '$s' PPI::Token::Whitespace ' ' PPI::Token::Operator '=' PPI::Token::Whitespace ' ' PPI::Token::Number '1' PPI::Token::Whitespace ' ' PPI::Token::Word 'if' PPI::Token::Whitespace ' ' PPI::Structure::Condition ( ... ) PPI::Statement::Expression PPI::Token::Symbol '$a' PPI::Token::Whitespace ' ' PPI::Token::Operator '==' PPI::Token::Whitespace ' ' PPI::Token::Number '9' This makes it very hard to recognize the statement from third-party code, even though Perl treats both constructs the same. Just including a "::Condition" would inject "()" if you do a $element->content(), though, so I am unsure what the best solution is. A "silent" or "invisible" flag on PPI::Statement::Condition? Best wishes, Tels
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.5.HEAD-25088-1149363284-935.16834-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 487
Download (untitled) / with headers
text/plain 487b
NOTABUG A structure just refers to a ( ) syntacic structure, and ::Condition only refers to it's syntactic type. Since there is no syntactic structure there, and the fact it is a logically is only logically infered, and since PPI only handles syntax, and is very limited in regard to meaning, this current behaviour is the expected behaviour. Any logic to detect the lexical meaning of the post-if in that case MUST be added to the analysis code above the level of the parser itself.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.