@@ -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 */ |
@@ -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]; |
@@ -272,7 +272,7 @@ |
||
272 | 272 | continue; |
273 | 273 | } |
274 | 274 | if (($j = $symbol->value) === null) { |
275 | - throw new ParseException("Nonterminal {$symbol->name} used but not defined"); |
|
275 | + throw new ParseException("nonterminal {$symbol->name} used but not defined"); |
|
276 | 276 | } |
277 | 277 | $k = null; |
278 | 278 | while ($j) { |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | class Production |
18 | 18 | { |
19 | - const EMPTY = 0x10; |
|
19 | + const empty = 0x10; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var Production|null |