Project

General

Profile

Actions

Feature #14506

closed

Possible bug in cmdarg_stack

Added by ibylich (Ilya Bylich) about 6 years ago. Updated about 6 years ago.

Status:
Closed
Target version:
-
[ruby-core:85735]

Description

cmdarg stack is a stack of bytes that has 1 on top of it when the parser is in the command mode.

But for this code:

a b(c d), "x" do end

And this line in parse.y:

> SHOW_BITSTACK(p->cmdarg_stack, "BEFORE kDO_BLOCK");
if (CMDARG_P() && !IS_lex_state_for(state, EXPR_CMDARG))
  return keyword_do_block;

It prints:

$ dev-ruby -vye 'a b(c d), "x" do end' | grep -E "kDO_BLOCK"
BEFORE kDO_BLOCK: 10 at line 7461

So CMDARG_P is false. I understand that 'keyword_do_block" is handled later in the "if (IS_lex_state_for(state, (EXPR_BEG | EXPR_ENDARG)))" section, but is it possible to change parser to rely only on cmdarg stack?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0