From 2263dbe022c600fb0a1db2bbf968bfce5de65aa2 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 2 Jun 2002 22:16:55 +0000 Subject: [PATCH] * parse.y (here_document): check if identifier is terminated. (ruby-bugs-ja:PR#239) * parse.y (yylex): should pushback proper char after '**'. (ruby-bugs-ja:PR#240) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ parse.y | 14 +++++++++++--- version.h | 4 ++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec0fc995d2..255af93df9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mon Jun 3 07:07:07 2002 Nobuyoshi Nakada + + * parse.y (here_document): check if identifier is terminated. + (ruby-bugs-ja:PR#239) + + * parse.y (yylex): should pushback proper char after '**'. + (ruby-bugs-ja:PR#240) + Sat Jun 1 19:20:07 2002 Masaki Suketa * ext/win32ole: merge from rough 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; diff --git a/version.h b/version.h index 3fc569cf08..818a96a057 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.7.2" -#define RUBY_RELEASE_DATE "2002-05-30" +#define RUBY_RELEASE_DATE "2002-06-03" #define RUBY_VERSION_CODE 172 -#define RUBY_RELEASE_CODE 20020530 +#define RUBY_RELEASE_CODE 20020603