]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/d/dmd/identifier.h
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / d / dmd / identifier.h
1
2 /* Compiler implementation of the D programming language
3 * Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved
4 * written by Walter Bright
5 * http://www.digitalmars.com
6 * Distributed under the Boost Software License, Version 1.0.
7 * http://www.boost.org/LICENSE_1_0.txt
8 * https://github.com/dlang/dmd/blob/master/src/dmd/identifier.h
9 */
10
11 #pragma once
12
13 #include "root/dcompat.h"
14 #include "root/object.h"
15
16 class Identifier : public RootObject
17 {
18 private:
19 int value;
20 bool isAnonymous_;
21 DString string;
22
23 public:
24 static Identifier* create(const char *string);
25 bool equals(const RootObject *o) const;
26 const char *toChars() const;
27 int getValue() const;
28 bool isAnonymous() const;
29 const char *toHChars2() const;
30 DYNCAST dyncast() const;
31
32 static Identifier *generateId(const char *prefix, size_t length, size_t suffix);
33 static Identifier *idPool(const char *s, unsigned len);
34
35 static inline Identifier *idPool(const char *s)
36 {
37 return idPool(s, static_cast<unsigned>(strlen(s)));
38 }
39
40 static bool isValidIdentifier(const char *p);
41 };