* parse.y (yylex): __END__ should not be effective within

string literals.

* parse.y (here_document): should be aware of __END__ within here
  documents.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-06-24 07:59:02 +00:00
parent 9020b60483
commit 05b4ec8683
4 changed files with 23 additions and 9 deletions

View File

@ -23,6 +23,11 @@ Sun Jun 23 00:19:10 2002 Tadayoshi Funaba <tadf@dotrb.org>
* lib/date.rb, lib/date/format.rb, sample/cal.rb, sample/goodfriday.rb:
updated to the new version (based on date2 3.3).
Fri Jun 21 18:49:58 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (yylex): __END__ should not be effective within
string literals.
Thu Jun 20 21:09:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* ext/readline/readline.c (readline_readline): get rid of
@ -42,6 +47,11 @@ Wed Jun 19 14:46:18 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* ext/extmk.rb, lib/mkmf.rb (xsystem): open the log file if xsystem
is called.
Wed Jun 19 01:01:13 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (here_document): should be aware of __END__ within here
documents.
Wed Jun 19 00:50:50 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* parse.y (yylex): ? followed by successive word charaters is
@ -64,6 +74,10 @@ Tue Jun 18 12:50:17 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* parse.y (logop): ditto.
Mon Jun 17 11:11:34 2002 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* string.c (rb_str_crypt): result need not be tainted always.
Mon Jun 17 10:51:37 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* dln.c (dln_load): need to preserve dln_strerror() result,

1
lex.c
View File

@ -65,7 +65,6 @@ hash (str, len)
return hval + asso_values[(unsigned char)str[len - 1]];
}
static
#ifdef __GNUC__
__inline
#endif

View File

@ -95,8 +95,7 @@ class PStore
file.flock(read_only ? File::LOCK_SH : File::LOCK_EX)
if read_only
@table = Marshal::load(file)
elsif orig
content = file.read
elsif orig and (content = file.read) != nil
@table = Marshal::load(content)
size = content.size
md5 = Digest::MD5.digest(content)

14
parse.y
View File

@ -1778,6 +1778,7 @@ strings : string
}
$$ = node;
}
;
string : string1
| string string1
@ -2445,12 +2446,6 @@ nextc()
ruby_sourceline++;
lex_pbeg = lex_p = RSTRING(v)->ptr;
lex_pend = lex_p + RSTRING(v)->len;
if (!lex_strterm && strncmp(lex_pbeg, "__END__", 7) == 0 &&
(RSTRING(v)->len == 7 || lex_pbeg[7] == '\n' || lex_pbeg[7] == '\r')) {
ruby__end__seen = 1;
lex_lastline = 0;
return -1;
}
lex_lastline = v;
}
else {
@ -4182,6 +4177,13 @@ yylex()
}
}
tokfix();
if (strcmp(tok(), "__END__") == 0 &&
lex_p - lex_pbeg == 7 &&
(lex_pend == lex_p || *lex_p == '\n' || *lex_p == '\r')) {
ruby__end__seen = 1;
lex_lastline = 0;
return -1;
}
last_id = yylval.id = rb_intern(tok());
return result;
}