mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (parser_yylex): check EOF explicitly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
45ea81a492
commit
d563f1680c
2 changed files with 15 additions and 11 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Tue Oct 28 21:31:55 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* parse.y (parser_yylex): check EOF explicitly.
|
||||||
|
|
||||||
Tue Oct 28 20:59:12 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
Tue Oct 28 20:59:12 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (extract_binmode): new function to extract binmode/textmode
|
* io.c (extract_binmode): new function to extract binmode/textmode
|
||||||
|
|
22
parse.y
22
parse.y
|
@ -6790,7 +6790,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
if (IS_ARG()) arg_ambiguous();
|
if (IS_ARG()) arg_ambiguous();
|
||||||
lex_state = EXPR_BEG;
|
lex_state = EXPR_BEG;
|
||||||
pushback(c);
|
pushback(c);
|
||||||
if (ISDIGIT(c)) {
|
if (c != -1 && ISDIGIT(c)) {
|
||||||
c = '+';
|
c = '+';
|
||||||
goto start_num;
|
goto start_num;
|
||||||
}
|
}
|
||||||
|
@ -6824,7 +6824,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
if (IS_ARG()) arg_ambiguous();
|
if (IS_ARG()) arg_ambiguous();
|
||||||
lex_state = EXPR_BEG;
|
lex_state = EXPR_BEG;
|
||||||
pushback(c);
|
pushback(c);
|
||||||
if (ISDIGIT(c)) {
|
if (c != -1 && ISDIGIT(c)) {
|
||||||
return tUMINUS_NUM;
|
return tUMINUS_NUM;
|
||||||
}
|
}
|
||||||
return tUMINUS;
|
return tUMINUS;
|
||||||
|
@ -6843,7 +6843,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
return tDOT2;
|
return tDOT2;
|
||||||
}
|
}
|
||||||
pushback(c);
|
pushback(c);
|
||||||
if (ISDIGIT(c)) {
|
if (c != -1 && ISDIGIT(c)) {
|
||||||
yyerror("no .<digit> floating literal anymore; put 0 before dot");
|
yyerror("no .<digit> floating literal anymore; put 0 before dot");
|
||||||
}
|
}
|
||||||
lex_state = EXPR_DOT;
|
lex_state = EXPR_DOT;
|
||||||
|
@ -6868,7 +6868,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
if (c == 'x' || c == 'X') {
|
if (c == 'x' || c == 'X') {
|
||||||
/* hexadecimal */
|
/* hexadecimal */
|
||||||
c = nextc();
|
c = nextc();
|
||||||
if (ISXDIGIT(c)) {
|
if (c != -1 && ISXDIGIT(c)) {
|
||||||
do {
|
do {
|
||||||
if (c == '_') {
|
if (c == '_') {
|
||||||
if (nondigit) break;
|
if (nondigit) break;
|
||||||
|
@ -6916,7 +6916,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
if (c == 'd' || c == 'D') {
|
if (c == 'd' || c == 'D') {
|
||||||
/* decimal */
|
/* decimal */
|
||||||
c = nextc();
|
c = nextc();
|
||||||
if (ISDIGIT(c)) {
|
if (c != -1 && ISDIGIT(c)) {
|
||||||
do {
|
do {
|
||||||
if (c == '_') {
|
if (c == '_') {
|
||||||
if (nondigit) break;
|
if (nondigit) break;
|
||||||
|
@ -6944,7 +6944,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
if (c == 'o' || c == 'O') {
|
if (c == 'o' || c == 'O') {
|
||||||
/* prefixed octal */
|
/* prefixed octal */
|
||||||
c = nextc();
|
c = nextc();
|
||||||
if (c == '_' || !ISDIGIT(c)) {
|
if (c == -1 || c == '_' || !ISDIGIT(c)) {
|
||||||
yyerror("numeric literal without digits");
|
yyerror("numeric literal without digits");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7003,7 +7003,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int c0 = nextc();
|
int c0 = nextc();
|
||||||
if (!ISDIGIT(c0)) {
|
if (c == -1 || !ISDIGIT(c0)) {
|
||||||
pushback(c0);
|
pushback(c0);
|
||||||
goto decode_num;
|
goto decode_num;
|
||||||
}
|
}
|
||||||
|
@ -7092,7 +7092,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
lex_state = EXPR_DOT;
|
lex_state = EXPR_DOT;
|
||||||
return tCOLON2;
|
return tCOLON2;
|
||||||
}
|
}
|
||||||
if (lex_state == EXPR_END || lex_state == EXPR_ENDARG || ISSPACE(c)) {
|
if (lex_state == EXPR_END || lex_state == EXPR_ENDARG || (c != -1 && ISSPACE(c))) {
|
||||||
pushback(c);
|
pushback(c);
|
||||||
lex_state = EXPR_BEG;
|
lex_state = EXPR_BEG;
|
||||||
return ':';
|
return ':';
|
||||||
|
@ -7251,7 +7251,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
|
|
||||||
c = nextc();
|
c = nextc();
|
||||||
quotation:
|
quotation:
|
||||||
if (!ISALNUM(c)) {
|
if (c == -1 || !ISALNUM(c)) {
|
||||||
term = c;
|
term = c;
|
||||||
c = 'Q';
|
c = 'Q';
|
||||||
}
|
}
|
||||||
|
@ -7401,7 +7401,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
do {
|
do {
|
||||||
tokadd(c);
|
tokadd(c);
|
||||||
c = nextc();
|
c = nextc();
|
||||||
} while (ISDIGIT(c));
|
} while (c != -1 && ISDIGIT(c));
|
||||||
pushback(c);
|
pushback(c);
|
||||||
if (last_state == EXPR_FNAME) goto gvar;
|
if (last_state == EXPR_FNAME) goto gvar;
|
||||||
tokfix();
|
tokfix();
|
||||||
|
@ -7426,7 +7426,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
tokadd('@');
|
tokadd('@');
|
||||||
c = nextc();
|
c = nextc();
|
||||||
}
|
}
|
||||||
if (ISDIGIT(c)) {
|
if (c != -1 && ISDIGIT(c)) {
|
||||||
if (tokidx == 1) {
|
if (tokidx == 1) {
|
||||||
compile_error(PARSER_ARG "`@%c' is not allowed as an instance variable name", c);
|
compile_error(PARSER_ARG "`@%c' is not allowed as an instance variable name", c);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue