scoates/xhpast — Issue #1: snippet that xhpast accepts, but php -l does not
Author: soxofaan
Created: 2012-02-01 15:04:55+00:00
State: open

We use xhpast for PHP syntax checking (it's much faster than php -l), but today I stumbled on a piece of PHP code that raised PHP parse issues with standard php, but seems ok with xhpast:

```
'Y');
echo "$x[y]\n";
echo "{$x['y']}\n";
echo "$x['y']\n";
```

php -l complains about the fifth line (with `"$x['y']\n"`):

```Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in test.php on line 5
```

the example.php script does not complain:

```
$ ./example.php test.php
'Y');
echo "$x[y]\n";
echo "{$x['y']}\n";
echo "$x['y']\n";

n_STATEMENT_LIST 'Y');
echo "$x[y]\n";
echo "{$x['y']}\n";
echo "$x['y']\n";
n_OPEN_TAG 'Y');
n_BINARY_EXPRESSION $x = array('y' => 'Y')
n_VARIABLE $x
n_OPERATOR =
n_ARRAY_LITERAL array('y' => 'Y')
n_ARRAY_VALUE_LIST 'y' => 'Y'
n_ARRAY_VALUE 'y' => 'Y'
n_STRING_SCALAR 'y'
n_STRING_SCALAR 'Y'
n_STATEMENT echo "$x[y]\n";
n_ECHO_LIST echo "$x[y]\n"
n_STRING_SCALAR "$x[y]\n"
n_STATEMENT echo "{$x['y']}\n";
n_ECHO_LIST echo "{$x['y']}\n"
n_STRING_SCALAR "{$x['y']}\n"
n_STATEMENT echo "$x['y']\n";
n_ECHO_LIST echo "$x['y']\n"
n_STRING_SCALAR "$x['y']\n"
```