summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2002-08-15 01:20:16 (GMT)
committerSkip Montanaro <skip@pobox.com>2002-08-15 01:20:16 (GMT)
commit118ec70ea27000db428ba3e3a757f4b423670db6 (patch)
treeaa0d92d2928436e81c1e85b8aecf23c9a4f7dd4e /Parser
parent90e9a79afdb0bbee73fbdbe252b305ba918e46c3 (diff)
downloadcpython-118ec70ea27000db428ba3e3a757f4b423670db6.zip
cpython-118ec70ea27000db428ba3e3a757f4b423670db6.tar.gz
cpython-118ec70ea27000db428ba3e3a757f4b423670db6.tar.bz2
provide less mysterious error messages when seeing end-of-line in
single-quoted strings or end-of-file in triple-quoted strings. closes patch 586561.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 64ff320..7e7a370 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -1276,14 +1276,17 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
c = tok_nextc(tok);
if (c == '\n') {
if (!triple) {
- tok->done = E_TOKEN;
+ tok->done = E_EOLS;
tok_backup(tok, c);
return ERRORTOKEN;
}
tripcount = 0;
}
else if (c == EOF) {
- tok->done = E_TOKEN;
+ if (triple)
+ tok->done = E_EOFS;
+ else
+ tok->done = E_EOLS;
tok->cur = tok->inp;
return ERRORTOKEN;
}
@@ -1305,7 +1308,7 @@ tok_get(register struct tok_state *tok, char **p_start, char **p_end)
tripcount = 0;
c = tok_nextc(tok);
if (c == EOF) {
- tok->done = E_TOKEN;
+ tok->done = E_EOLS;
tok->cur = tok->inp;
return ERRORTOKEN;
}