aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse/rust-parse-impl.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-07-25 21:13:35 +0000
committerGitHub <noreply@github.com>2021-07-25 21:13:35 +0000
commit4447dba7c8a9126a9701ddc8ae02cc1425e1fa77 (patch)
treecefadc8af71ae3c09ff21b59e873ffffe1430adc /gcc/rust/parse/rust-parse-impl.h
parent314b62ec787abdf320fcca8ceb09b8c9bcf72512 (diff)
parentdf2b3b15dc95d5d74f6a630ee84296fb5b76c03f (diff)
downloadgcc-4447dba7c8a9126a9701ddc8ae02cc1425e1fa77.zip
gcc-4447dba7c8a9126a9701ddc8ae02cc1425e1fa77.tar.gz
gcc-4447dba7c8a9126a9701ddc8ae02cc1425e1fa77.tar.bz2
Merge #594
594: Support byte and byte string literals r=philberty a=dkm A byte literal is an u8 created as a ascii char or hex escape e.g. b'X'. A byte string literal is a string created from ascii or hex chars. bytes are represented as u8 and byte strings as str (with just ascii < 256 chars), but it should really be &'static [u8; n]. Co-authored-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index be26171..73600d2 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -12545,10 +12545,18 @@ Parser<ManagedTokenSource>::null_denotation (const_TokenPtr tok,
return std::unique_ptr<AST::LiteralExpr> (
new AST::LiteralExpr (tok->get_str (), AST::Literal::STRING,
tok->get_type_hint (), {}, tok->get_locus ()));
+ case BYTE_STRING_LITERAL:
+ return std::unique_ptr<AST::LiteralExpr> (
+ new AST::LiteralExpr (tok->get_str (), AST::Literal::BYTE_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,
tok->get_type_hint (), {}, tok->get_locus ()));
+ case BYTE_CHAR_LITERAL:
+ return std::unique_ptr<AST::LiteralExpr> (
+ new AST::LiteralExpr (tok->get_str (), AST::Literal::BYTE,
+ tok->get_type_hint (), {}, tok->get_locus ()));
case TRUE_LITERAL:
return std::unique_ptr<AST::LiteralExpr> (
new AST::LiteralExpr ("true", AST::Literal::BOOL, tok->get_type_hint (),