File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
6+
7+ namespace OwnLang . ast . lib
8+ {
9+ public class ObjectValue : Value
10+ {
11+ private object value ;
12+
13+ public ObjectValue ( object value )
14+ {
15+ this . value = value ;
16+ }
17+
18+ public object asObject ( )
19+ {
20+ return value ;
21+ }
22+
23+ public char asChar ( )
24+ {
25+ return char . Parse ( value . ToString ( ) ) ;
26+ }
27+
28+ public double asDouble ( )
29+ {
30+ return double . Parse ( value . ToString ( ) ) ;
31+ }
32+
33+ public int asNumber ( )
34+ {
35+ return int . Parse ( value . ToString ( ) ) ;
36+ }
37+
38+ public string asString ( )
39+ {
40+ return value . ToString ( ) ;
41+ }
42+
43+ public TokenType type ( )
44+ {
45+ return TokenType . OBJECT ;
46+ }
47+ }
48+ }
You can’t perform that action at this time.
0 commit comments