@@ -23,12 +23,12 @@ |
||
| 23 | 23 | /** |
| 24 | 24 | * @var string Default parser output path |
| 25 | 25 | */ |
| 26 | - private const PARSER_GRAMMAR = __DIR__ . '/../../resources/grammar.pp2'; |
|
| 26 | + private const PARSER_GRAMMAR = __DIR__.'/../../resources/grammar.pp2'; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * @var string Default parser output path |
| 30 | 30 | */ |
| 31 | - private const OUT_PATH = __DIR__ . '/../Grammar'; |
|
| 31 | + private const OUT_PATH = __DIR__.'/../Grammar'; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * @var string Default generated parser class name |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $compiler->setClassName($in->getOption('class')); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $cwd = \getcwd() ?: __DIR__ . '/..'; |
|
| 44 | + $cwd = \getcwd() ?: __DIR__.'/..'; |
|
| 45 | 45 | |
| 46 | 46 | $compiler->saveTo($in->getOption('dir') ?: $cwd); |
| 47 | 47 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | |
| 38 | 38 | $ast = $in->getOption('root') ? $ast->first($in->getOption('root')) : $ast; |
| 39 | 39 | |
| 40 | - $out->write((string)$ast); |
|
| 40 | + $out->write((string) $ast); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | |
| 112 | 112 | case $child instanceof TokenDelegate: |
| 113 | 113 | $this->lexer->add($child->getTokenName(), $child->getTokenPattern()); |
| 114 | - if (! $child->isKept()) { |
|
| 114 | + if (!$child->isKept()) { |
|
| 115 | 115 | $this->lexer->skip($child->getTokenName()); |
| 116 | 116 | } |
| 117 | 117 | break; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function saveTo(string $path): void |
| 82 | 82 | { |
| 83 | - $pathName = $path . '/' . $this->class . '.php'; |
|
| 83 | + $pathName = $path.'/'.$this->class.'.php'; |
|
| 84 | 84 | |
| 85 | 85 | \file_put_contents($pathName, $this->build()); |
| 86 | 86 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | \ob_start(); |
| 95 | 95 | |
| 96 | 96 | try { |
| 97 | - require __DIR__ . '/../resources/templates/parser.tpl.php'; |
|
| 97 | + require __DIR__.'/../resources/templates/parser.tpl.php'; |
|
| 98 | 98 | return \ob_get_contents(); |
| 99 | 99 | } catch (\Throwable $e) { |
| 100 | 100 | throw $e; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function getInnerTokens(): iterable |
| 30 | 30 | { |
| 31 | - return new LookaheadIterator((function () { |
|
| 31 | + return new LookaheadIterator((function() { |
|
| 32 | 32 | yield from $this->getTokens($this->first('RuleProduction')); |
| 33 | 33 | yield new Eoi(0); |
| 34 | 34 | })->call($this)); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function isKept(): bool |
| 68 | 68 | { |
| 69 | - return (bool)$this->first('ShouldKeep'); |
|
| 69 | + return (bool) $this->first('ShouldKeep'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | $file = $this->getValues()->current()->getValue(1); |
| 31 | 31 | |
| 32 | 32 | foreach (['', '.pp', '.pp2'] as $ext) { |
| 33 | - $path = \dirname($from->getPathname()) . '/' . $file . $ext; |
|
| 33 | + $path = \dirname($from->getPathname()).'/'.$file.$ext; |
|
| 34 | 34 | |
| 35 | 35 | if (\is_file($path)) { |
| 36 | 36 | return File::fromPathname($path); |
@@ -244,23 +244,23 @@ discard block |
||
| 244 | 244 | break; |
| 245 | 245 | |
| 246 | 246 | case Parser::T_REPEAT_N_TO_M: |
| 247 | - $min = (int)$tokens->current()->getValue(1); |
|
| 248 | - $max = (int)$tokens->current()->getValue(2); |
|
| 247 | + $min = (int) $tokens->current()->getValue(1); |
|
| 248 | + $max = (int) $tokens->current()->getValue(2); |
|
| 249 | 249 | $tokens->next(); |
| 250 | 250 | break; |
| 251 | 251 | |
| 252 | 252 | case Parser::T_REPEAT_ZERO_TO_M: |
| 253 | - [$min, $max] = [0, (int)$tokens->current()->getValue(1)]; |
|
| 253 | + [$min, $max] = [0, (int) $tokens->current()->getValue(1)]; |
|
| 254 | 254 | $tokens->next(); |
| 255 | 255 | break; |
| 256 | 256 | |
| 257 | 257 | case Parser::T_REPEAT_N_OR_MORE: |
| 258 | - [$min, $max] = [(int)$tokens->current()->getValue(1), -1]; |
|
| 258 | + [$min, $max] = [(int) $tokens->current()->getValue(1), -1]; |
|
| 259 | 259 | $tokens->next(); |
| 260 | 260 | break; |
| 261 | 261 | |
| 262 | 262 | case Parser::T_REPEAT_EXACTLY_N: |
| 263 | - $min = $max = (int)$tokens->current()->getValue(1); |
|
| 263 | + $min = $max = (int) $tokens->current()->getValue(1); |
|
| 264 | 264 | $tokens->next(); |
| 265 | 265 | break; |
| 266 | 266 | } |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | { |
| 368 | 368 | $tokenName = $tokens->current()->getValue(1); |
| 369 | 369 | |
| 370 | - if (! \array_key_exists($tokenName, $this->rules)) { |
|
| 370 | + if (!\array_key_exists($tokenName, $this->rules)) { |
|
| 371 | 371 | $error = \vsprintf('Cannot call rule %s() in rule %s because it does not exist.', [ |
| 372 | 372 | $tokenName, |
| 373 | 373 | $this->ruleName, |