зеркало из https://github.com/github/ruby.git
* parse.y (yylex): do not accept " __END__\n". ([ruby-dev:19245])
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
67a7c34524
Коммит
c2e3d3971b
|
@ -1,3 +1,7 @@
|
|||
Tue Dec 31 01:30:29 2002 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* parse.y (yylex): do not accept " __END__\n". ([ruby-dev:19245])
|
||||
|
||||
Mon Dec 30 21:10:59 2002 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* parse.y (yylex): use strncmp instead of strcmp.
|
||||
|
|
24
parse.y
24
parse.y
|
@ -3102,14 +3102,14 @@ whole_match_p(eos, len, indent)
|
|||
int len, indent;
|
||||
{
|
||||
char *p = lex_pbeg;
|
||||
int n;
|
||||
|
||||
if (indent) {
|
||||
while (*p && ISSPACE(*p)) p++;
|
||||
}
|
||||
if (strncmp(eos, p, len) == 0) {
|
||||
if (p[len] == '\n' || p[len] == '\r') return Qtrue;
|
||||
if (p + len == lex_pend) return Qtrue;
|
||||
}
|
||||
n= lex_pend - (p + len);
|
||||
if (n < 0 || n > 0 && p[len] != '\n' && p[len] != '\r') return Qfalse;
|
||||
if (strncmp(eos, p, len) == 0) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
|
@ -4206,6 +4206,15 @@ yylex()
|
|||
}
|
||||
break;
|
||||
|
||||
case '_':
|
||||
if (lex_p - 1 == lex_pbeg && whole_match_p("__END__", 7, 0)) {
|
||||
ruby__end__seen = 1;
|
||||
lex_lastline = 0;
|
||||
return -1;
|
||||
}
|
||||
newtok();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!is_identchar(c) || ISDIGIT(c)) {
|
||||
rb_compile_error("Invalid char `\\%03o' in expression", c);
|
||||
|
@ -4321,13 +4330,6 @@ yylex()
|
|||
}
|
||||
}
|
||||
tokfix();
|
||||
if (strncmp(tok(), "__END__", 7) == 0 &&
|
||||
(lex_p - lex_pbeg == 7 || lex_p - lex_pbeg == 8) &&
|
||||
(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());
|
||||
if ((dyna_in_block() && rb_dvar_defined(last_id)) || local_id(last_id)) {
|
||||
lex_state = EXPR_END;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#define RUBY_VERSION "1.8.0"
|
||||
#define RUBY_RELEASE_DATE "2002-12-30"
|
||||
#define RUBY_RELEASE_DATE "2002-12-31"
|
||||
#define RUBY_VERSION_CODE 180
|
||||
#define RUBY_RELEASE_CODE 20021230
|
||||
#define RUBY_RELEASE_CODE 20021231
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 8
|
||||
#define RUBY_VERSION_TEENY 0
|
||||
#define RUBY_RELEASE_YEAR 2002
|
||||
#define RUBY_RELEASE_MONTH 12
|
||||
#define RUBY_RELEASE_DAY 30
|
||||
#define RUBY_RELEASE_DAY 31
|
||||
|
|
Загрузка…
Ссылка в новой задаче