aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse
diff options
context:
space:
mode:
authorliushuyu <liushuyu011@gmail.com>2022-06-07 00:57:43 -0600
committerliushuyu <liushuyu011@gmail.com>2022-06-07 01:17:37 -0600
commit46e248fb7fe7af696f5bd331f1b981cfe2ffca76 (patch)
tree87ae2e67d3bd298ebc13055ededa390734baa68b /gcc/rust/parse
parent957914b4284213b1d72c9c4210892367acaf1419 (diff)
downloadgcc-46e248fb7fe7af696f5bd331f1b981cfe2ffca76.zip
gcc-46e248fb7fe7af696f5bd331f1b981cfe2ffca76.tar.gz
gcc-46e248fb7fe7af696f5bd331f1b981cfe2ffca76.tar.bz2
rust/lex: skip broken string expression ...
... when the matching quote is not found on the same line this could unstuck the string parser when the parser could not advance the parsing position
Diffstat (limited to 'gcc/rust/parse')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index dfd393e..0fc1c1f 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -914,7 +914,8 @@ Parser<ManagedTokenSource>::parse_delim_token_tree ()
// repeat loop until finding the matching delimiter
t = lexer.peek_token ();
- while (!token_id_matches_delims (t->get_id (), delim_type))
+ while (!token_id_matches_delims (t->get_id (), delim_type)
+ && t->get_id () != END_OF_FILE)
{
std::unique_ptr<AST::TokenTree> tok_tree = parse_token_tree ();