package runtime //go:generate stringer -type LoxType -trimprefix LoxType type LoxType int const ( LoxTypeString LoxType = iota LoxTypeNumber LoxTypeBoolean LoxTypeNil LoxTypeUndefined ) type LoxValue struct { raw any } func (v *LoxValue) Type() LoxType { switch v.raw.(type) { case string: return LoxTypeString case float64, float32: return LoxTypeNumber case bool: return LoxTypeBoolean default: return LoxTypeUndefined } } func Value(v any) *LoxValue { return &LoxValue{v} }