aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse/rust-parse-impl.h
diff options
context:
space:
mode:
authoransh <anshmalik2002@gmail.com>2024-06-24 04:01:53 -0700
committerCohenArthur <arthur.cohen@embecosm.com>2024-06-27 11:25:11 +0000
commit9e5a4b410d026ac4a7d527edc4b6848524d281a3 (patch)
tree88ceb168cca42f16fb8fc8300589221497437a41 /gcc/rust/parse/rust-parse-impl.h
parent40d52922469989d16626fd29d1943596af919d92 (diff)
downloadgcc-9e5a4b410d026ac4a7d527edc4b6848524d281a3.zip
gcc-9e5a4b410d026ac4a7d527edc4b6848524d281a3.tar.gz
gcc-9e5a4b410d026ac4a7d527edc4b6848524d281a3.tar.bz2
Add RAW_STRING_LITERAL
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>
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 0a20bf6..aff8144 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -854,6 +854,9 @@ Parser<ManagedTokenSource>::parse_attr_input ()
case BYTE_STRING_LITERAL:
lit_type = AST::Literal::BYTE_STRING;
break;
+ case RAW_STRING_LITERAL:
+ lit_type = AST::Literal::RAW_STRING;
+ break;
case STRING_LITERAL:
default:
lit_type = AST::Literal::STRING;
@@ -7511,6 +7514,11 @@ Parser<ManagedTokenSource>::parse_literal_expr (AST::AttrVec outer_attrs)
literal_value = t->get_str ();
lexer.skip_token ();
break;
+ case RAW_STRING_LITERAL:
+ type = AST::Literal::RAW_STRING;
+ literal_value = t->get_str ();
+ lexer.skip_token ();
+ break;
case INT_LITERAL:
type = AST::Literal::INT;
literal_value = t->get_str ();
@@ -10481,6 +10489,11 @@ Parser<ManagedTokenSource>::parse_pattern_no_alt ()
return std::unique_ptr<AST::LiteralPattern> (
new AST::LiteralPattern (t->get_str (), AST::Literal::BYTE_STRING,
t->get_locus (), t->get_type_hint ()));
+ case RAW_STRING_LITERAL:
+ lexer.skip_token ();
+ return std::unique_ptr<AST::LiteralPattern> (
+ new AST::LiteralPattern (t->get_str (), AST::Literal::RAW_STRING,
+ t->get_locus (), t->get_type_hint ()));
// raw string and raw byte string literals too if they are readded to
// lexer
case MINUS:
@@ -12275,6 +12288,10 @@ Parser<ManagedTokenSource>::null_denotation_not_path (
return std::unique_ptr<AST::LiteralExpr> (
new AST::LiteralExpr (tok->get_str (), AST::Literal::BYTE_STRING,
tok->get_type_hint (), {}, tok->get_locus ()));
+ case RAW_STRING_LITERAL:
+ return std::unique_ptr<AST::LiteralExpr> (
+ new AST::LiteralExpr (tok->get_str (), AST::Literal::RAW_STRING,
+ tok->get_type_hint (), {}, tok->get_locus ()));
case CHAR_LITERAL:
return std::unique_ptr<AST::LiteralExpr> (
new AST::LiteralExpr (tok->get_str (), AST::Literal::CHAR,