code: function(encapsed, byref) {
      let result = this.read_simple_variable(byref);
      let offset;
      while (this.token != this.EOF) {
        const node = this.node();
        /*
        if (this.token == "[") {
          offset = null;
          if (encapsed) {
            offset = this.next().read_encaps_var_offset();
          } else {
            offset = this.next().token === "]" ? null : this.read_dim_offset();
          }
          this.expect("]") && this.next();
          result = node("offsetlookup", result, offset);
        } else */
        if (this.token == "{" && !encapsed) {
          // @fixme check coverage, not sure thats working
          offset = this.next().read_expr();
          this.expect("}") && this.next();
          result = node("offsetlookup", result, offset);
        } else {
          node.destroy();
          break;
        }
      }
      return result;
    }
docs: ```ebnf
  reference_variable ::=  simple_variable ('[' OFFSET ']')* | '{' EXPR '}'
  ```
  <code>
  $foo[123];      // foo is an array ==> gets its entry
  $foo{1};        // foo is a string ==> get the 2nd char offset
  ${'foo'}[123];  // get the dynamic var $foo
  $foo[123]{1};   // gets the 2nd char from the 123 array entry
  </code>