0
|
1
|
|
2 /* Digital Mars DMDScript source code.
|
|
3 * Copyright (c) 2000-2002 by Chromium Communications
|
|
4 * D version Copyright (c) 2004-2009 by Digital Mars
|
|
5 * All Rights Reserved
|
|
6 * written by Walter Bright
|
|
7 * http://www.digitalmars.com
|
|
8 * Use at your own risk. There is no warranty, express or implied.
|
|
9 * License for redistribution is by the GNU General Public License in gpl.txt.
|
|
10 *
|
|
11 * A binary, non-exclusive license for commercial use can be
|
|
12 * purchased from www.digitalmars.com/dscript/buy.html.
|
|
13 *
|
|
14 * DMDScript is implemented in the D Programming Language,
|
|
15 * www.digitalmars.com/d/
|
|
16 *
|
|
17 * For a C++ implementation of DMDScript, including COM support,
|
|
18 * see www.digitalmars.com/dscript/cppscript.html.
|
|
19 */
|
|
20
|
3
|
21 module dmdscript_tango.identifier;
|
0
|
22
|
3
|
23 import dmdscript_tango.script;
|
|
24 import dmdscript_tango.value;
|
0
|
25
|
|
26 /* An Identifier is a special case of a Value - it is a V_STRING
|
|
27 * and has the hash value computed and set.
|
|
28 */
|
|
29
|
|
30 struct Identifier
|
|
31 {
|
|
32 Value value;
|
|
33
|
|
34 tchar[] toString()
|
|
35 {
|
|
36 return value.string;
|
|
37 }
|
|
38
|
|
39 int opEquals(Identifier *id)
|
|
40 {
|
|
41 return this is id || value.string == id.value.string;
|
|
42 }
|
|
43
|
|
44 static Identifier* build(tchar[] s)
|
|
45 { Identifier* id = new Identifier;
|
|
46 id.value.putVstring(s);
|
|
47 id.value.toHash();
|
|
48 return id;
|
|
49 }
|
|
50
|
|
51 uint toHash()
|
|
52 {
|
|
53 return value.hash;
|
|
54 }
|
|
55 }
|
|
56
|
|
57
|