src/parser/array.js
function(shortForm) {
    if (
      this.token === "," ||
      (!shortForm && this.token === ")") ||
      (shortForm && this.token === "]")
    ) {
      return null;
    }
    if (this.token === "&") {
      return this.next().read_variable(true, false, true);
    } else {
      const entry = this.node(ArrayEntry);
      const expr = this.read_expr();
      if (this.token === this.tok.T_DOUBLE_ARROW) {
        if (this.next().token === "&") {
          return entry(expr, this.next().read_variable(true, false, true));
        } else {
          return entry(expr, this.read_expr());
        }
      }
      return expr;
    }
  }
function(shortForm) {
    if (
      this.token === "," ||
      (!shortForm && this.token === ")") ||
      (shortForm && this.token === "]")
    ) {
      return null;
    }
    if (this.token === "&") {
      return this.next().read_variable(true, false, true);
    } else {
      const entry = this.node(ArrayEntry);
      const expr = this.read_expr();
      if (this.token === this.tok.T_DOUBLE_ARROW) {
        if (this.next().token === "&") {
          return entry(expr, this.next().read_variable(true, false, true));
        } else {
          return entry(expr, this.read_expr());
        }
      }
      return expr;
    }
  }
function ( shortForm ) { if ( this . token === "," || ( ! shortForm && this . token === ")" ) || ( shortForm && this . token === "]" ) ) { return null ; } if ( this . token === "&" ) { return this . next ( ) . read_variable ( true , false , true ) ; } else { const entry = this . node ( ArrayEntry ) ; const expr = this . read_expr ( ) ; if ( this . token === this . tok . T_DOUBLE_ARROW ) { if ( this . next ( ) . token === "&" ) { return entry ( expr , this . next ( ) . read_variable ( true , false , true ) ) ; } else { return entry ( expr , this . read_expr ( ) ) ; } } return expr ; } }
Reads an entry
array_pair:
expr T_DOUBLE_ARROW expr
| expr
| expr T_DOUBLE_ARROW '&' variable
| '&' variable
| expr T_DOUBLE_ARROW T_LIST '(' array_pair_list ')'
| T_LIST '(' array_pair_list ')'
Reads an entry array_pair : expr T_DOUBLE_ARROW expr | expr | expr T_DOUBLE_ARROW & variable | & variable | expr T_DOUBLE_ARROW T_LIST ( array_pair_list ) | T_LIST ( array_pair_list )