]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Handle newlines during string parsing while lexing
authorNirmal Patel <nirmal@nirmal.dev>
Wed, 27 Dec 2023 22:49:58 +0000 (17:49 -0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 30 Jan 2024 11:36:51 +0000 (12:36 +0100)
commit8b7d6adbbb886039f8c6e14a581dcbc9c63ce380
tree2652d0a7a44a472e126dd1125c8e5508e98c8f32
parent14025f735967c1909f2e722210f8c4e694b9ee51
gccrs: Handle newlines during string parsing while lexing

If newline strings are encountered while lexing, the lexer now handles
newline characters by incrementing current line number. This provides
correct line number when displaying errors. If the lexer encounters end
of file before string end, then it will use the start of the string as
the location to an report error.

gcc/rust/ChangeLog:
* lex/rust-lex.cc (Lexer::parse_byte_string): Handle newline
while parsing byte strings
(Lexer::parse_string): Handle newline while parsing strings

Signed-off-by: Nirmal Patel <nirmal@nirmal.dev>
gcc/rust/lex/rust-lex.cc
gcc/testsuite/rust/compile/issue-2187.rs [new file with mode: 0644]
gcc/testsuite/rust/execute/torture/issue-2187.rs [new file with mode: 0644]