diff --git a/src/Lexer.php b/src/Lexer.php index 16068b1b3..d507d9a54 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -466,16 +466,15 @@ class Lexer $regex = []; foreach ($operators as $operator => $length) { // an operator that ends with a character must be followed by - // a whitespace or a parenthesis + // a whitespace, a parenthesis, an opening map [ or sequence { $r = preg_quote($operator, '/'); if (ctype_alpha($operator[$length - 1])) { - $r .= '(?=[\s()])'; + $r .= '(?=[\s()\[{])'; } - // an operator that begins with a character must have a space before - // or a parenthesis + // an operator that begins with a character must not have a dot or pipe before if (ctype_alpha($operator[0])) { - $r = '(?<=[\s(])'.$r; + $r = '(? 'bar', 'foo' => ['bar' => 'bar', 'not' => 'not'], 'dir_object' => new \SplFileInfo(__DIR__), 'object' => new \stdClass(), 'resource' => opendir(__DIR__), 'safe' => new \Twig\Markup('foo', 'UTF-8')] --EXPECT-- @@ -124,3 +125,4 @@ OK OK OK OK +OK