1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* parse.y (program): clear input strings after all process.

* parse.y (parser_nextc, parser_yylex): should not drop lex_lastline
  while lex_p is valid.  [ruby-dev:32896]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-12-30 04:56:17 +00:00
parent e73a962a65
commit 7494e2ef32
2 changed files with 16 additions and 6 deletions

View file

@ -1,3 +1,10 @@
Sun Dec 30 13:56:15 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (program): clear input strings after all process.
* parse.y (parser_nextc, parser_yylex): should not drop lex_lastline
while lex_p is valid. [ruby-dev:32896]
Sun Dec 30 10:54:49 2007 NARUSE, Yui <naruse@ruby-lang.org> Sun Dec 30 10:54:49 2007 NARUSE, Yui <naruse@ruby-lang.org>
* configure.in: rm largefile.h. * configure.in: rm largefile.h.

15
parse.y
View file

@ -765,6 +765,8 @@ program : {
$$ = $2; $$ = $2;
parser->result = dispatch1(program, $$); parser->result = dispatch1(program, $$);
%*/ %*/
lex_p = lex_pbeg = lex_pend = 0;
lex_lastline = lex_nextline = 0;
} }
; ;
@ -4851,6 +4853,8 @@ parser_str_new(const char *p, long n, rb_encoding *enc, int func)
return str; return str;
} }
#define lex_goto_eol(parser) (parser->parser_lex_p = parser->parser_lex_pend)
static inline int static inline int
parser_nextc(struct parser_params *parser) parser_nextc(struct parser_params *parser)
{ {
@ -4865,7 +4869,7 @@ parser_nextc(struct parser_params *parser)
if (!lex_input || NIL_P(v = lex_getline(parser))) { if (!lex_input || NIL_P(v = lex_getline(parser))) {
parser->eofp = Qtrue; parser->eofp = Qtrue;
lex_lastline = 0; lex_goto_eol(parser);
return -1; return -1;
} }
} }
@ -4918,7 +4922,6 @@ parser_pushback(struct parser_params *parser, int c)
} }
} }
#define lex_goto_eol(parser) (parser->parser_lex_p = parser->parser_lex_pend)
#define was_bol() (lex_p == lex_pbeg + 1) #define was_bol() (lex_p == lex_pbeg + 1)
#define peek(c) (lex_p != lex_pend && (c) == *lex_p) #define peek(c) (lex_p != lex_pend && (c) == *lex_p)
@ -6064,14 +6067,14 @@ parser_yylex(struct parser_params *parser)
if ((c = nextc()) != '.') { if ((c = nextc()) != '.') {
pushback(c); pushback(c);
pushback('.'); pushback('.');
goto retry; goto retry;
} }
} }
default: default:
--ruby_sourceline; --ruby_sourceline;
case -1: /* EOF no decrement*/
lex_nextline = lex_lastline; lex_nextline = lex_lastline;
lex_p = lex_pend; case -1: /* EOF no decrement*/
lex_goto_eol(parser);
#ifdef RIPPER #ifdef RIPPER
if (c != -1) { if (c != -1) {
parser->tokp = lex_p; parser->tokp = lex_p;
@ -7094,7 +7097,7 @@ parser_yylex(struct parser_params *parser)
case '_': case '_':
if (was_bol() && whole_match_p("__END__", 7, 0)) { if (was_bol() && whole_match_p("__END__", 7, 0)) {
ruby__end__seen = 1; ruby__end__seen = 1;
lex_lastline = 0; parser->eofp = Qtrue;
#ifndef RIPPER #ifndef RIPPER
return -1; return -1;
#else #else