From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7905) id 0E552385DC0D; Tue, 16 Jan 2024 18:14:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E552385DC0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705428888; bh=tCtWH27/UYYIQKBiaAYYwjextyVJ6NwxXp2IQU31EDc=; h=From:To:Subject:Date:From; b=i4tkcEfsCdZxVkx3UnwdE059Y3fRTrLv/eqHeLPj2F/x8pBIm7Js0NIZo85U0beEl fKMgOsKxR4EosXBrHgN4rr23ia5BJ3uGJy6QQNTUObmmtN7cKEyBgIn0VdnBMk8yTX knFKCbnC0UiPvmNP6p5bu3c67uis37WLZkbb7AvI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Arthur Cohen To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8056] gccrs: Break OR tokens in closure parameter list context X-Act-Checkin: gcc X-Git-Author: Pierre-Emmanuel Patry X-Git-Refname: refs/heads/trunk X-Git-Oldrev: 2dfff621d9f5e2f7635a505d3d8c89ce1181f90e X-Git-Newrev: 906e55530a30fed93868d16332c9168848089ded Message-Id: <20240116181448.0E552385DC0D@sourceware.org> Date: Tue, 16 Jan 2024 18:14:48 +0000 (GMT) List-Id: https://gcc.gnu.org/g:906e55530a30fed93868d16332c9168848089ded commit r14-8056-g906e55530a30fed93868d16332c9168848089ded Author: Pierre-Emmanuel Patry Date: Tue Oct 10 14:06:30 2023 +0200 gccrs: Break OR tokens in closure parameter list context The parser was unable to process as closure inside a closure because the lexer could not differentiate an OR from two PIPE tokens. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_closure_expr_pratt): Fix closure parsing function to handle consecutive parameter lists. Signed-off-by: Pierre-Emmanuel Patry Diff: --- gcc/rust/parse/rust-parse-impl.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 71f76f8e2eb..1e59913e88e 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -14464,12 +14464,17 @@ Parser::parse_closure_expr_pratt (const_TokenPtr tok, if (lexer.peek_token ()->get_id () != COMMA) { + if (lexer.peek_token ()->get_id () == OR) + lexer.split_current_token (PIPE, PIPE); // not an error but means param list is done break; } // skip comma lexer.skip_token (); + if (lexer.peek_token ()->get_id () == OR) + lexer.split_current_token (PIPE, PIPE); + t = lexer.peek_token (); }