formula fix string double backslash and quote

This commit is contained in:
Yuri Kuznetsov
2024-04-24 13:33:52 +03:00
parent ddf904fa0f
commit 38ce78fced
2 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -144,7 +144,7 @@ class Parser
{
return
($string[$i - 1] ?? null) !== "\\" ||
($string[$i - 2] ?? null) === "\\";
(($string[$i - 2] ?? null) === "\\" && ($string[$i - 3] ?? null) !== "\\");
}
/**
@@ -1499,4 +1499,24 @@ class EvaluatorTest extends \PHPUnit\Framework\TestCase
$this->assertEquals("\n\\test\n", $result);
}
public function testStrings8(): void
{
$expression = '"\\\\\\""';
/** @noinspection PhpUnhandledExceptionInspection */
$result = $this->evaluator->process($expression);
$this->assertEquals("\\\"", $result);
}
public function testStrings9(): void
{
$expression = '"\\\\\\"test\\\\\\""';
/** @noinspection PhpUnhandledExceptionInspection */
$result = $this->evaluator->process($expression);
$this->assertEquals("\\\"test\\\"", $result);
}
}