diff options
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -3368,6 +3368,7 @@ arg_ambiguous() } #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 yylex() @@ -3453,7 +3454,7 @@ yylex() rb_warning("`*' interpreted as argument prefix"); c = tSTAR; } - else if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + else if (IS_BEG()) { c = tSTAR; } else { @@ -3682,7 +3683,7 @@ yylex() rb_warning("`&' interpreted as argument prefix"); c = tAMPER; } - else if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + else if (IS_BEG()) { c = tAMPER; } else { @@ -3736,7 +3737,7 @@ yylex() lex_state = EXPR_BEG; return tOP_ASGN; } - if (lex_state == EXPR_BEG || lex_state == EXPR_MID || + if (IS_BEG() || (IS_ARG() && space_seen && !ISSPACE(c))) { if (IS_ARG()) arg_ambiguous(); lex_state = EXPR_BEG; @@ -3766,7 +3767,7 @@ yylex() lex_state = EXPR_BEG; return tOP_ASGN; } - if (lex_state == EXPR_BEG || lex_state == EXPR_MID || + if (IS_BEG() || (IS_ARG() && space_seen && !ISSPACE(c))) { if (IS_ARG()) arg_ambiguous(); lex_state = EXPR_BEG; @@ -4027,8 +4028,7 @@ yylex() case ':': c = nextc(); if (c == ':') { - if (lex_state == EXPR_BEG || lex_state == EXPR_MID || - lex_state == EXPR_CLASS || (IS_ARG() && space_seen)) { + if (IS_BEG() || (IS_ARG() && space_seen)) { lex_state = EXPR_BEG; return tCOLON3; } @@ -4055,7 +4055,7 @@ yylex() return tSYMBEG; case '/': - if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + if (IS_BEG()) { lex_strterm = NEW_STRTERM(str_regexp, '/', 0); return tREGEXP_BEG; } @@ -4117,7 +4117,7 @@ yylex() case '(': command_start = Qtrue; - if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + if (IS_BEG()) { c = tLPAREN; } else if (space_seen) { @@ -4147,7 +4147,7 @@ yylex() pushback(c); return '['; } - else if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + else if (IS_BEG()) { c = tLBRACK; } else if (IS_ARG() && space_seen) { @@ -4180,7 +4180,7 @@ yylex() return '\\'; case '%': - if (lex_state == EXPR_BEG || lex_state == EXPR_MID) { + if (IS_BEG()) { int term; int paren; @@ -4493,6 +4493,7 @@ yylex() lex_state == EXPR_MID || lex_state == EXPR_DOT || lex_state == EXPR_ARG || + lex_state == EXPR_CLASS || lex_state == EXPR_CMDARG) { if (cmd_state) { lex_state = EXPR_CMDARG; |