зеркало из https://github.com/github/ruby.git
[ruby/prism] Require a delimiter for singleton classes
https://github.com/ruby/prism/commit/fd58d6a9ea
This commit is contained in:
Родитель
6b8078cc03
Коммит
c1c9ba77ca
|
@ -107,6 +107,7 @@ errors:
|
||||||
- EXPECT_RPAREN
|
- EXPECT_RPAREN
|
||||||
- EXPECT_RPAREN_AFTER_MULTI
|
- EXPECT_RPAREN_AFTER_MULTI
|
||||||
- EXPECT_RPAREN_REQ_PARAMETER
|
- EXPECT_RPAREN_REQ_PARAMETER
|
||||||
|
- EXPECT_SINGLETON_CLASS_DELIMITER
|
||||||
- EXPECT_STRING_CONTENT
|
- EXPECT_STRING_CONTENT
|
||||||
- EXPECT_WHEN_DELIMITER
|
- EXPECT_WHEN_DELIMITER
|
||||||
- EXPRESSION_BARE_HASH
|
- EXPRESSION_BARE_HASH
|
||||||
|
|
|
@ -18966,7 +18966,9 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
|
||||||
pm_node_t *expression = parse_value_expression(parser, PM_BINDING_POWER_COMPOSITION, true, false, PM_ERR_EXPECT_EXPRESSION_AFTER_LESS_LESS, (uint16_t) (depth + 1));
|
pm_node_t *expression = parse_value_expression(parser, PM_BINDING_POWER_COMPOSITION, true, false, PM_ERR_EXPECT_EXPRESSION_AFTER_LESS_LESS, (uint16_t) (depth + 1));
|
||||||
|
|
||||||
pm_parser_scope_push(parser, true);
|
pm_parser_scope_push(parser, true);
|
||||||
accept2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON);
|
if (!match2(parser, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON)) {
|
||||||
|
PM_PARSER_ERR_TOKEN_FORMAT(parser, parser->current, PM_ERR_EXPECT_SINGLETON_CLASS_DELIMITER, pm_token_type_human(parser->current.type));
|
||||||
|
}
|
||||||
|
|
||||||
pm_node_t *statements = NULL;
|
pm_node_t *statements = NULL;
|
||||||
if (!match4(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE, PM_TOKEN_KEYWORD_ELSE, PM_TOKEN_KEYWORD_END)) {
|
if (!match4(parser, PM_TOKEN_KEYWORD_RESCUE, PM_TOKEN_KEYWORD_ENSURE, PM_TOKEN_KEYWORD_ELSE, PM_TOKEN_KEYWORD_END)) {
|
||||||
|
|
|
@ -190,6 +190,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
|
||||||
[PM_ERR_EXPECT_RPAREN] = { "expected a matching `)`", PM_ERROR_LEVEL_SYNTAX },
|
[PM_ERR_EXPECT_RPAREN] = { "expected a matching `)`", PM_ERROR_LEVEL_SYNTAX },
|
||||||
[PM_ERR_EXPECT_RPAREN_AFTER_MULTI] = { "expected a `)` after multiple assignment", PM_ERROR_LEVEL_SYNTAX },
|
[PM_ERR_EXPECT_RPAREN_AFTER_MULTI] = { "expected a `)` after multiple assignment", PM_ERROR_LEVEL_SYNTAX },
|
||||||
[PM_ERR_EXPECT_RPAREN_REQ_PARAMETER] = { "expected a `)` to end a required parameter", PM_ERROR_LEVEL_SYNTAX },
|
[PM_ERR_EXPECT_RPAREN_REQ_PARAMETER] = { "expected a `)` to end a required parameter", PM_ERROR_LEVEL_SYNTAX },
|
||||||
|
[PM_ERR_EXPECT_SINGLETON_CLASS_DELIMITER] = { "unexpected %s; expected a newline or a ';' after the singleton class", PM_ERROR_LEVEL_SYNTAX },
|
||||||
[PM_ERR_EXPECT_STRING_CONTENT] = { "expected string content after opening string delimiter", PM_ERROR_LEVEL_SYNTAX },
|
[PM_ERR_EXPECT_STRING_CONTENT] = { "expected string content after opening string delimiter", PM_ERROR_LEVEL_SYNTAX },
|
||||||
[PM_ERR_EXPECT_WHEN_DELIMITER] = { "expected a delimiter after the predicates of a `when` clause", PM_ERROR_LEVEL_SYNTAX },
|
[PM_ERR_EXPECT_WHEN_DELIMITER] = { "expected a delimiter after the predicates of a `when` clause", PM_ERROR_LEVEL_SYNTAX },
|
||||||
[PM_ERR_EXPRESSION_BARE_HASH] = { "unexpected bare hash in expression", PM_ERROR_LEVEL_SYNTAX },
|
[PM_ERR_EXPRESSION_BARE_HASH] = { "unexpected bare hash in expression", PM_ERROR_LEVEL_SYNTAX },
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
class <<self rand end
|
||||||
|
^~~~ unexpected local variable or method; expected a newline or a ';' after the singleton class
|
||||||
|
|
Загрузка…
Ссылка в новой задаче