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

* parse.y (IS_BEG): EXPR_CLASS should be treated like EXPR_BEG.

[ruby-core:21453]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2009-01-20 09:37:40 +00:00
parent 0e3ef036e2
commit e8e50de7b5
2 changed files with 16 additions and 10 deletions

View file

@ -1,3 +1,8 @@
Tue Jan 20 18:30:57 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (IS_BEG): EXPR_CLASS should be treated like EXPR_BEG.
[ruby-core:21453]
Tue Jan 20 04:02:44 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Tue Jan 20 04:02:44 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* node.h (rb_thread_raised_clear): should not clear flags other than * node.h (rb_thread_raised_clear): should not clear flags other than

21
parse.y
View file

@ -3434,6 +3434,7 @@ arg_ambiguous()
} }
#define IS_ARG() (lex_state == EXPR_ARG || lex_state == EXPR_CMDARG) #define IS_ARG() (lex_state == EXPR_ARG || lex_state == EXPR_CMDARG)
#define IS_BEG() (lex_state == EXPR_BEG || lex_state == EXPR_MID || lex_state == EXPR_CLASS)
static int static int
yylex() yylex()
@ -3519,7 +3520,7 @@ yylex()
rb_warning("`*' interpreted as argument prefix"); rb_warning("`*' interpreted as argument prefix");
c = tSTAR; c = tSTAR;
} }
else if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { else if (IS_BEG()) {
c = tSTAR; c = tSTAR;
} }
else { else {
@ -3748,7 +3749,7 @@ yylex()
rb_warning("`&' interpreted as argument prefix"); rb_warning("`&' interpreted as argument prefix");
c = tAMPER; c = tAMPER;
} }
else if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { else if (IS_BEG()) {
c = tAMPER; c = tAMPER;
} }
else { else {
@ -3802,7 +3803,7 @@ yylex()
lex_state = EXPR_BEG; lex_state = EXPR_BEG;
return tOP_ASGN; return tOP_ASGN;
} }
if (lex_state == EXPR_BEG || lex_state == EXPR_MID || if (IS_BEG() ||
(IS_ARG() && space_seen && !ISSPACE(c))) { (IS_ARG() && space_seen && !ISSPACE(c))) {
if (IS_ARG()) arg_ambiguous(); if (IS_ARG()) arg_ambiguous();
lex_state = EXPR_BEG; lex_state = EXPR_BEG;
@ -3832,7 +3833,7 @@ yylex()
lex_state = EXPR_BEG; lex_state = EXPR_BEG;
return tOP_ASGN; return tOP_ASGN;
} }
if (lex_state == EXPR_BEG || lex_state == EXPR_MID || if (IS_BEG() ||
(IS_ARG() && space_seen && !ISSPACE(c))) { (IS_ARG() && space_seen && !ISSPACE(c))) {
if (IS_ARG()) arg_ambiguous(); if (IS_ARG()) arg_ambiguous();
lex_state = EXPR_BEG; lex_state = EXPR_BEG;
@ -4093,8 +4094,7 @@ yylex()
case ':': case ':':
c = nextc(); c = nextc();
if (c == ':') { if (c == ':') {
if (lex_state == EXPR_BEG || lex_state == EXPR_MID || if (IS_BEG() || (IS_ARG() && space_seen)) {
lex_state == EXPR_CLASS || (IS_ARG() && space_seen)) {
lex_state = EXPR_BEG; lex_state = EXPR_BEG;
return tCOLON3; return tCOLON3;
} }
@ -4121,7 +4121,7 @@ yylex()
return tSYMBEG; return tSYMBEG;
case '/': case '/':
if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { if (IS_BEG()) {
lex_strterm = NEW_STRTERM(str_regexp, '/', 0); lex_strterm = NEW_STRTERM(str_regexp, '/', 0);
return tREGEXP_BEG; return tREGEXP_BEG;
} }
@ -4183,7 +4183,7 @@ yylex()
case '(': case '(':
command_start = Qtrue; command_start = Qtrue;
if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { if (IS_BEG()) {
c = tLPAREN; c = tLPAREN;
} }
else if (space_seen) { else if (space_seen) {
@ -4213,7 +4213,7 @@ yylex()
pushback(c); pushback(c);
return '['; return '[';
} }
else if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { else if (IS_BEG()) {
c = tLBRACK; c = tLBRACK;
} }
else if (IS_ARG() && space_seen) { else if (IS_ARG() && space_seen) {
@ -4247,7 +4247,7 @@ yylex()
return '\\'; return '\\';
case '%': case '%':
if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { if (IS_BEG()) {
int term; int term;
int paren; int paren;
@ -4561,6 +4561,7 @@ yylex()
lex_state == EXPR_MID || lex_state == EXPR_MID ||
lex_state == EXPR_DOT || lex_state == EXPR_DOT ||
lex_state == EXPR_ARG || lex_state == EXPR_ARG ||
lex_state == EXPR_CLASS ||
lex_state == EXPR_CMDARG) { lex_state == EXPR_CMDARG) {
if (cmd_state) { if (cmd_state) {
lex_state = EXPR_CMDARG; lex_state = EXPR_CMDARG;