aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y14
1 files changed, 11 insertions, 3 deletions
diff --git a/parse.y b/parse.y
index 935f678efd..e43f3fe031 100644
--- a/parse.y
+++ b/parse.y
@@ -2897,6 +2897,14 @@ here_document(term, indent)
case '"':
case '`':
while ((c = nextc()) != term) {
+ switch (c) {
+ case -1:
+ rb_compile_error("unterminated here document identifier meets end of file");
+ return 0;
+ case '\n':
+ rb_compile_error("unterminated here document identifier meets end of line");
+ return 0;
+ }
tokadd(c);
}
if (term == '\'') term = 0;
@@ -2929,8 +2937,8 @@ here_document(term, indent)
error:
ruby_sourceline = linesave;
rb_compile_error("can't find string \"%s\" anywhere before EOF", eos);
- free(eos);
- return 0;
+ free(eos);
+ return 0;
}
ruby_sourceline++;
p = RSTRING(line)->ptr;
@@ -3069,7 +3077,7 @@ yylex()
case '*':
if ((c = nextc()) == '*') {
- if (nextc() == '=') {
+ if ((c = nextc()) == '=') {
lex_state = EXPR_BEG;
yylval.id = tPOW;
return tOP_ASGN;