@@ -76,7 +76,8 @@ protected static function getExpression(string $v, Context $context, int|string
76
76
77
77
// handle double-quoted string
78
78
if (preg_match ('/^"(.*)"$/ ' , $ v , $ matched )) {
79
- return static ::getLiteral (preg_replace ('/([^ \\\\]) \\\\\\\\"/ ' , '$1" ' , preg_replace ('/^ \\\\\\\\"/ ' , '" ' , $ matched [1 ])), $ asis , true );
79
+ $ literal = str_replace ('\\\\" ' , '" ' , $ matched [1 ]);
80
+ return static ::getLiteral ($ literal , $ asis , true );
80
81
}
81
82
82
83
// handle single quoted string
@@ -150,18 +151,16 @@ protected static function getExpression(string $v, Context $context, int|string
150
151
public static function parse (array $ token , Context $ context ): array
151
152
{
152
153
$ vars = static ::analyze ($ token [Token::POS_INNERTAG ], $ context );
154
+ $ avars = static ::advancedVariable ($ vars , $ context , Token::toString ($ token ));
155
+
153
156
if ($ token [Token::POS_OP ] === '> ' ) {
154
157
$ fn = static ::getPartialName ($ vars );
158
+ if ($ fn !== null ) {
159
+ $ avars [0 ] = $ fn ;
160
+ }
155
161
} elseif ($ token [Token::POS_OP ] === '#* ' ) {
156
162
$ fn = static ::getPartialName ($ vars , 1 );
157
- }
158
-
159
- $ avars = static ::advancedVariable ($ vars , $ context , Token::toString ($ token ));
160
-
161
- if (isset ($ fn )) {
162
- if ($ token [Token::POS_OP ] === '> ' ) {
163
- $ avars [0 ] = $ fn ;
164
- } elseif ($ token [Token::POS_OP ] === '#* ' ) {
163
+ if ($ fn !== null ) {
165
164
$ avars [1 ] = $ fn ;
166
165
}
167
166
}
0 commit comments