Skip to content

Commit

Permalink
gccrs: emit error code for E0758
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* lex/rust-lex.cc (Lexer::build_token): Emit error code.
	* lex/rust-lex.h: Fix comment.

Signed-off-by: Raiki Tamura <[email protected]>
  • Loading branch information
tamaroning authored and CohenArthur committed Aug 28, 2024
1 parent 5da381f commit 2501644
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 6 additions & 3 deletions gcc/rust/lex/rust-lex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ Lexer::build_token ()
if (current_char.is_eof ())
{
rust_error_at (
loc, "unexpected EOF while looking for end of comment");
loc, ErrorCode::E0758,
"unexpected EOF while looking for end of comment");
break;
}
str += current_char;
Expand Down Expand Up @@ -644,7 +645,8 @@ Lexer::build_token ()
if (current_char.is_eof ())
{
rust_error_at (
loc, "unexpected EOF while looking for end of comment");
loc, ErrorCode::E0758,
"unexpected EOF while looking for end of comment");
break;
}

Expand Down Expand Up @@ -708,7 +710,8 @@ Lexer::build_token ()
if (current_char.is_eof ())
{
rust_error_at (
loc, "unexpected EOF while looking for end of comment");
loc, ErrorCode::E0758,
"unexpected EOF while looking for end of comment");
break;
}

Expand Down
9 changes: 5 additions & 4 deletions gcc/rust/lex/rust-lex.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ class Lexer
// Request new Location for current column in line_table
location_t get_current_location ();

// Skips the current input char.
// Skips the current input character.
void skip_input ();
// Advances current input char to n + 1 chars ahead of current position.
// Advances current input character to n + 1 characters ahead of current
// position.
void skip_input (int n);

// Peeks the current char.
// Peeks the current character.
Codepoint peek_input ();
// Returns char n bytes ahead of current position.
// Returns character n characters ahead of current position.
Codepoint peek_input (int n);

// Classifies keyword (i.e. gets id for keyword).
Expand Down

0 comments on commit 2501644

Please sign in to comment.