summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-04-11 19:16:25 (GMT)
committerGuido van Rossum <guido@python.org>1997-04-11 19:16:25 (GMT)
commit2d45be1366162fe3b8b6b5771b1968cc7a6d9256 (patch)
tree2e1e20e226a7d521ef1cb05d8072529c1675a9e8 /Parser
parent3648884490953f52e749f1725b5e1d486d4cbcc6 (diff)
downloadcpython-2d45be1366162fe3b8b6b5771b1968cc7a6d9256.zip
cpython-2d45be1366162fe3b8b6b5771b1968cc7a6d9256.tar.gz
cpython-2d45be1366162fe3b8b6b5771b1968cc7a6d9256.tar.bz2
(Jack:) On the Mac, give syntax error on \r.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 165e8be..3bf0fee 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -303,13 +303,16 @@ tok_nextc(tok)
done = tok->inp[-1] == '\n';
}
tok->cur = tok->buf + cur;
+#ifndef macintosh
/* replace "\r\n" with "\n" */
+ /* For Mac we leave the \r, giving a syntax error */
pt = tok->inp - 2;
if (pt >= tok->buf && *pt == '\r') {
*pt++ = '\n';
*pt = '\0';
tok->inp = pt;
}
+#endif
}
if (tok->done != E_OK) {
if (tok->prompt != NULL)
@@ -560,6 +563,14 @@ tok_get(tok, p_start, p_end)
return NEWLINE;
}
+#ifdef macintosh
+ if (c == '\r') {
+ fprintf(stderr, "File contains \\r characters (incorrect line endings?)\n");
+ tok->done = E_TOKEN;
+ tok->cur = tok->inp;
+ return ERRORTOKEN;
+ }
+#endif
/* Period or number starting with period? */
if (c == '.') {
c = tok_nextc(tok);