@@ -5,7 +5,7 @@ |
||
5 | 5 | * For the full copyright and license information, please view the LICENSE |
6 | 6 | * file that was distributed with this source code. |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace PhpYacc\Exception; |
11 | 11 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * For the full copyright and license information, please view the LICENSE |
6 | 6 | * file that was distributed with this source code. |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace PhpYacc\Exception; |
11 | 11 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * For the full copyright and license information, please view the LICENSE |
6 | 6 | * file that was distributed with this source code. |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace PhpYacc\Exception; |
11 | 11 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * For the full copyright and license information, please view the LICENSE |
6 | 6 | * file that was distributed with this source code. |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace PhpYacc\Exception; |
11 | 11 |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - $tmpList = $this->sortList($tmpList, function (Lr1 $x, Lr1 $y) { |
|
147 | + $tmpList = $this->sortList($tmpList, function(Lr1 $x, Lr1 $y) { |
|
148 | 148 | $gx = $x->item[-1]->code; |
149 | 149 | $gy = $y->item[-1]->code; |
150 | 150 | if ($gx !== $gy) { |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | if (!$tdefact) { |
321 | 321 | $tdefact = -1; |
322 | 322 | |
323 | - Utils::stableSort($tmpr, function (Reduce $x, Reduce $y) { |
|
323 | + Utils::stableSort($tmpr, function(Reduce $x, Reduce $y) { |
|
324 | 324 | if ($x->number != $y->number) { |
325 | 325 | return $y->number - $x->number; |
326 | 326 | } |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | // Squeeze tmpr |
347 | - $tmpr = array_filter($tmpr, function (Reduce $reduce) use ($tdefact) { |
|
347 | + $tmpr = array_filter($tmpr, function(Reduce $reduce) use ($tdefact) { |
|
348 | 348 | return $reduce->number !== $tdefact; |
349 | 349 | }); |
350 | 350 | |
351 | - Utils::stableSort($tmpr, function (Reduce $x, Reduce $y) { |
|
351 | + Utils::stableSort($tmpr, function(Reduce $x, Reduce $y) { |
|
352 | 352 | if ($x->symbol !== $y->symbol) { |
353 | 353 | return $x->symbol->code - $y->symbol->code; |
354 | 354 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | // Sort states in decreasing order of entries |
387 | 387 | // do not move initial state |
388 | 388 | $initState = array_shift($this->states); |
389 | - Utils::stableSort($this->states, function (State $p, State $q) { |
|
389 | + Utils::stableSort($this->states, function(State $p, State $q) { |
|
390 | 390 | $numReduces = count($p->reduce) - 1; // -1 for default action |
391 | 391 | $pt = $numReduces; |
392 | 392 | $pn = count($p->shifts) + $numReduces; |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | /** @var Symbol $left */ |
565 | 565 | $left = $gram->body[0]; |
566 | 566 | $right = $gram->body[1] ?? null; |
567 | - if (($right === null || ($right->associativity & Production::EMPTY)) && !($left->associativity & Production::EMPTY)) { |
|
568 | - $left->setAssociativityFlag(Production::EMPTY); |
|
567 | + if (($right === null || ($right->associativity & Production::empty)) && !($left->associativity & Production::empty)) { |
|
568 | + $left->setAssociativityFlag(Production::empty); |
|
569 | 569 | $changed = true; |
570 | 570 | } |
571 | 571 | } |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | if ($this->context->debug) { |
575 | 575 | $this->context->debug('EMPTY nonterminals: '); |
576 | 576 | foreach ($this->context->nonterminals as $symbol) { |
577 | - if ($symbol->associativity & Production::EMPTY) { |
|
577 | + if ($symbol->associativity & Production::empty) { |
|
578 | 578 | $this->context->debug(' '.$symbol->name); |
579 | 579 | } |
580 | 580 | } |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | */ |
682 | 682 | protected function findEmpty(Lr1 $tail, Symbol $x): Lr1 |
683 | 683 | { |
684 | - if (!$this->visited[$x->code] && ($x->associativity & Production::EMPTY)) { |
|
684 | + if (!$this->visited[$x->code] && ($x->associativity & Production::empty)) { |
|
685 | 685 | $this->visited[$x->code] = true; |
686 | 686 | |
687 | 687 | /** @var Production $gram */ |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * For the full copyright and license information, please view the LICENSE |
6 | 6 | * file that was distributed with this source code. |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace PhpYacc\Lalr; |
11 | 11 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * For the full copyright and license information, please view the LICENSE |
6 | 6 | * file that was distributed with this source code. |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace PhpYacc\Lalr; |
11 | 11 |
@@ -78,7 +78,7 @@ |
||
78 | 78 | public function offsetGet($index) |
79 | 79 | { |
80 | 80 | if (!$this->offsetExists($index)) { |
81 | - throw new \LogicException("Offset $index does not exist"); |
|
81 | + throw new \LogicException("offset $index does not exist"); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $this->production->body[$index + $this->pos]; |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * For the full copyright and license information, please view the LICENSE |
6 | 6 | * file that was distributed with this source code. |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace PhpYacc\Lalr; |
11 | 11 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * For the full copyright and license information, please view the LICENSE |
6 | 6 | * file that was distributed with this source code. |
7 | 7 | */ |
8 | -declare(strict_types=1); |
|
8 | +declare(strict_types = 1); |
|
9 | 9 | |
10 | 10 | namespace PhpYacc\Lalr; |
11 | 11 |