aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-10-10 14:06:30 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 19:09:18 +0100
commit906e55530a30fed93868d16332c9168848089ded (patch)
tree70db6d340050c692d21f81ea8045f194dc08e003 /gcc
parent2dfff621d9f5e2f7635a505d3d8c89ce1181f90e (diff)
downloadgcc-906e55530a30fed93868d16332c9168848089ded.zip
gcc-906e55530a30fed93868d16332c9168848089ded.tar.gz
gcc-906e55530a30fed93868d16332c9168848089ded.tar.bz2
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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 71f76f8..1e59913 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 ();
}