diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-06-24 07:59:02 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-06-24 07:59:02 +0000 |
commit | 05b4ec8683884ac9bd6ccde53e351ffe6562dc3d (patch) | |
tree | 8c7573b130066f797c9cfe663868a6d0df69e8fa /parse.y | |
parent | 9020b60483daf3712fde61e8b07e3eadb85a4bee (diff) |
* 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
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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; } |