英語版
このページの英語版を見る

dmd.identifier

識別子を定義する。識別子とは、Dsymbol の名前である。
Authors:

ソースidentifier.d

対象範囲 https://codecov.io/gh/dlang/dmd/src/master/src/dmd/identifier.d

class Identifier: dmd.rootobject.RootObject;
nothrow this(const(char)* name);
与えられた名前から識別子を構築する。
nothrow this(const(char)* name, size_t length, int value);

nothrow @safe this(const(char)[] name, int value);
与えられた名前から識別子を生成する。
Parameters: 識別子名。xml-ph-0000@deepl.internal がある。
const(char)* name 識別子名。'\0' がなければならない。 name[length]
size_t length 長さは name。終端文字は除く'\0'
int value 識別子値(例:Id.unitTest )またはTOK.identifier
static nothrow Identifier generateId(const(char)[] prefix);
新しい識別子を生成する。
Parameters: このプレフィックスが識別子の名前となる。デバッグ目的。
const(char)[] prefix これは識別子の名前の接頭辞となる。デバッグ 目的。
static nothrow Identifier generateAnonymousId(const(char)[] name);
新しい匿名識別子を生成する。
Parameters:
const(char)[] name これは識別子の名前の一部となる。デバッグ 目的。
static nothrow Identifier generateId(const(char)[] prefix, size_t suffix);

static nothrow Identifier generateId(const(char)* prefix, size_t length, size_t suffix);
新しい識別子を生成する。
Parameters:
const(char)[] prefix これは識別子の名前の接頭辞となる。デバッグ 目的で
size_t suffix これは識別子の名前の接尾辞となる。これが 識別子を一意のものにする
static nothrow Identifier generateIdWithLoc(string prefix, const ref Loc loc);
ソースの場所に基づいて決定論的な名前の識別子を生成し、 複数のコンパイルにわたって名前の一貫性を確保する。 新しい一意の名前が生成される。接頭辞+場所がすでに文字列テーブルにある場合は、 余分な接尾辞が追加される(カウントは「1」から開始)。
Parameters:
string prefix 識別子名の最初の部分。
Loc loc 識別子名で使用するソースの場所。
Returns: 識別子(Identifier.idPool内)で、ソースロケーションに基づく決定論的な名前が
ソースロケーションに基づいて決定論的な名前を持つ識別子(Identifier.idPool内)
static nothrow Identifier idPool(scope const(char)* s, uint len);
文字列テーブルに識別子を作成する。
static nothrow void idPool(scope const(char)[] s, TOK value);
文字列テーブルにキーワードを挿入するために使用する。
Parameters:
const(char)[] s キーワード用の文字列
TOK value TOK.xxxx キーワード
static nothrow bool isValidIdentifier(const(char)* str);

static nothrow @trusted bool isValidIdentifier(const(char)[] str);
文字列が有効な識別子であるかどうかを判断する。
Parameters:
const(char)* str 確認する文字列
Returns: 無効な場合は false
無効な場合は false
falsefalse
Examples:
assert(Identifier.isValidIdentifier("tes123_t".ptr));
assert(!Identifier.isValidIdentifier("tes123_^t".ptr));
assert(Identifier.isValidIdentifier("te123s_ğt".ptr));
assert(!Identifier.isValidIdentifier("t^e123s_ğt".ptr));
falsefalse