summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-15 12:58:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-15 12:58:59 +0000
commit2d6538a7c8358ba494eec1495970d35297bb3668 (patch)
tree093b660451676e23f0c6d87b629d9e67d1824756 /parse.y
parentdef2a2cb3f6f81fd0870c93f1a257fa14a0a6aa7 (diff)
parse.y: newline in heredoc identifier
* parse.y (parser_heredoc_identifier): warn newline in here document identifier. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y5
1 files changed, 5 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index 1935160fb2..cf05a9c891 100644
--- a/parse.y
+++ b/parse.y
@@ -6406,6 +6406,7 @@ parser_heredoc_identifier(struct parser_params *parser)
int c = nextc(), term, func = 0;
int token = tSTRING_BEG;
long len;
+ int newline = 0;
if (c == '-') {
c = nextc();
@@ -6432,11 +6433,15 @@ parser_heredoc_identifier(struct parser_params *parser)
term = c;
while ((c = nextc()) != -1 && c != term) {
if (tokadd_mbchar(c) == -1) return 0;
+ if (c == '\n') newline = 1;
}
if (c == -1) {
compile_error(PARSER_ARG "unterminated here document identifier");
return 0;
}
+ if (newline) {
+ rb_warn0("here document identifier contains newline");
+ }
break;
default: