Mercurial > projects > dmdscript-tango
comparison dmdscript_tango/identifier.d @ 0:55c2951c07be
initial, files origin, premoved tree
author | saaadel |
---|---|
date | Sun, 24 Jan 2010 12:34:47 +0200 |
parents | |
children | 8363a4bf6a8f |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:55c2951c07be |
---|---|
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 | |
21 module dmdscript.identifier; | |
22 | |
23 import dmdscript.script; | |
24 import dmdscript.value; | |
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 |