aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse/rust-parse-impl.h
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2021-07-25 14:12:42 +0200
committerMark Wielaard <mark@klomp.org>2021-07-25 14:54:13 +0200
commitdf2b3b15dc95d5d74f6a630ee84296fb5b76c03f (patch)
treecefadc8af71ae3c09ff21b59e873ffffe1430adc /gcc/rust/parse/rust-parse-impl.h
parent314b62ec787abdf320fcca8ceb09b8c9bcf72512 (diff)
downloadgcc-df2b3b15dc95d5d74f6a630ee84296fb5b76c03f.zip
gcc-df2b3b15dc95d5d74f6a630ee84296fb5b76c03f.tar.gz
gcc-df2b3b15dc95d5d74f6a630ee84296fb5b76c03f.tar.bz2
Support byte and byte string literals
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].
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 (),