зеркало из https://github.com/github/ruby.git
[ruby/prism] Enhance def params term error message
https://github.com/ruby/prism/commit/3af1acd5da
This commit is contained in:
Родитель
2d631cf428
Коммит
128c9a92dd
|
@ -18508,7 +18508,12 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
|
|||
lex_state_set(parser, PM_LEX_STATE_BEG);
|
||||
parser->command_start = true;
|
||||
|
||||
expect1(parser, PM_TOKEN_PARENTHESIS_RIGHT, PM_ERR_DEF_PARAMS_TERM_PAREN);
|
||||
if (!accept1(parser, PM_TOKEN_PARENTHESIS_RIGHT)) {
|
||||
PM_PARSER_ERR_TOKEN_FORMAT(parser, parser->current, PM_ERR_DEF_PARAMS_TERM_PAREN, pm_token_type_human(parser->current.type));
|
||||
parser->previous.start = parser->previous.end;
|
||||
parser->previous.type = PM_TOKEN_MISSING;
|
||||
}
|
||||
|
||||
rparen = parser->previous;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
|
|||
[PM_ERR_DEF_ENDLESS_SETTER] = { "invalid method name; a setter method cannot be defined in an endless method definition", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_DEF_NAME] = { "unexpected %s; expected a method name", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_DEF_PARAMS_TERM] = { "expected a delimiter to close the parameters", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_DEF_PARAMS_TERM_PAREN] = { "expected a `)` to close the parameters", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_DEF_PARAMS_TERM_PAREN] = { "unexpected %s; expected a `)` to close the parameters", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_DEF_RECEIVER] = { "expected a receiver for the method definition", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_DEF_RECEIVER_TERM] = { "expected a `.` or `::` after the receiver in a method definition", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_DEF_TERM] = { "expected an `end` to close the `def` statement", PM_ERROR_LEVEL_SYNTAX },
|
||||
|
|
Загрузка…
Ссылка в новой задаче