public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8056] gccrs: Break OR tokens in closure parameter list context
@ 2024-01-16 18:14 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:14 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:906e55530a30fed93868d16332c9168848089ded

commit r14-8056-g906e55530a30fed93868d16332c9168848089ded
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
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 <pierre-emmanuel.patry@embecosm.com>

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<ManagedTokenSource>::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 ();
 	  }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-16 18:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:14 [gcc r14-8056] gccrs: Break OR tokens in closure parameter list context Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).