Issue 796116: Parser wart - Python tracker (original) (raw)
Logged In: YES user_id=539787
History: this wart (keywords legally appended to numeric constants, which keywords don't start with 'e', 'f', and 'd' perhaps) appears in all languages I have used in my life (well, except for the ZX Spectrum 48K Basic, where eg. the 1.5 keypress for 'and' produced ' and ' forcefully :)
The easiest way would be to have a significant_whitespace node in Grammar/Grammar, which would be inserted just before the 'and' and 'or' keywords in and_test and or_test, but Grammar does not deal with whitespace. Let's look parsemodule.c... could one SIG_WHITESPACE token be produced? Also, what about line continuations having 'and' or 'or' in the beginning of a physical line?
I believe this wart should be eliminated only if letter suffixes are allowed to numeric constants, which I doubt will happen; I'd suggest to lower the priority of this unless somebody finds a quick-n-dirty solution. Not that important.