summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-04 14:41:52 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-04 14:41:52 +0900
commit9cdc964d075fc3d21b8ce8456ac88f57a5183ec0 (patch)
tree17437f09c0e18fdaa7d43f3bbc0ebcc547d2181f /parse.y
parent7a51d979cf9c98209b7c1b1d54016348e8124904 (diff)
Do not warn CR inside string literal
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y14
1 files changed, 8 insertions, 6 deletions
diff --git a/parse.y b/parse.y
index c0d4639509..11ef0f77cb 100644
--- a/parse.y
+++ b/parse.y
@@ -6260,11 +6260,6 @@ parser_cr(struct parser_params *p, int c)
p->lex.pcur++;
c = '\n';
}
- else if (!p->cr_seen) {
- p->cr_seen = TRUE;
- /* carried over with p->lex.nextline for nextc() */
- rb_warn0("encountered \\r in middle of line, treated as a mere space");
- }
return c;
}
@@ -8833,7 +8828,14 @@ parser_yylex(struct parser_params *p)
return 0;
/* white spaces */
- case ' ': case '\t': case '\f': case '\r':
+ case '\r':
+ if (!p->cr_seen) {
+ p->cr_seen = TRUE;
+ /* carried over with p->lex.nextline for nextc() */
+ rb_warn0("encountered \\r in middle of line, treated as a mere space");
+ }
+ /* fall through */
+ case ' ': case '\t': case '\f':
case '\13': /* '\v' */
space_seen = 1;
#ifdef RIPPER