diff --git a/parse.y b/parse.y index 44a0bb6785..02d9412a2c 100644 --- a/parse.y +++ b/parse.y @@ -8374,7 +8374,7 @@ parser_yylex(struct parser_params *parser) if (c == ')') SET_LEX_STATE(EXPR_ENDFN); else - SET_LEX_STATE(EXPR_ENDARG); + SET_LEX_STATE(EXPR_END); if (c == '}') { if (!brace_nest--) c = tSTRING_DEND; } diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index bd93285ac4..e2b5e0146e 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -974,6 +974,10 @@ eom assert_syntax_error('m 1.0 {}', error, bug) assert_syntax_error('m :m {}', error, bug) assert_syntax_error('m :"#{m}" {}', error, bug) + assert_syntax_error('m ?x {}', error, bug) + assert_syntax_error('m %[] {}', error, bug) + assert_syntax_error('m 0..1 {}', error, bug) + assert_syntax_error('m [] {}', error, bug) end def test_return_toplevel