Rename Scalar\EncapsedStringPart to InterpolatedStringPart

It is no longer an expression node, which unfortunately does
require a more awkward type for the Encaps node.
This commit is contained in:
Nikita Popov 2022-09-03 13:25:23 +02:00
parent 23835d20ef
commit f4ec6a1e53
18 changed files with 80 additions and 89 deletions

View File

@ -77,6 +77,8 @@ A number of AST nodes have been renamed or moved in the AST hierarchy:
* `Node\Scalar\LNumber` is now `Node\Scalar\Int_`. * `Node\Scalar\LNumber` is now `Node\Scalar\Int_`.
* `Node\Scalar\DNumber` is now `Node\Scalar\Float_`. * `Node\Scalar\DNumber` is now `Node\Scalar\Float_`.
* `Node\Scalar\EncapsedStringPart` is now `Node\InterpolatedStringPart` and no longer extends
`Node\Scalar` or `Node\Expr`.
* `Node\Expr\ClosureUse` is now `Node\ClosureUse` and no longer extends `Node\Expr`. * `Node\Expr\ClosureUse` is now `Node\ClosureUse` and no longer extends `Node\Expr`.
* `Node\Expr\ArrayItem` is now `Node\ArrayItem` and no longer extends `Node\Expr`. * `Node\Expr\ArrayItem` is now `Node\ArrayItem` and no longer extends `Node\Expr`.
* `Node\Stmt\StaticVar` is now `Node\StaticVar` and no longer extends `Node\Stmt`. * `Node\Stmt\StaticVar` is now `Node\StaticVar` and no longer extends `Node\Stmt`.

View File

@ -1127,7 +1127,7 @@ exit_expr:
backticks_expr: backticks_expr:
/* empty */ { $$ = array(); } /* empty */ { $$ = array(); }
| T_ENCAPSED_AND_WHITESPACE | T_ENCAPSED_AND_WHITESPACE
{ $$ = array(Scalar\EncapsedStringPart[Scalar\String_::parseEscapeSequences($1, '`')]); } { $$ = array(Node\InterpolatedStringPart[Scalar\String_::parseEscapeSequences($1, '`')]); }
| encaps_list { parseEncapsed($1, '`', true); $$ = $1; } | encaps_list { parseEncapsed($1, '`', true); $$ = $1; }
; ;
@ -1325,7 +1325,7 @@ encaps_list:
; ;
encaps_string_part: encaps_string_part:
T_ENCAPSED_AND_WHITESPACE { $$ = Scalar\EncapsedStringPart[$1]; } T_ENCAPSED_AND_WHITESPACE { $$ = Node\InterpolatedStringPart[$1]; }
; ;
encaps_str_varname: encaps_str_varname:

View File

@ -106,7 +106,7 @@ function resolveMacros($code) {
if ('parseEncapsed' === $name) { if ('parseEncapsed' === $name) {
assertArgs(3, $args, $name); assertArgs(3, $args, $name);
return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) {' return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\InterpolatedStringPart) {'
. ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, ' . $args[1] . ', ' . $args[2] . '); } }'; . ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, ' . $args[1] . ', ' . $args[2] . '); } }';
} }

View File

