Differences From Artifact [43e26264d772abeb]:
- File
polemy/value.d
- 2010-11-23 13:55:15 - part of checkin [2134cd44cc] on branch trunk - further clean-up for polemy2d (user: kinaba) [annotate]
To Artifact [dc69a053821951bd]:
- File
polemy/value.d
- 2010-11-24 03:30:56 - part of checkin [20be503cae] on branch trunk - set up referece manual (user: kinaba) [annotate]
27 this(long n) { this.data = n; } 27 this(long n) { this.data = n; }
28 this(BigInt n) { this.data = n; } 28 this(BigInt n) { this.data = n; }
29 this(string n) { this.data = BigInt(n); } 29 this(string n) { this.data = BigInt(n); }
30 override string toString() const { return toDecimalString(cast(BigInt)da 30 override string toString() const { return toDecimalString(cast(BigInt)da
31 override int opCmp(Object rhs) { 31 override int opCmp(Object rhs) {
32 if(auto r = cast(IntValue)rhs) return data.opCmp(r.data); 32 if(auto r = cast(IntValue)rhs) return data.opCmp(r.data);
33 if(auto r = cast(Value)rhs) return typeid(this).opCmp(typeid( 33 if(auto r = cast(Value)rhs) return typeid(this).opCmp(typeid(
34 throw genex!RuntimeException(LexPosition.dummy, "comparison with | 34 throw genex!RuntimeException("comparison with value and somithin
35 } 35 }
36 mixin SimpleToHash; 36 mixin SimpleToHash;
37 } 37 }
38 38
39 /// 39 ///
40 class StrValue : Value 40 class StrValue : Value
41 { 41 {
................................................................................................................................................................................
42 string data; 42 string data;
43 43
44 mixin SimpleConstructor; 44 mixin SimpleConstructor;
45 override string toString() const { return data; } 45 override string toString() const { return data; }
46 override int opCmp(Object rhs) { 46 override int opCmp(Object rhs) {
47 if(auto r = cast(StrValue)rhs) return typeid(string).compare(&da 47 if(auto r = cast(StrValue)rhs) return typeid(string).compare(&da
48 if(auto r = cast(Value)rhs) return typeid(this).opCmp(typeid( 48 if(auto r = cast(Value)rhs) return typeid(this).opCmp(typeid(
49 throw genex!RuntimeException(LexPosition.dummy, "comparison with | 49 throw genex!RuntimeException("comparison with value and somithin
50 } 50 }
51 mixin SimpleToHash; 51 mixin SimpleToHash;
52 } 52 }
53 53
54 /// 54 ///
55 class UndefinedValue : Value 55 class UndefinedValue : Value
56 { 56 {
57 mixin SimpleConstructor; 57 mixin SimpleConstructor;
58 override string toString() const { return "<undefined>"; } 58 override string toString() const { return "<undefined>"; }
59 override int opCmp(Object rhs) { 59 override int opCmp(Object rhs) {
60 if(auto r = cast(StrValue)rhs) return 0; 60 if(auto r = cast(StrValue)rhs) return 0;
61 if(auto r = cast(Value)rhs) return typeid(this).opCmp(typeid( 61 if(auto r = cast(Value)rhs) return typeid(this).opCmp(typeid(
62 throw genex!RuntimeException(LexPosition.dummy, "comparison with | 62 throw genex!RuntimeException("comparison with value and somithin
63 } 63 }
64 mixin SimpleToHash; 64 mixin SimpleToHash;
65 } 65 }
66 66
67 /// 67 ///
68 abstract class FunValue : Value 68 abstract class FunValue : Value
69 { 69 {