зеркало из https://github.com/github/ruby.git
parse.y: brace after array literal arg
* parse.y (parser_yylex): array is another literal. set state to END too not only ENDARG and after a literal, so that a left brace after it should be a primary block bound to the literal, which causes syntax error. [ruby-core:81037] [Bug #13547] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c6c975ca4e
Коммит
7d6965f88d
2
parse.y
2
parse.y
|
@ -8374,7 +8374,7 @@ parser_yylex(struct parser_params *parser)
|
||||||
if (c == ')')
|
if (c == ')')
|
||||||
SET_LEX_STATE(EXPR_ENDFN);
|
SET_LEX_STATE(EXPR_ENDFN);
|
||||||
else
|
else
|
||||||
SET_LEX_STATE(EXPR_ENDARG);
|
SET_LEX_STATE(EXPR_END);
|
||||||
if (c == '}') {
|
if (c == '}') {
|
||||||
if (!brace_nest--) c = tSTRING_DEND;
|
if (!brace_nest--) c = tSTRING_DEND;
|
||||||
}
|
}
|
||||||
|
|
|
@ -974,6 +974,10 @@ eom
|
||||||
assert_syntax_error('m 1.0 {}', error, bug)
|
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 :"#{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
|
end
|
||||||
|
|
||||||
def test_return_toplevel
|
def test_return_toplevel
|
||||||
|
|
Загрузка…
Ссылка в новой задаче