]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/rust/util/rust-keyword-values.h
1 // Copyright (C) 2020-2024 Free Software Foundation, Inc.
3 // This file is part of GCC.
5 // GCC is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 3, or (at your option) any later
10 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 // You should have received a copy of the GNU General Public License
16 // along with GCC; see the file COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
19 #ifndef RUST_KEYWORD_VALUES_H
20 #define RUST_KEYWORD_VALUES_H
22 #include "rust-token.h"
24 // Append keywords made from multiple tokens to the existing token-keyword list
25 #define RS_KEYWORD_LIST \
27 RS_TOKEN_KEYWORD_2015 (DOLLAR_CRATE, "$crate") \
28 RS_TOKEN_KEYWORD_2015 (PATH_ROOT, "{{root}}") \
29 RS_TOKEN_KEYWORD_2015 (STATIC_LIFETIME, "'static") \
30 RS_TOKEN_KEYWORD_2015 (UNDERSCORE_LIFETIME, "'_")
35 // TODO: Change this to a namespace + inline constexpr in the future
39 const static std::map
<std::string
, TokenId
> keywords_tokens
;
41 const static std::set
<std::string
> keywords
;
42 // Rust keyword values
44 #define RS_TOKEN(x, y)
45 #define RS_TOKEN_KEYWORD_2015(tok, key) static constexpr auto &tok = key;
46 #define RS_TOKEN_KEYWORD_2018 RS_TOKEN_KEYWORD_2015
48 #undef RS_TOKEN_KEYWORD_2015
49 #undef RS_TOKEN_KEYWORD_2018
56 static constexpr auto &AUTO
= "auto";
57 static constexpr auto &BUILTIN
= "builtin";
58 static constexpr auto &CATCH
= "catch";
59 static constexpr auto &DEFAULT
= "default";
60 static constexpr auto &GEN
= "gen";
61 static constexpr auto &MACRO_RULES
= "macro_rules";
62 static constexpr auto &RAW
= "raw";
63 static constexpr auto &UNION
= "union";
64 static constexpr auto &YEET
= "yeet";
70 #endif /* !RUST_KEYWORD_VALUES_H */