blob: c611bf1dc355699cbcbc2cfd643deecab361c552 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/* Compiler implementation of the D programming language
* Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved
* written by Walter Bright
* http://www.digitalmars.com
* Distributed under the Boost Software License, Version 1.0.
* http://www.boost.org/LICENSE_1_0.txt
* https://github.com/dlang/dmd/blob/master/src/dmd/identifier.h
*/
#pragma once
#include "root/root.h"
#include "root/stringtable.h"
class Identifier : public RootObject
{
private:
int value;
const char *string;
size_t len;
public:
Identifier(const char *string, size_t length, int value);
Identifier(const char *string);
static Identifier* create(const char *string);
bool equals(RootObject *o);
int compare(RootObject *o);
void print();
const char *toChars();
int getValue() const;
const char *toHChars2();
int dyncast() const;
static StringTable stringtable;
static Identifier *generateId(const char *prefix);
static Identifier *generateId(const char *prefix, size_t i);
static Identifier *idPool(const char *s, size_t len);
static Identifier *idPool(const char *s, size_t len, int value);
static inline Identifier *idPool(const char *s)
{
return idPool(s, strlen(s));
}
static bool isValidIdentifier(const char *p);
static Identifier *lookup(const char *s, size_t len);
static void initTable();
};
|