On Wed, 5 Jul 2000, Vladimir Marangozov wrote: > Looks fine. +1 on the concept. Yay! > > SyntaxError: expected indent here > > I'd remove the word "here" so that the error msg is self-contained. > "expected indent" & "expected dedent" are fine. Fine with me (more on messages below). > > 4. Added int *expected_ret argument to PyParser_AddToken; on > > a syntax error, PyParser_AddToken (in parser.c) places the > > expected token type (if any) into this output parameter. > > I'd suggest passing a pointer to the perrdetail structure (to the > whole error, that is), instead of a pointer to one of its fields. I did consider that; the reason i eventually decided against it is that munging perrdetail appears to be [parsetok.c] parsetok()'s responsibility, not [parser.c] PyParser_AddToken()'s. The latter doesn't mess with any of the other fields of perrdetail -- and it returns an error code which becomes err_ret->error, so passing in perrdetail gives PyParser_AddToken() two ways of returning the same information. The redundancy and possible future confusion didn't seem worth it. Another alternative is to change the return value so it *isn't* an error code (only a success/fail flag) and then rely on the error code in err_ret->error. I guess if you see a compelling reason for this i don't mind doing it. But is there one? Greg Wilson wrote: > I just did a poll --- only 2 out of 5 programmers in my shouting radius > know what "dedent" means. Is there a more accessible way to phrase the > error message? Indeed. Sorry about that -- i should have realized that it's a fairly cryptic term. "Dedent" seems to have become a standard term within the C code; perhaps we can allow "dedent" in the C code and standardize on "unindent" outside? How about this set of messages, then: SyntaxError: unexpected indent SyntaxError: unexpected unindent SyntaxError: expected indent SyntaxError: expected unindent SyntaxError: unindent did not match any outer indentation level SyntaxError: inconsistent use of tabs and spaces in indentation SyntaxError: too many levels of indentation Hmm. For the record, the section of the reference manual about indentation talks about INDENT and DEDENT tokens. In fact i don't think there's any mention of the word "unindent" in the Python documentation. But outside of the Python docs, "unindent" is clearly a commonly used and understood term in general practice, much more so than "dedent". -- ?!ng
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4