Skip to content

Commit c3bb5c5

Browse files
committed
Move parentheses inside instructions for Main block
1 parent b48a2ac commit c3bb5c5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/JsPhpize/Parser/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ public function parseBlock($block)
412412
{
413413
$this->stack[] = $block;
414414
$next = $this->get(0);
415-
if ($next && $next->is('(')) {
415+
if ($next && $next->is('(') && !($block instanceof Main)) {
416416
$this->skip();
417417
$block->setValue($this->parseParentheses());
418418
}

tests/compile.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ public function testCompileDollar()
8383
$this->assertSame('isset($item) ? $item : \'\';', $actual);
8484
}
8585

86+
public function testDoubleParentheses()
87+
{
88+
$jsPhpize = new JsPhpize();
89+
$template = "(('is regular, javascript'))";
90+
91+
$actual = trim($jsPhpize->compile($template));
92+
93+
$this->assertSame($template . ';', $actual);
94+
}
95+
8696
/**
8797
* @expectedException \JsPhpize\Compiler\Exception
8898
* @expectedExceptionCode 1111111

0 commit comments

Comments
 (0)