* parse.y (symbol): symbols should be followed by EXPR_ENDARG.

* parse.y (dsym): ditto.

* parse.y (parser_yylex): strings should be followed by
  EXPR_ENDARG.

* parse.y (parser_yylex): ditto for numbers.

* parse.y (parser_yylex): EXPR_ENDARG after ']' and '}'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-04-20 09:38:16 +00:00
Родитель 22826be640
Коммит 138362834f
2 изменённых файлов: 29 добавлений и 13 удалений

Просмотреть файл

@ -64,6 +64,19 @@ Thu Apr 19 18:37:49 2007 Koichi Sasada <ko1@atdot.net>
* test/ruby/test_settracefunc.rb: hook "c-return" of set_trace_func.
Thu Apr 19 20:57:50 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (symbol): symbols should be followed by EXPR_ENDARG.
* parse.y (dsym): ditto.
* parse.y (parser_yylex): strings should be followed by
EXPR_ENDARG.
* parse.y (parser_yylex): ditto for numbers.
* parse.y (parser_yylex): EXPR_ENDARG after ']' and '}'.
Thu Apr 19 17:46:36 2007 Koichi Sasada <ko1@atdot.net>
* lib/optparse.rb: fix to override conv proc.

29
parse.y
Просмотреть файл

@ -66,9 +66,9 @@ int ruby_sourceline; /* current line no. */
enum lex_state_e {
EXPR_BEG, /* ignore newline, +/- is a sign. */
EXPR_END, /* newline significant, +/- is a operator. */
EXPR_ENDARG, /* ditto, and unbound braces. */
EXPR_ARG, /* newline significant, +/- is a operator. */
EXPR_CMDARG, /* newline significant, +/- is a operator. */
EXPR_ENDARG, /* newline significant, +/- is a operator. */
EXPR_MID, /* newline significant, +/- is a operator. */
EXPR_FNAME, /* ignore newline, no reserved words. */
EXPR_DOT, /* right after `.' or `::', no reserved words. */
@ -3773,10 +3773,10 @@ string_dvar : tGVAR
symbol : tSYMBEG sym
{
/*%%%*/
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
$$ = $2;
/*%
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
$$ = dispatch1(symbol, $2);
%*/
}
@ -3791,7 +3791,7 @@ sym : fname
dsym : tSYMBEG xstring_contents tSTRING_END
{
/*%%%*/
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
if (!($$ = $2)) {
yyerror("empty symbol literal");
}
@ -3820,7 +3820,7 @@ dsym : tSYMBEG xstring_contents tSTRING_END
}
}
/*%
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
$$ = dispatch1(dyna_symbol, $2);
%*/
}
@ -5591,7 +5591,7 @@ parser_yylex(struct parser_params *parser)
token = here_document(lex_strterm);
if (token == tSTRING_END) {
lex_strterm = 0;
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
}
}
else {
@ -5599,7 +5599,7 @@ parser_yylex(struct parser_params *parser)
if (token == tSTRING_END || token == tREGEXP_END) {
rb_gc_force_recycle((VALUE)lex_strterm);
lex_strterm = 0;
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
}
}
return token;
@ -5920,7 +5920,7 @@ parser_yylex(struct parser_params *parser)
}
tokfix();
set_yylval_str(rb_str_new(tok(), toklen()));
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
return tCHAR;
case '&':
@ -6069,7 +6069,7 @@ parser_yylex(struct parser_params *parser)
int is_float, seen_point, seen_e, nondigit;
is_float = seen_point = seen_e = nondigit = 0;
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
newtok();
if (c == '-' || c == '+') {
tokadd(c);
@ -6286,7 +6286,10 @@ parser_yylex(struct parser_params *parser)
case '}':
COND_LEXPOP();
CMDARG_LEXPOP();
lex_state = EXPR_END;
if (c == ')')
lex_state = EXPR_END;
else
lex_state = EXPR_ENDARG;
return c;
case ':':
@ -6547,7 +6550,7 @@ parser_yylex(struct parser_params *parser)
case '$':
last_state = lex_state;
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
newtok();
c = nextc();
switch (c) {
@ -6718,11 +6721,11 @@ parser_yylex(struct parser_params *parser)
last_state = lex_state;
switch (tok()[0]) {
case '$':
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
result = tGVAR;
break;
case '@':
lex_state = EXPR_END;
lex_state = EXPR_ENDARG;
if (tok()[1] == '@')
result = tCVAR;
else