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

Add RAW_STRING_LITERAL #3065

Merged
merged 1 commit into from
Jun 27, 2024
Merged

Add RAW_STRING_LITERAL #3065

merged 1 commit into from
Jun 27, 2024

Conversation

AnshVM
Copy link
Contributor

@AnshVM AnshVM commented Jun 24, 2024

Add RAW_STRING_LITERAL token variant and the LitType::RAW_STRING variant.

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::visit): Handle RAW_STRING case in TokenCollection::visit
* ast/rust-ast.cc (AttributeParser::parse_meta_item_inner): Add RAW_STRING_LITERAL case to call parse_meta_item_lit() (AttributeParser::parse_literal): Add RAW_STRING_LITERAL case.
* ast/rust-ast.h: Add RAW_STRING_LITERAL to is_stirng_lit(). Add RAW_STRING enum variant to LitType enum.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_literal): Handle raw string literal type, falls back to rust_unreachable() for now.
* lex/rust-lex.cc (Lexer::parse_raw_string): Use make_raw_string instead of make_string.
* lex/rust-token.cc (Token::as_string): Handle case for RAW_STRING_LITERAL.
* lex/rust-token.h (enum PrimitiveCoreType): Add RAW_STRING_LITERAL token type. Define make_raw_string function to create RAW_STRING_LITERAL token. Add RAW_STRING_LITERAL case to is_literal().
* parse/rust-parse-impl.h (Parser::parse_attr_input): Handle case for RAW_STRING_LITERAL. (Parser::parse_literal_expr): Handle case for RAW_STRING_LITERAL (Parser::parse_pattern_no_alt): Handle case for RAW_STRING_LITERAL

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.

LGTM

Copy link
Member

@P-E-P P-E-P left a comment

Choose a reason for hiding this comment

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

PR is great, changelog is here but we're missing DCO (you can git commit --amend -s to add it).

Unless you're part of the fsf list but I don't know where it could be found and thus cannot verify (@CohenArthur do you know?).

@CohenArthur
Copy link
Member

some people can access it but I can't. weird that our CI setup does not catch anything... but yes good point @P-E-P, you need to sign your commit @AnshVM

gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc (TokenCollector::visit):
	Handle case for RAW_STRING_LITERAL.
	* ast/rust-ast.cc (AttributeParser::parse_meta_item_inner):
	Likewise.
	(AttributeParser::parse_literal): Likewise.
	* ast/rust-ast.h: Likewise.
	* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_literal):
	Likewise.
	* lex/rust-lex.cc (Lexer::parse_raw_string): Likewise.
	* lex/rust-token.cc (Token::as_string): Likewise.
	* lex/rust-token.h (enum PrimitiveCoreType): Likewise.
	* parse/rust-parse-impl.h (Parser::parse_attr_input): Likewise.
	(Parser::parse_literal_expr): Likewise.
	(Parser::parse_pattern_no_alt): Likewise.

Signed-off-by: ansh <anshmalik2002@gmail.com>
@AnshVM
Copy link
Contributor Author

AnshVM commented Jun 26, 2024

Thanks for pointing that out @P-E-P
Signed my commit 👍

@CohenArthur CohenArthur added this pull request to the merge queue Jun 27, 2024
Merged via the queue into Rust-GCC:master with commit 9e5a4b4 Jun 27, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants