summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-01-19 22:46:13 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-01-19 22:46:13 (GMT)
commitcff9237d57dca37c6194148ae4c157452d269764 (patch)
tree48d4e2aa708966f1d1b7311cbaff728b9048c379 /Parser
parent6a7b855a97c57f26d4786a9003757e39a43b322e (diff)
downloadcpython-cff9237d57dca37c6194148ae4c157452d269764.zip
cpython-cff9237d57dca37c6194148ae4c157452d269764.tar.gz
cpython-cff9237d57dca37c6194148ae4c157452d269764.tar.bz2
check after comments, too (#13832)
Diffstat (limited to 'Parser')
-rw-r--r--Parser/parsetok.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index c4b7690..7beb735 100644
--- a/Parser/parsetok.c
+++ b/Parser/parsetok.c
@@ -234,13 +234,23 @@ parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret,
char *cur = tok->cur;
char c = *tok->cur;
- while (c == ' ' || c == '\t' || c == '\n' || c == '\014')
- c = *++cur;
-
- if (c && c != '#') {
- err_ret->error = E_BADSINGLE;
- PyNode_Free(n);
- n = NULL;
+ for (;;) {
+ while (c == ' ' || c == '\t' || c == '\n' || c == '\014')
+ c = *++cur;
+
+ if (!c)
+ break;
+
+ if (c != '#') {
+ err_ret->error = E_BADSINGLE;
+ PyNode_Free(n);
+ n = NULL;
+ break;
+ }
+
+ /* Suck up comment. */
+ while (c && c != '\n')
+ c = *++cur;
}
}
#endif