How to in Python

MartinRinehart at gmail.com MartinRinehart at gmail.com
Fri Dec 21 14:02:17 EST 2007



Chris Mellon wrote:
> Is there some reason that you think Python is incapable of
> implementing lexers that do this, just because Python lexer accepts
> it?

Absolutely not. My opinion is that it's a bug. A very, very minor bug,
but still six-legged.

> Note that if you're using your lexer to mark up or pretty print or
> whatever Python source, it's wrong - 0x is (rightly or not) a valid
> Python literal.

My lexer is for my language, Decaf, which, in this particular, is the
same as Python. Here's what I find at at python.org/ref: (2.4.4).

    hexinteger ::= "0" ("x" | "X") hexdigit+

Implementation differs from specification. In this case, I think the
spec is more sensible.



More information about the Python-list mailing list