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