summaryrefslogtreecommitdiffstats
path: root/Parser/tokenizer.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-07-11 17:53:00 (GMT)
committerFred Drake <fdrake@acm.org>2000-07-11 17:53:00 (GMT)
commit85f363990cbd6df21015eebdc171c533176e3407 (patch)
tree4aa69857ffe21991384e379799f42ba308a58086 /Parser/tokenizer.c
parent88e1932930245b2f7ed300ff8b31034db7ecda5b (diff)
downloadcpython-85f363990cbd6df21015eebdc171c533176e3407.zip
cpython-85f363990cbd6df21015eebdc171c533176e3407.tar.gz
cpython-85f363990cbd6df21015eebdc171c533176e3407.tar.bz2
Create two new exceptions: IndentationError and TabError. These are
used for indentation related errors. This patch includes Ping's improvements for indentation-related error messages. Closes SourceForge patches #100734 and #100856.
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r--Parser/tokenizer.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 0ef3fc0..d4ec345 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -412,13 +412,13 @@ indenterror(tok)
struct tok_state *tok;
{
if (tok->alterror) {
- tok->done = E_INDENT;
+ tok->done = E_TABSPACE;
tok->cur = tok->inp;
return 1;
}
if (tok->altwarning) {
- PySys_WriteStderr("%s: inconsistent tab/space usage\n",
- tok->filename);
+ PySys_WriteStderr("%s: inconsistent use of tabs and spaces "
+ "in indentation\n", tok->filename);
tok->altwarning = 0;
}
return 0;
@@ -484,9 +484,7 @@ PyTokenizer_Get(tok, p_start, p_end)
else if (col > tok->indstack[tok->indent]) {
/* Indent -- always one */
if (tok->indent+1 >= MAXINDENT) {
- PySys_WriteStderr(
- "excessive indent\n");
- tok->done = E_TOKEN;
+ tok->done = E_TOODEEP;
tok->cur = tok->inp;
return ERRORTOKEN;
}
@@ -506,9 +504,7 @@ PyTokenizer_Get(tok, p_start, p_end)
tok->indent--;
}
if (col != tok->indstack[tok->indent]) {
- PySys_WriteStderr(
- "inconsistent dedent\n");
- tok->done = E_TOKEN;
+ tok->done = E_DEDENT;
tok->cur = tok->inp;
return ERRORTOKEN;
}