diff options
| author | Bobby <[email protected]> | 2024-03-29 20:19:31 +0000 |
|---|---|---|
| committer | Bobby <[email protected]> | 2024-03-29 20:19:31 +0000 |
| commit | cf6dd4b0e5efa1f8041d5570497a5228c737c454 (patch) | |
| tree | c15fa426e3a2c74ff6aa5261452ebadfbb3e0fed /object | |
| parent | c6a3c37f268ba3189a4902b852121e979c70817f (diff) | |
| download | mana-cf6dd4b0e5efa1f8041d5570497a5228c737c454.tar.xz mana-cf6dd4b0e5efa1f8041d5570497a5228c737c454.zip | |
Strings
Diffstat (limited to 'object')
| -rw-r--r-- | object/object.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/object/object.go b/object/object.go index 793ff6b..731be0b 100644 --- a/object/object.go +++ b/object/object.go @@ -15,6 +15,7 @@ const ( NULL_OBJ = "NULL" RETURN_VALUE_OBJ = "RETURN_VALUE" FUNCTION_OBJ = "FUNCTION" + STRING_OBJ = "STRING" ERROR_OBJ = "ERROR" ) @@ -47,6 +48,10 @@ type Function struct { Env *Environment } +type String struct { + Value string +} + func (i *Integer) Type() ObjectType { return INTEGER_OBJ } @@ -104,3 +109,6 @@ func (f *Function) Inspect() string { func (e *Error) Type() ObjectType { return ERROR_OBJ } func (e *Error) Inspect() string { return "ERROR:" + e.Message } + +func (s *String) Type() ObjectType { return STRING_OBJ } +func (s *String) Inspect() string { return s.Value } |
