So you want to warn if the file contains a print statement w/o from __future__ 
import print_function?  What if it's a call to print such as print('foo')  
which is valid in both 2.x and 3.x?

Either way you should be able to just update ParsePrintStmt in Parser.cs.    
But dealing w/ the case of the parens would be a little more difficult - but I 
think you can just peek at the next token after print and see if it's a 
parenthesis right after we eat the print keyword.  

-----Original Message-----
From: Jeff Hardy [mailto:jdha...@gmail.com] 
Sent: Tuesday, October 11, 2011 9:26 AM
To: Markus Schaber; Dino Viehland
Cc: ironpython-users@python.org
Subject: Re: [Ironpython-users] Warn user when using old print syntax

I think you'd have to patch the code to add the print check to the -3 warnings. 
Dino might be able to point out where you would do that.

- Jeff

On Tue, Oct 11, 2011 at 9:13 AM, Markus Schaber <m.scha...@3s-software.com> 
wrote:
> Hi,
>
> What is the easiest way to detect and warn the user when he uses the old 
> print syntax?
>
> It seems that "-3" aka "WarnPy3k" does not warn about it, and a simple check 
> whether the user does "from __future__ import print_function" gives false 
> positives if the user does not print at all.
>
> Thanks!
>
> Best regards
>
> Markus Schaber
> --
> ___________________________
> We software Automation.
>
> 3S-Smart Software Solutions GmbH
> Markus Schaber | Developer
> Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | 
> Fax +49-831-54031-50
>
> Email: m.scha...@3s-software.com | Web: http://www.3s-software.com 
> CoDeSys internet forum: http://forum.3s-software.com Download CoDeSys 
> sample projects: 
> http://www.3s-software.com/index.shtml?sample_projects
>
> Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | 
> Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915
>
>
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users@python.org
> http://mail.python.org/mailman/listinfo/ironpython-users
>

_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to