On Sat, 22 Dec 2007 14:03:09 -0800, MartinRinehart wrote:
> Tokenizer accepts "0x" as zero. Spec says its an error not to have at
> least one hex digit after "0x".
>
> This is a more serious bug than I had originally thought. Consider this:
>
> Joe types "security_code = 0x" and then goes off to
On Dec 22, 5:03 pm, [EMAIL PROTECTED] wrote:
> Tokenizer accepts "0x" as zero. Spec says its an error not to have at
> least one hex digit after "0x".
>
> This is a more serious bug than I had originally thought. Consider
> this:
>
> Joe types "security_code = 0x" and then goes off to the Guardian
Tokenizer accepts "0x" as zero. Spec says its an error not to have at
least one hex digit after "0x".
This is a more serious bug than I had originally thought. Consider
this:
Joe types "security_code = 0x" and then goes off to the Guardian-of-
the-Codes to get the appropriate hex string. Returnin
Tokenizer bug reported.
[EMAIL PROTECTED] wrote:
> >>>int('0x', 16)
> 0
>
> I'm working on a tokenizer and I'm thinking about returning a
> MALFORMED_NUMBER token (1.2E, .5E+)
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth wrote:
> Why would you return a token rather than throwing an exception?
Tokenizers have lots of uses. Colorizing text in an editor, for
example. We've got a MALFORMED_NUMBER when you type '0x'. We've got an
INTEGER when we get your next keystroke (probably).
--
http://mail.python.
"Duncan Booth" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| [EMAIL PROTECTED] wrote under the subject line "Is this a
| bug in int()?":
| >>>>int('0x', 16)
| > 0
| >
| I think it is a general problem in the tokenizer, not
[EMAIL PROTECTED] wrote:
int('0x', 16)
> 0
>
> I'm working on a tokenizer and I'm thinking about returning a
> MALFORMED_NUMBER token (1.2E, .5E+)
Somewhat surprisingly, "0x" is a valid integer literal in Python:
>>> 0x
0
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote under the subject line "Is this a
bug in int()?":
>>>>int('0x', 16)
> 0
>
I think it is a general problem in the tokenizer, not just the 'int'
constructor. The syntax for integers says:
hexinteger ::= "0"
>>>int('0x', 16)
0
I'm working on a tokenizer and I'm thinking about returning a
MALFORMED_NUMBER token (1.2E, .5E+)
--
http://mail.python.org/mailman/listinfo/python-list