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 | 95924d795013222339aa201ec5f9a508660f8e83 (patch) | |
| tree | 8c7573b130066f797c9cfe663868a6d0df69e8fa /parse.y | |
| parent | 547ad0098b092407a6234f765099dca536137ef8 (diff) | |
| download | ruby-95924d795013222339aa201ec5f9a508660f8e83.tar.gz ruby-95924d795013222339aa201ec5f9a508660f8e83.tar.xz ruby-95924d795013222339aa201ec5f9a508660f8e83.zip | |
* 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: http://svn.ruby-lang.org/repos/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; } |