@ -1,15 +1,15 @@
<?php declare(strict_types=1); <?php declare(strict_types=1);
namespace PhpParser\Node\Scalar; namespace PhpParser\Node;
use PhpParser\Node\Scalar; use PhpParser\NodeAbstract;
class EncapsedStringPart extends Scalar { class InterpolatedStringPart extends NodeAbstract {
/** @var string String value */ /** @var string String value */
public $value; public $value;
/** /**
* Constructs a node representing a string part of an encapsed string. * Constructs a node representing a string part of an interpolated string.
* *
* @param string $value String value * @param string $value String value
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
@ -24,6 +24,6 @@ class EncapsedStringPart extends Scalar {
} }
public function getType(): string { public function getType(): string {
return 'Scalar_EncapsedStringPart'; return 'InterpolatedStringPart';
} }
} }

View File

@ -3,17 +3,18 @@
namespace PhpParser\Node\Scalar; namespace PhpParser\Node\Scalar;
use PhpParser\Node\Expr; use PhpParser\Node\Expr;
use PhpParser\Node\InterpolatedStringPart;
use PhpParser\Node\Scalar; use PhpParser\Node\Scalar;
class Encapsed extends Scalar { class Encapsed extends Scalar {
/** @var Expr[] list of string parts */ /** @var (Expr|InterpolatedStringPart)[] list of string parts */
public $parts; public $parts;
/** /**
* Constructs an encapsed string node. * Constructs an interpolated string node.
* *
* @param Expr[] $parts Encaps list * @param (Expr|InterpolatedStringPart)[] $parts Interpolated string parts
* @param array $attributes Additional attributes * @param array $attributes Additional attributes
*/ */
public function __construct(array $parts, array $attributes = []) { public function __construct(array $parts, array $attributes = []) {
$this->attributes = $attributes; $this->attributes = $attributes;

View File

@ -2707,10 +2707,10 @@ class Php7 extends \PhpParser\ParserAbstract
$this->semValue = array(); $this->semValue = array();
}, },
505 => function ($stackPos) { 505 => function ($stackPos) {
$this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos-(1-1)], '`'), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); $this->semValue = array(new Node\InterpolatedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos-(1-1)], '`'), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes));
}, },
506 => function ($stackPos) { 506 => function ($stackPos) {
foreach ($this->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', true); } }; $this->semValue = $this->semStack[$stackPos-(1-1)]; foreach ($this->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\InterpolatedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', true); } }; $this->semValue = $this->semStack[$stackPos-(1-1)];
}, },
507 => function ($stackPos) { 507 => function ($stackPos) {
$this->semValue = array(); $this->semValue = array();
@ -2768,7 +2768,7 @@ class Php7 extends \PhpParser\ParserAbstract
}, },
524 => function ($stackPos) { 524 => function ($stackPos) {
$attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED;
foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs); foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\InterpolatedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs);
}, },
525 => function ($stackPos) { 525 => function ($stackPos) {
$this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, $this->phpVersion->allowsInvalidOctals()); $this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, $this->phpVersion->allowsInvalidOctals());
@ -2982,7 +2982,7 @@ class Php7 extends \PhpParser\ParserAbstract
$this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); $this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]);
}, },
594 => function ($stackPos) { 594 => function ($stackPos) {
$this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->semValue = new Node\InterpolatedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
}, },
595 => function ($stackPos) { 595 => function ($stackPos) {
$this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);

View File

@ -2725,10 +2725,10 @@ class Php8 extends \PhpParser\ParserAbstract
$this->semValue = array(); $this->semValue = array();
}, },
505 => function ($stackPos) { 505 => function ($stackPos) {
$this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos-(1-1)], '`'), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes)); $this->semValue = array(new Node\InterpolatedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$stackPos-(1-1)], '`'), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes));
}, },
506 => function ($stackPos) { 506 => function ($stackPos) {
foreach ($this->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', true); } }; $this->semValue = $this->semStack[$stackPos-(1-1)]; foreach ($this->semStack[$stackPos-(1-1)] as $s) { if ($s instanceof Node\InterpolatedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', true); } }; $this->semValue = $this->semStack[$stackPos-(1-1)];
}, },
507 => function ($stackPos) { 507 => function ($stackPos) {
$this->semValue = array(); $this->semValue = array();
@ -2786,7 +2786,7 @@ class Php8 extends \PhpParser\ParserAbstract
}, },
524 => function ($stackPos) { 524 => function ($stackPos) {
$attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED; $attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED;
foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs); foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\InterpolatedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs);
}, },
525 => function ($stackPos) { 525 => function ($stackPos) {
$this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, $this->phpVersion->allowsInvalidOctals()); $this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes, $this->phpVersion->allowsInvalidOctals());
@ -3000,7 +3000,7 @@ class Php8 extends \PhpParser\ParserAbstract
$this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]); $this->semValue = array($this->semStack[$stackPos-(2-1)], $this->semStack[$stackPos-(2-2)]);
}, },
594 => function ($stackPos) { 594 => function ($stackPos) {
$this->semValue = new Scalar\EncapsedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->semValue = new Node\InterpolatedStringPart($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
}, },
595 => function ($stackPos) { 595 => function ($stackPos) {
$this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes); $this->semValue = new Expr\Variable($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);

View File

@ -777,7 +777,7 @@ abstract class ParserAbstract implements Parser {
return new String_($contents, $attributes); return new String_($contents, $attributes);
} else { } else {
assert(count($contents) > 0); assert(count($contents) > 0);
if (!$contents[0] instanceof Node\Scalar\EncapsedStringPart) { if (!$contents[0] instanceof Node\InterpolatedStringPart) {
// If there is no leading encapsed string part, pretend there is an empty one // If there is no leading encapsed string part, pretend there is an empty one
$this->stripIndentation( $this->stripIndentation(
'', $indentLen, $indentChar, true, false, $contents[0]->getAttributes() '', $indentLen, $indentChar, true, false, $contents[0]->getAttributes()
@ -786,7 +786,7 @@ abstract class ParserAbstract implements Parser {
$newContents = []; $newContents = [];
foreach ($contents as $i => $part) { foreach ($contents as $i => $part) {
if ($part instanceof Node\Scalar\EncapsedStringPart) { if ($part instanceof Node\InterpolatedStringPart) {
$isLast = $i === \count($contents) - 1; $isLast = $i === \count($contents) - 1;
$part->value = $this->stripIndentation( $part->value = $this->stripIndentation(
$part->value, $indentLen, $indentChar, $part->value, $indentLen, $indentChar,

View File

@ -168,7 +168,7 @@ class Standard extends PrettyPrinterAbstract {
$label = $node->getAttribute('docLabel'); $label = $node->getAttribute('docLabel');
if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) { if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) {
if (count($node->parts) === 1 if (count($node->parts) === 1
&& $node->parts[0] instanceof Scalar\EncapsedStringPart && $node->parts[0] instanceof Node\InterpolatedStringPart
&& $node->parts[0]->value === '' && $node->parts[0]->value === ''
) { ) {
return "<<<$label\n$label" . $this->docStringEndToken; return "<<<$label\n$label" . $this->docStringEndToken;
@ -238,10 +238,6 @@ class Standard extends PrettyPrinterAbstract {
return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue; return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue;
} }
protected function pScalar_EncapsedStringPart(Scalar\EncapsedStringPart $node) {
throw new \LogicException('Cannot directly print EncapsedStringPart');
}
// Assignments // Assignments
protected function pExpr_Assign(Expr\Assign $node) { protected function pExpr_Assign(Expr\Assign $node) {
@ -1001,7 +997,7 @@ class Standard extends PrettyPrinterAbstract {
protected function pEncapsList(array $encapsList, $quote) { protected function pEncapsList(array $encapsList, $quote) {
$return = ''; $return = '';
foreach ($encapsList as $element) { foreach ($encapsList as $element) {
if ($element instanceof Scalar\EncapsedStringPart) { if ($element instanceof Node\InterpolatedStringPart) {
$return .= $this->escapeString($element->value, $quote); $return .= $this->escapeString($element->value, $quote);
} else { } else {
$return .= '{' . $this->p($element) . '}'; $return .= '{' . $this->p($element) . '}';
@ -1064,7 +1060,7 @@ class Standard extends PrettyPrinterAbstract {
foreach ($parts as $i => $part) { foreach ($parts as $i => $part) {
$atStart = $i === 0; $atStart = $i === 0;
$atEnd = $i === count($parts) - 1; $atEnd = $i === count($parts) - 1;
if ($part instanceof Scalar\EncapsedStringPart if ($part instanceof Node\InterpolatedStringPart
&& $this->containsEndLabel($part->value, $label, $atStart, $atEnd) && $this->containsEndLabel($part->value, $label, $atStart, $atEnd)
) { ) {
return true; return true;

View File

@ -975,7 +975,7 @@ abstract class PrettyPrinterAbstract {
} }
break; break;
case self::FIXUP_ENCAPSED: case self::FIXUP_ENCAPSED:
if (!$subNode instanceof Scalar\EncapsedStringPart if (!$subNode instanceof Node\InterpolatedStringPart
&& !$this->origTokens->haveBraces($subStartPos, $subEndPos) && !$this->origTokens->haveBraces($subStartPos, $subEndPos)
) { ) {
return '{' . $this->p($subNode) . '}'; return '{' . $this->p($subNode) . '}';

View File

@ -6,7 +6,7 @@ use PhpParser\Node\Expr;
use PhpParser\Node\Name; use PhpParser\Node\Name;
use PhpParser\Node\Scalar\Float_; use PhpParser\Node\Scalar\Float_;
use PhpParser\Node\Scalar\Encapsed; use PhpParser\Node\Scalar\Encapsed;
use PhpParser\Node\Scalar\EncapsedStringPart; use PhpParser\Node\InterpolatedStringPart;
use PhpParser\Node\Scalar\Int_; use PhpParser\Node\Scalar\Int_;
use PhpParser\Node\Scalar\String_; use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt; use PhpParser\Node\Stmt;
@ -115,17 +115,17 @@ class PrettyPrinterTest extends CodeTestAbstract {
// Empty doc string variations (encapsed variant does not occur naturally) // Empty doc string variations (encapsed variant does not occur naturally)
[new String_("", $nowdoc), "<<<'STR'\nSTR\n"], [new String_("", $nowdoc), "<<<'STR'\nSTR\n"],
[new String_("", $heredoc), "<<<STR\nSTR\n"], [new String_("", $heredoc), "<<<STR\nSTR\n"],
[new Encapsed([new EncapsedStringPart('')], $heredoc), "<<<STR\nSTR\n"], [new Encapsed([new InterpolatedStringPart('')], $heredoc), "<<<STR\nSTR\n"],
// Encapsed doc string variations // Encapsed doc string variations
[new Encapsed([new EncapsedStringPart('foo')], $heredoc), "<<<STR\nfoo\nSTR\n"], [new Encapsed([new InterpolatedStringPart('foo')], $heredoc), "<<<STR\nfoo\nSTR\n"],
[new Encapsed([new EncapsedStringPart('foo'), new Expr\Variable('y')], $heredoc), "<<<STR\nfoo{\$y}\nSTR\n"], [new Encapsed([new InterpolatedStringPart('foo'), new Expr\Variable('y')], $heredoc), "<<<STR\nfoo{\$y}\nSTR\n"],
[new Encapsed([new EncapsedStringPart("\nSTR"), new Expr\Variable('y')], $heredoc), "<<<STR\n\nSTR{\$y}\nSTR\n"], [new Encapsed([new InterpolatedStringPart("\nSTR"), new Expr\Variable('y')], $heredoc), "<<<STR\n\nSTR{\$y}\nSTR\n"],
[new Encapsed([new EncapsedStringPart("\nSTR"), new Expr\Variable('y')], $heredoc), "<<<STR\n\nSTR{\$y}\nSTR\n"], [new Encapsed([new InterpolatedStringPart("\nSTR"), new Expr\Variable('y')], $heredoc), "<<<STR\n\nSTR{\$y}\nSTR\n"],
[new Encapsed([new Expr\Variable('y'), new EncapsedStringPart("STR\n")], $heredoc), "<<<STR\n{\$y}STR\n\nSTR\n"], [new Encapsed([new Expr\Variable('y'), new InterpolatedStringPart("STR\n")], $heredoc), "<<<STR\n{\$y}STR\n\nSTR\n"],
// Encapsed doc string fallback // Encapsed doc string fallback
[new Encapsed([new Expr\Variable('y'), new EncapsedStringPart("\nSTR")], $heredoc), '"{$y}\\nSTR"'], [new Encapsed([new Expr\Variable('y'), new InterpolatedStringPart("\nSTR")], $heredoc), '"{$y}\\nSTR"'],
[new Encapsed([new EncapsedStringPart("STR\n"), new Expr\Variable('y')], $heredoc), '"STR\\n{$y}"'], [new Encapsed([new InterpolatedStringPart("STR\n"), new Expr\Variable('y')], $heredoc), '"STR\\n{$y}"'],
[new Encapsed([new EncapsedStringPart("STR")], $heredoc), '"STR"'], [new Encapsed([new InterpolatedStringPart("STR")], $heredoc), '"STR"'],
]; ];
} }
@ -169,14 +169,6 @@ class PrettyPrinterTest extends CodeTestAbstract {
$prettyPrinter->prettyPrint($stmts); $prettyPrinter->prettyPrint($stmts);
} }
public function testPrettyPrintEncapsedStringPart() {
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('Cannot directly print EncapsedStringPart');
$expr = new Node\Scalar\EncapsedStringPart('foo');
$prettyPrinter = new PrettyPrinter\Standard();
$prettyPrinter->prettyPrintExpr($expr);
}
/** /**
* @dataProvider provideTestFormatPreservingPrint * @dataProvider provideTestFormatPreservingPrint
* @covers \PhpParser\PrettyPrinter\Standard<extended> * @covers \PhpParser\PrettyPrinter\Standard<extended>

View File

@ -17,7 +17,7 @@ array(
1: Stmt_Expression( 1: Stmt_Expression(
expr: Expr_ShellExec( expr: Expr_ShellExec(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: test value: test
) )
) )
@ -26,7 +26,7 @@ array(
2: Stmt_Expression( 2: Stmt_Expression(
expr: Expr_ShellExec( expr: Expr_ShellExec(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: test value: test
) )
1: Expr_Variable( 1: Expr_Variable(
@ -38,7 +38,7 @@ array(
3: Stmt_Expression( 3: Stmt_Expression(
expr: Expr_ShellExec( expr: Expr_ShellExec(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: test ` value: test `
) )
) )
@ -47,7 +47,7 @@ array(
4: Stmt_Expression( 4: Stmt_Expression(
expr: Expr_ShellExec( expr: Expr_ShellExec(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: test \" value: test \"
) )
) )

View File

@ -25,7 +25,7 @@ array(
expr: Expr_ArrayDimFetch( expr: Expr_ArrayDimFetch(
var: Scalar_Encapsed( var: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: foo value: foo
) )
1: Expr_Variable( 1: Expr_Variable(
@ -42,7 +42,7 @@ array(
expr: Expr_MethodCall( expr: Expr_MethodCall(
var: Scalar_Encapsed( var: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: foo value: foo
) )
1: Expr_Variable( 1: Expr_Variable(

View File

@ -66,7 +66,7 @@ array(
4: Stmt_Expression( 4: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: Test value: Test
) )
1: Expr_Variable( 1: Expr_Variable(
@ -84,13 +84,13 @@ array(
5: Stmt_Expression( 5: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: Test value: Test
) )
1: Expr_Variable( 1: Expr_Variable(
name: a name: a
) )
2: Scalar_EncapsedStringPart( 2: InterpolatedStringPart(
value: and value: and
) )
3: Expr_PropertyFetch( 3: Expr_PropertyFetch(
@ -101,7 +101,7 @@ array(
name: c name: c
) )
) )
4: Scalar_EncapsedStringPart( 4: InterpolatedStringPart(
value: test value: test
) )
) )

View File

@ -37,7 +37,7 @@ array(
0: Expr_Variable( 0: Expr_Variable(
name: var name: var
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: value:
) )
@ -67,11 +67,11 @@ array(
0: Expr_Variable( 0: Expr_Variable(
name: var name: var
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: value:
) )
) )
) )
) )
) )

View File

@ -223,13 +223,13 @@ array(
15: Stmt_Expression( 15: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: \{ value: \{
) )
1: Expr_Variable( 1: Expr_Variable(
name: A name: A
) )
2: Scalar_EncapsedStringPart( 2: InterpolatedStringPart(
value: } value: }
) )
) )
@ -238,13 +238,13 @@ array(
16: Stmt_Expression( 16: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: \{ value: \{
) )
1: Expr_Variable( 1: Expr_Variable(
name: A name: A
) )
2: Scalar_EncapsedStringPart( 2: InterpolatedStringPart(
value: } value: }
) )
) )
@ -253,7 +253,7 @@ array(
17: Stmt_Expression( 17: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: \ value: \
) )
1: Expr_Variable( 1: Expr_Variable(
@ -265,13 +265,13 @@ array(
18: Stmt_Expression( 18: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: \{ value: \{
) )
1: Expr_Variable( 1: Expr_Variable(
name: A name: A
) )
2: Scalar_EncapsedStringPart( 2: InterpolatedStringPart(
value: } value: }
) )
) )
@ -285,7 +285,7 @@ array(
name: A name: A
) )
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: [B] value: [B]
) )
) )
@ -294,7 +294,7 @@ array(
20: Stmt_Expression( 20: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: $ value: $
) )
1: Expr_ArrayDimFetch( 1: Expr_ArrayDimFetch(
@ -311,13 +311,13 @@ array(
21: Stmt_Expression( 21: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: A value: A
) )
1: Expr_Variable( 1: Expr_Variable(
name: B name: B
) )
2: Scalar_EncapsedStringPart( 2: InterpolatedStringPart(
value: C value: C
) )
) )

View File

@ -166,7 +166,7 @@ array(
5: Stmt_Expression( 5: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: a value: a
b b
@ -174,7 +174,7 @@ array(
1: Expr_Variable( 1: Expr_Variable(
name: test name: test
) )
2: Scalar_EncapsedStringPart( 2: InterpolatedStringPart(
value: value:
d d
e e
@ -200,7 +200,7 @@ array(
7: Stmt_Expression( 7: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: a value: a
@@{ "\t" }@@a @@{ "\t" }@@a
@ -212,7 +212,7 @@ array(
1: Expr_Variable( 1: Expr_Variable(
name: test name: test
) )
2: Scalar_EncapsedStringPart( 2: InterpolatedStringPart(
value: value:
d d
@ -229,7 +229,7 @@ array(
0: Expr_Variable( 0: Expr_Variable(
name: one name: one
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: - value: -
) )
) )
@ -241,7 +241,7 @@ array(
0: Expr_Variable( 0: Expr_Variable(
name: two name: two
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: - value: -
) )
) )
@ -253,7 +253,7 @@ array(
0: Expr_Variable( 0: Expr_Variable(
name: three name: three
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: - value: -
) )
) )
@ -265,7 +265,7 @@ array(
0: Expr_Variable( 0: Expr_Variable(
name: four name: four
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: - value: -
) )
2: Expr_Variable( 2: Expr_Variable(
@ -280,13 +280,13 @@ array(
0: Expr_Variable( 0: Expr_Variable(
name: five name: five
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: - value: -
) )
2: Expr_Variable( 2: Expr_Variable(
name: five name: five
) )
3: Scalar_EncapsedStringPart( 3: InterpolatedStringPart(
value: - value: -
) )
) )
@ -298,13 +298,13 @@ array(
0: Expr_Variable( 0: Expr_Variable(
name: six name: six
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: - value: -
) )
2: Expr_Variable( 2: Expr_Variable(
name: six name: six
) )
3: Scalar_EncapsedStringPart( 3: InterpolatedStringPart(
value: - value: -
) )
4: Expr_Variable( 4: Expr_Variable(
@ -319,7 +319,7 @@ array(
0: Expr_Variable( 0: Expr_Variable(
name: seven name: seven
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: value:
- -
) )
@ -332,7 +332,7 @@ array(
0: Expr_Variable( 0: Expr_Variable(
name: eight name: eight
) )
1: Scalar_EncapsedStringPart( 1: InterpolatedStringPart(
value: value:
- -
) )

View File

@ -80,7 +80,7 @@ array(
5: Stmt_Expression( 5: Stmt_Expression(
expr: Scalar_Encapsed( expr: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: Foo value: Foo
) )
@ -103,7 +103,7 @@ array(
exprs: array( exprs: array(
0: Scalar_Encapsed( 0: Scalar_Encapsed(
parts: array( parts: array(
0: Scalar_EncapsedStringPart( 0: InterpolatedStringPart(
value: a value: a
) )
@ -114,4 +114,4 @@ array(
) )
) )
) )
) )