Loading src/Calc/Formule.php +23 −3 Original line number Diff line number Diff line Loading @@ -46,7 +46,13 @@ class Formule public function analyse(): array { $this->terms = []; for ($i = 4; $i < strlen($this->formule); $i++) { $start = 0; if (str_starts_with($this->formule, 'of:=')){ $start = 4; } for ($i = $start; $i < strlen($this->formule); $i++) { $this->terms[] = [ 'type' => null, 'v' => $this->formule[$i], Loading Loading @@ -211,6 +217,20 @@ class Formule $next = $this->t($i + 1); if ($next['type'] === null && $next['v'] === '>') { $this->tw(['type' => 'op', 'name' => '<>'], $i, 2); return; } if ($next['type'] === null && $next['v'] === '=') { $this->tw(['type' => 'op', 'name' => '<='], $i, 2); return; } }elseif ($t['v'] === '>') { $next = $this->t($i + 1); if ($next['type'] === null && $next['v'] === '=') { $this->tw(['type' => 'op', 'name' => '>='], $i, 2); return; } } Loading Loading @@ -244,14 +264,14 @@ class Formule /* Détection de nombres */ if ($v === '0') { $this->tw(['type' => 'number', 'value' => 0], $i); $this->tw(['type' => 'number', 'value' => 0], $i, $length); return; } else { $vt = str_replace([',', ' '], ['.', ''], $v); $vf = (float)$vt; if ((string)$vf === $vt) { $this->tw(['type' => 'number', 'value' => $vf], $i); $this->tw(['type' => 'number', 'value' => $vf], $i, $length); return; } Loading Loading
src/Calc/Formule.php +23 −3 Original line number Diff line number Diff line Loading @@ -46,7 +46,13 @@ class Formule public function analyse(): array { $this->terms = []; for ($i = 4; $i < strlen($this->formule); $i++) { $start = 0; if (str_starts_with($this->formule, 'of:=')){ $start = 4; } for ($i = $start; $i < strlen($this->formule); $i++) { $this->terms[] = [ 'type' => null, 'v' => $this->formule[$i], Loading Loading @@ -211,6 +217,20 @@ class Formule $next = $this->t($i + 1); if ($next['type'] === null && $next['v'] === '>') { $this->tw(['type' => 'op', 'name' => '<>'], $i, 2); return; } if ($next['type'] === null && $next['v'] === '=') { $this->tw(['type' => 'op', 'name' => '<='], $i, 2); return; } }elseif ($t['v'] === '>') { $next = $this->t($i + 1); if ($next['type'] === null && $next['v'] === '=') { $this->tw(['type' => 'op', 'name' => '>='], $i, 2); return; } } Loading Loading @@ -244,14 +264,14 @@ class Formule /* Détection de nombres */ if ($v === '0') { $this->tw(['type' => 'number', 'value' => 0], $i); $this->tw(['type' => 'number', 'value' => 0], $i, $length); return; } else { $vt = str_replace([',', ' '], ['.', ''], $v); $vf = (float)$vt; if ((string)$vf === $vt) { $this->tw(['type' => 'number', 'value' => $vf], $i); $this->tw(['type' => 'number', 'value' => $vf], $i, $length); return; } Loading