From 05b4ec8683884ac9bd6ccde53e351ffe6562dc3d Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 24 Jun 2002 07:59:02 +0000 Subject: * 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 --- parse.y | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 9708cac213..60c54a1500 100644 --- a/parse.y +++ b/parse.y @@ -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; } -- cgit v1.2.3