nl_tokens: Reads a foreach loop ebnf foreach :: = ( expr T_AS foreach_variable ( T_DOUBLE_ARROW foreach_variable ) ? ) statement
pl_tokens: function ( ) { const result = this . node ( "foreach" ) ; this . expect ( this . tok . T_FOREACH ) && this . next ( ) ; let source = null ; let <mask> = null ; let value = null ; let body = null ; let shortForm = false ; if ( this . expect ( "(" ) ) this . next ( ) ; source = this . read_expr ( ) ; if ( this . expect ( this . tok . T_AS ) ) { this . next ( ) ; value = this . read_foreach_variable ( ) ; if ( this . token === this . tok . T_DOUBLE_ARROW ) { key = value ; value = this . next ( ) . read_foreach_variable ( ) ; } } // grammatically correct but not supported by PHP if ( key && key . kind === "list" ) { this . raiseError ( "Fatal Error : Cannot use list as key element" ) ; } if ( this . expect ( ")" ) ) this . next ( ) ; if ( this . token === ":" ) { shortForm = true ; body = this . read_short_form ( this . tok . T_ENDFOREACH ) ; } else { body = this . read_statement ( ) ; } return result ( source , key , value , body , shortForm ) ; }