diff options
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -73,6 +73,7 @@ enum lex_state_bits { EXPR_CLASS_bit, /* immediate after `class', no here document. */ EXPR_LABEL_bit, /* flag bit, label is allowed. */ EXPR_LABELED_bit, /* flag bit, just after a label. */ + EXPR_FITEM_bit, /* symbol literal as FNAME. */ EXPR_MAX_STATE }; /* examine combinations */ @@ -90,6 +91,7 @@ enum lex_state_e { DEF_EXPR(CLASS), DEF_EXPR(LABEL), DEF_EXPR(LABELED), + DEF_EXPR(FITEM), EXPR_VALUE = EXPR_BEG, EXPR_BEG_ANY = (EXPR_BEG | EXPR_MID | EXPR_CLASS), EXPR_ARG_ANY = (EXPR_ARG | EXPR_CMDARG), @@ -1135,7 +1137,7 @@ stmt_or_begin : stmt %*/ } -stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME);} fitem +stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem { /*%%%*/ $$ = NEW_ALIAS($2, $4); @@ -1971,7 +1973,7 @@ undef_list : fitem $$ = rb_ary_new3(1, $1); %*/ } - | undef_list ',' {SET_LEX_STATE(EXPR_FNAME);} fitem + | undef_list ',' {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem { /*%%%*/ $$ = block_append($1, NEW_UNDEF($4)); @@ -7781,7 +7783,7 @@ parse_percent(struct parser_params *parser, const int space_seen, const enum lex case 's': lex_strterm = NEW_STRTERM(str_ssym, term, paren); - SET_LEX_STATE(EXPR_FNAME); + SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM); return tSYMBEG; default: @@ -7794,7 +7796,7 @@ parse_percent(struct parser_params *parser, const int space_seen, const enum lex SET_LEX_STATE(EXPR_BEG); return tOP_ASGN; } - if (IS_SPCARG(c)) { + if (IS_SPCARG(c) || (IS_lex_state(EXPR_FITEM) && c == 's')) { goto quotation; } SET_LEX_STATE(IS_AFTER_OPERATOR() ? EXPR_ARG : EXPR_BEG); @@ -9213,7 +9215,7 @@ id_is_var_gen(struct parser_params *parser, ID id) static const char lex_state_names[][13] = { "EXPR_BEG", "EXPR_END", "EXPR_ENDARG", "EXPR_ENDFN", "EXPR_ARG", "EXPR_CMDARG", "EXPR_MID", "EXPR_FNAME", "EXPR_DOT", "EXPR_CLASS", - "EXPR_LABEL", "EXPR_LABELED", + "EXPR_LABEL", "EXPR_LABELED","EXPR_FITEM", }; static VALUE |