зеркало из https://github.com/github/ruby.git
Sync Prism with latest main branch
This commit is contained in:
Родитель
c1c9ba77ca
Коммит
6c9b5c1615
|
@ -99,6 +99,7 @@ errors:
|
|||
- EXPECT_EXPRESSION_AFTER_SPLAT
|
||||
- EXPECT_EXPRESSION_AFTER_SPLAT_HASH
|
||||
- EXPECT_EXPRESSION_AFTER_STAR
|
||||
- EXPECT_FOR_DELIMITER
|
||||
- EXPECT_IDENT_REQ_PARAMETER
|
||||
- EXPECT_IN_DELIMITER
|
||||
- EXPECT_LPAREN_REQ_PARAMETER
|
||||
|
|
|
@ -17539,7 +17539,7 @@ parse_pattern(pm_parser_t *parser, pm_constant_id_list_t *captures, uint8_t flag
|
|||
// Gather up all of the patterns into the list.
|
||||
while (accept1(parser, PM_TOKEN_COMMA)) {
|
||||
// Break early here in case we have a trailing comma.
|
||||
if (match6(parser, PM_TOKEN_KEYWORD_THEN, PM_TOKEN_BRACE_RIGHT, PM_TOKEN_BRACKET_RIGHT, PM_TOKEN_NEWLINE, PM_TOKEN_SEMICOLON, PM_TOKEN_EOF)) {
|
||||
if (match4(parser, PM_TOKEN_KEYWORD_THEN, PM_TOKEN_BRACE_RIGHT, PM_TOKEN_BRACKET_RIGHT, PM_TOKEN_SEMICOLON)) {
|
||||
node = (pm_node_t *) pm_implicit_rest_node_create(parser, &parser->previous);
|
||||
pm_node_list_append(&nodes, node);
|
||||
break;
|
||||
|
@ -19454,10 +19454,11 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
|
|||
do_keyword = parser->previous;
|
||||
} else {
|
||||
do_keyword = not_provided(parser);
|
||||
if (!match2(parser, PM_TOKEN_SEMICOLON, PM_TOKEN_NEWLINE)) {
|
||||
PM_PARSER_ERR_TOKEN_FORMAT(parser, parser->current, PM_ERR_EXPECT_FOR_DELIMITER, pm_token_type_human(parser->current.type));
|
||||
}
|
||||
}
|
||||
|
||||
accept2(parser, PM_TOKEN_SEMICOLON, PM_TOKEN_NEWLINE);
|
||||
|
||||
pm_statements_node_t *statements = NULL;
|
||||
if (!match1(parser, PM_TOKEN_KEYWORD_END)) {
|
||||
statements = parse_statements(parser, PM_CONTEXT_FOR, (uint16_t) (depth + 1));
|
||||
|
|
|
@ -182,6 +182,7 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = {
|
|||
[PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT] = { "expected an expression after `*` splat in an argument", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_EXPECT_EXPRESSION_AFTER_SPLAT_HASH] = { "expected an expression after `**` in a hash", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_EXPECT_EXPRESSION_AFTER_STAR] = { "expected an expression after `*`", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_EXPECT_FOR_DELIMITER] = { "unexpected %s; expected a 'do', newline, or ';' after the 'for' loop collection", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_EXPECT_IDENT_REQ_PARAMETER] = { "expected an identifier for the required parameter", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_EXPECT_IN_DELIMITER] = { "expected a delimiter after the patterns of an `in` clause", PM_ERROR_LEVEL_SYNTAX },
|
||||
[PM_ERR_EXPECT_LPAREN_REQ_PARAMETER] = { "expected a `(` to start a required parameter", PM_ERROR_LEVEL_SYNTAX },
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
for a in b end
|
||||
^~~ unexpected 'end'; expected a 'do', newline, or ';' after the 'for' loop collection
|
||||
|
|
@ -2,4 +2,5 @@ for end
|
|||
^~~ expected an index after `for`
|
||||
^ expected an `in` after the index in a `for` statement
|
||||
^ expected a collection after the `in` in a `for` statement
|
||||
^~~ unexpected 'end'; expected a 'do', newline, or ';' after the 'for' loop collection
|
||||
|
||||
|
|
|
@ -87,10 +87,7 @@ foo => *bar, baz, qux
|
|||
foo => bar, *baz, qux
|
||||
foo => bar, baz, *qux
|
||||
foo => *bar, baz, *qux
|
||||
|
||||
foo => bar,
|
||||
|
||||
; # end the previous pattern for ParseTest#test_filepath_patterns.txt which parses the whole file at once
|
||||
foo => bar,;
|
||||
|
||||
foo => []
|
||||
foo => [[[[[]]]]]
|
||||
|
@ -127,10 +124,7 @@ foo in __FILE__
|
|||
foo in __LINE__
|
||||
foo in __ENCODING__
|
||||
foo in -> { bar }
|
||||
|
||||
foo in bar,
|
||||
|
||||
; # end the previous pattern for ParseTest#test_filepath_patterns.txt which parses the whole file at once
|
||||
foo in bar,;
|
||||
|
||||
case foo; in bar then end
|
||||
case foo; in 1 then end
|
||||
|
|
Загрузка…
Ссылка в новой задаче