Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary methods/fields of Rust::Lexer #2347

Merged
merged 1 commit into from
Jul 3, 2023

Conversation

tamaroning
Copy link
Contributor

@tamaroning tamaroning commented Jun 29, 2023

Addresses #2309

gccrs: Remove unnecessary methods of Rust::Lexer
gcc/rust/ChangeLog:

	* lex/rust-lex.cc (Lexer::build_token): Replace function call.
	(Lexer::parse_string): Likewise.
	(Lexer::parse_identifier_or_keyword): Likewise.
	(Lexer::parse_raw_string): Likewise.
	(Lexer::parse_char_or_lifetime): Likewise.
	(Lexer::get_input_codepoint_length): Deleted.
	(Lexer::peek_codepoint_input): Deleted.
	(Lexer::skip_codepoint_input): Deleted.
	* lex/rust-lex.h: Remove some methods and fields

gcc/rust/ChangeLog:

	* lex/rust-lex.cc (Lexer::build_token): Replace function call.
	(Lexer::parse_string): Likewise.
	(Lexer::parse_identifier_or_keyword): Likewise.
	(Lexer::parse_raw_string): Likewise.
	(Lexer::parse_char_or_lifetime): Likewise.
	(Lexer::get_input_codepoint_length): Deleted.
	(Lexer::peek_codepoint_input): Deleted.
	(Lexer::skip_codepoint_input): Deleted.
	* lex/rust-lex.h: Remove some methods and fields

Signed-off-by: Raiki Tamura <[email protected]>
Comment on lines +2014 to +2016
// FIXME: should remove this but can't.
// `parse_utf8_escape` does not update `current_char` correctly.
current_char = peek_input ();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be removed but can't.
parse_utf8_escape() seems not to update current_char properly.

Comment on lines -139 to -142
int get_input_codepoint_length ();
// Peeks the current utf-8 char
Codepoint peek_codepoint_input ();
void skip_codepoint_input ();
Copy link
Contributor Author

@tamaroning tamaroning Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These functions are unnecessary so deleted in this pr(See #2307)

@@ -393,7 +389,6 @@ class Lexer
int current_column;
// Current character.
Codepoint current_char;
Codepoint current_char32;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field was added to parse Unicode identifiers via #2284 but is unnecessary now.

@tamaroning
Copy link
Contributor Author

tamaroning commented Jun 29, 2023

@CohenArthur apt-get fails in CI. How can i rerun tests?

@CohenArthur
Copy link
Member

@tamaroning I re-ran the CI manually. Not sure why it failed on this step, but yeah this is not your fault so don't worry :)

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Very nice work!

Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CohenArthur CohenArthur added this pull request to the merge queue Jul 3, 2023
Merged via the queue into Rust-GCC:master with commit 5d33b88 Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants