[Patches] [ python-Patches-586561 ] Better token-related error messages

noreply@sourceforge.net noreply@sourceforge.net
Fri, 02 Aug 2002 11:05:51 -0700


Patches item #586561, was opened at 2002-07-25 11:21
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=586561&group_id=5470

Category: Parser/Compiler
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Jeremy Hylton (jhylton)
Summary: Better token-related error messages

Initial Comment:
There were some complaints recently on c.l.py about the rather 
non-informative error messages emitted as a result of the tokenizer 
detecting a problem.  In many situations it simply returns 
E_TOKEN which generates a fairly benign, but often unhelpful 
"invalid token" message.

This patch adds several new E_* macrosto Includes/errorcode.h, 
returns them from the appropriate places in Parser/tokenizer.c and 
generates more specific messages in Python/pythonrun.c.  I think the 
error messages are always better, though in some situations they may 
still not be strictly correct.

Assigning to Jeremy since he's the compiler wiz.

Skip


----------------------------------------------------------------------

>Comment By: Skip Montanaro (montanaro)
Date: 2002-08-02 13:05

Message:
Logged In: YES 
user_id=44345

re: i vs. j

Perhaps it's not needed.  The patch was originally designed to address 
the case of runaway triple-quoted strings.  Someone on c.l.py ranted 
about that.  While I was in there, I recalled someone else (perhaps more 
than one person) had berated Python in the past because imaginary 
numbers use 'j' instead of 'i' and decided to stick it in.  It's no big deal to 
take it out.

(When you think about it, they are all corner cases, since most of the 
time the code is syntactically correct. ;-)

S


----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2002-08-02 12:54

Message:
Logged In: YES 
user_id=31392

Is the warning about i vs. j for complex numbers really 
necessary?  It seems like it adds extra, well, complexity 
for a tiny corner case.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=586561&group_id=5470