I'm working with
[https://people.eecs.berkeley.edu/~necula/cil/api/Cil.html](https://people.eecs.berkeley.edu/%7Enecula/cil/api/Cil.html)

and would like to match the pointers and extract the variable name in a certain expression

> 
> Example (assume this is correct)
> 
> 
> int \*\*p0, \*p1, \*\*p2, \*\*\*p3;
> 
> 
> my expression : \*\*p0 + \*p1 + \*\*p2 + \*\*p3
> 
> 
> 

I would like to match the entire dereferenced pointer like : `**p0, **p2, **p3` and not partially like: `*p0, *p2, *p3` (that's what my code does, thus it will match only `*p1` as desired)

```
class lvalVisitor ctx = object (*f d as params*)
inherit nopCilVisitor
method vlval lval = 

  match lval with
  (*this will match only *pointer and not **pointer or ***pointer *)
  | Mem (Lval (Var v, _)), _ -> printf "derefed. var %s" v.vname
    SkipChildren

  | Mem e, _ ->  DoChildren

  | _ -> DoChildren
  end

```

**TL;DR** I want to tell if a pointer is fully dereferenced or not (counting its stars is not a good option)