private function offsetVariable(Node $var) {
    if ($this->currentType === '{') {
      $node = new ArrayLookupNode();
      $node->addChild($var, 'array');
      $this->mustMatch('{', $node);
      $node->addChild($this->expr(), 'key');
      $this->mustMatch('}', $node, NULL, TRUE);
      return $this->offsetVariable($node);
    }
    elseif ($this->currentType === '[') {
      $node = new ArrayLookupNode();
      $node->addChild($var, 'array');
      $this->dimOffset($node);
      return $this->offsetVariable($node);
    }
    else {
      return $var;
    }
  }