rust_error_at (get_current_location (),
"%<_%> is not a valid raw identifier");
- if (str == "crate" || str == "extern" || str == "self" || str == "super"
- || str == "Self")
+ using namespace Rust::Values;
+ std::set<std::string> invalid{
+ Keywords::CRATE, Keywords::EXTERN_TOK, Keywords::SELF,
+ Keywords::SUPER, Keywords::SELF_ALIAS,
+ };
+
+ if (invalid.find (str) != invalid.end ())
{
rust_error_at (get_current_location (),
"%qs is a forbidden raw identifier", str.c_str ());
#include "rust-make-unique.h"
#include "rust-dir-owner.h"
#include "rust-attribute-values.h"
+#include "rust-keyword-values.h"
#include "optional.h"
AST::SimplePathSegment
Parser<ManagedTokenSource>::parse_simple_path_segment ()
{
+ using namespace Values;
const_TokenPtr t = lexer.peek_token ();
switch (t->get_id ())
{
case SUPER:
lexer.skip_token ();
- return AST::SimplePathSegment ("super", t->get_locus ());
+ return AST::SimplePathSegment (Keywords::SUPER, t->get_locus ());
case SELF:
lexer.skip_token ();
- return AST::SimplePathSegment ("self", t->get_locus ());
+ return AST::SimplePathSegment (Keywords::SELF, t->get_locus ());
case CRATE:
lexer.skip_token ();
- return AST::SimplePathSegment ("crate", t->get_locus ());
+ return AST::SimplePathSegment (Keywords::CRATE, t->get_locus ());
case DOLLAR_SIGN:
if (lexer.peek_token (1)->get_id () == CRATE)
{