[ruby/prism] Disallow &. after endless range

https://github.com/ruby/prism/commit/498dd922d4
This commit is contained in:
Kevin Newton 2024-10-01 08:42:07 -04:00 committed by git
parent 3932d8a87a
commit 75568d23e9
2 changed files with 4 additions and 1 deletions

View File

@ -21657,7 +21657,7 @@ parse_expression(pm_parser_t *parser, pm_binding_power_t binding_power, bool acc
// 1.. * 2
//
if (PM_NODE_TYPE_P(node, PM_RANGE_NODE) && ((pm_range_node_t *) node)->right == NULL) {
if (match3(parser, PM_TOKEN_UAMPERSAND, PM_TOKEN_USTAR, PM_TOKEN_DOT)) {
if (match4(parser, PM_TOKEN_UAMPERSAND, PM_TOKEN_USTAR, PM_TOKEN_DOT, PM_TOKEN_AMPERSAND_DOT)) {
PM_PARSER_ERR_TOKEN_FORMAT(parser, parser->current, PM_ERR_NON_ASSOCIATIVE_OPERATOR, pm_token_type_human(parser->current.type), pm_token_type_human(parser->previous.type));
break;
}

View File

@ -0,0 +1,3 @@
0 if true...&.abs
^~ unexpected '&.'; ... is a non-associative operator