@@ -46,7 +46,7 @@ |
||
46 | 46 | public function generate(Readable $file, iterable $records): Document |
47 | 47 | { |
48 | 48 | foreach ($records as $record) { |
49 | - echo __FILE__ . ':' . __LINE__ . "\n"; |
|
49 | + echo __FILE__.':'.__LINE__."\n"; |
|
50 | 50 | echo \json_encode($record, \JSON_PRETTY_PRINT); |
51 | 51 | } |
52 | 52 |
@@ -13,16 +13,9 @@ |
||
13 | 13 | use Psr\Log\LoggerAwareTrait; |
14 | 14 | use Psr\Log\LoggerInterface; |
15 | 15 | use Railt\Io\Readable; |
16 | -use Railt\Parser\Ast\RuleInterface; |
|
17 | -use Railt\Parser\Exception\UnexpectedTokenException; |
|
18 | -use Railt\Parser\Exception\UnrecognizedTokenException; |
|
19 | 16 | use Railt\SDL\Exception\SyntaxException; |
20 | 17 | use Railt\SDL\Frontend\Builder; |
21 | 18 | use Railt\SDL\Frontend\Context\ContextInterface; |
22 | -use Railt\SDL\Frontend\Context\GlobalContext; |
|
23 | -use Railt\SDL\Frontend\Parser; |
|
24 | -use Railt\SDL\IR\DefinitionValueObject; |
|
25 | -use Railt\SDL\IR\SymbolTable; |
|
26 | 19 | |
27 | 20 | /** |
28 | 21 | * Class Frontend |
@@ -11,7 +11,6 @@ |
||
11 | 11 | |
12 | 12 | use Railt\Io\Readable; |
13 | 13 | use Railt\Parser\Ast\RuleInterface; |
14 | -use Railt\Parser\Exception\UnexpectedTokenException; |
|
15 | 14 | use Railt\Parser\Exception\UnrecognizedTokenException; |
16 | 15 | use Railt\SDL\Exception\CompilerException; |
17 | 16 | use Railt\SDL\Exception\InternalException; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | /** @noinspection SuspiciousAssignmentsInspection */ |
244 | 244 | $value = $this->store->add($value); |
245 | 245 | |
246 | - if (! $value->getOffset()) { |
|
246 | + if (!$value->getOffset()) { |
|
247 | 247 | $value->definedIn($offset); |
248 | 248 | } |
249 | 249 | |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | */ |
269 | 269 | private function after(ContextInterface $context): \Generator |
270 | 270 | { |
271 | - $after = $this->store->extract(function (DeferredInterface $deferred): bool { |
|
272 | - return ! $deferred instanceof Identifiable || ! $deferred->getDefinition()->isGeneric(); |
|
271 | + $after = $this->store->extract(function(DeferredInterface $deferred): bool { |
|
272 | + return !$deferred instanceof Identifiable || !$deferred->getDefinition()->isGeneric(); |
|
273 | 273 | }); |
274 | 274 | |
275 | 275 | foreach ($after as $deferred) { |
@@ -15,9 +15,7 @@ |
||
15 | 15 | use Railt\SDL\Frontend\Deferred\Deferred; |
16 | 16 | use Railt\SDL\Frontend\Deferred\DeferredInterface; |
17 | 17 | use Railt\SDL\Frontend\Deferred\NamedDeferred; |
18 | -use Railt\SDL\IR\SymbolTable\Value; |
|
19 | 18 | use Railt\SDL\IR\SymbolTable\VarSymbolInterface; |
20 | -use Railt\SDL\IR\Type; |
|
21 | 19 | use Railt\SDL\IR\Type\TypeNameInterface; |
22 | 20 | |
23 | 21 | /** |
@@ -128,7 +128,7 @@ |
||
128 | 128 | * @param TypeInterface|null $type |
129 | 129 | * @return VarSymbolInterface |
130 | 130 | */ |
131 | - public function declare(string $var, TypeInterface $type = null): VarSymbolInterface |
|
131 | + public function declare(string$var,TypeInterface$type=null): VarSymbolInterface |
|
132 | 132 | { |
133 | 133 | if ($this->has($var)) { |
134 | 134 | $error = 'Can not define var $%s, because %s already has been defined'; |
@@ -81,7 +81,7 @@ |
||
81 | 81 | $arguments = []; |
82 | 82 | |
83 | 83 | foreach ($this->arguments as $name => $value) { |
84 | - $arguments[] = $name . ': ' . $value; |
|
84 | + $arguments[] = $name.': '.$value; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | return \sprintf('%s<%s>', $this->name->getFullyQualifiedName(), \implode(', ', $arguments)); |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | /** @var ValueInterface $value */ |
45 | 45 | $value = yield $rule->getChild(0); |
46 | 46 | |
47 | - if (! $value->getType()->typeOf(Type::string())) { |
|
47 | + if (!$value->getType()->typeOf(Type::string())) { |
|
48 | 48 | $error = 'Argument of include should be a string, but %s given'; |
49 | 49 | throw new InvalidArgumentException(\sprintf($error, $value->getType())); |
50 | 50 | } |
51 | 51 | |
52 | - yield from $this->loadFile($this->include($ctx, (string)$value->getValue())); |
|
52 | + yield from $this->loadFile($this->include($ctx, (string) $value->getValue())); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | return $inclusion; |
97 | 97 | } |
98 | 98 | |
99 | - $pathname = \dirname($file->getPathname()) . \DIRECTORY_SEPARATOR . $inclusion; |
|
99 | + $pathname = \dirname($file->getPathname()).\DIRECTORY_SEPARATOR.$inclusion; |
|
100 | 100 | $pathname = \str_replace('/./', '/', $pathname); |
101 | 101 | |
102 | 102 | return $pathname; |
@@ -45,7 +45,7 @@ |
||
45 | 45 | /** @var DefinitionInterface $definition */ |
46 | 46 | $definition = yield $rule->first('> #TypeDefinition'); |
47 | 47 | |
48 | - yield new NamedDeferred($definition, $ctx, function (ContextInterface $local) use ($definition, $rule) { |
|
48 | + yield new NamedDeferred($definition, $ctx, function(ContextInterface $local) use ($definition, $rule) { |
|
49 | 49 | $struct = new ObjectDefinitionValueObject(); |
50 | 50 | |
51 | 51 | $struct->type = Type::object($definition->getName()->getFullyQualifiedName()); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $isConst = $name->getType()->typeOf(Type::const()); |
82 | 82 | |
83 | - if (! $isConst) { |
|
83 | + if (!$isConst) { |
|
84 | 84 | $error = 'Generic argument name must be a const but %s given'; |
85 | 85 | $exception = new TypeConflictException(\sprintf($error, $name)); |
86 | 86 | $exception->throwsIn($ctx->getFile(), $rule->getOffset()); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | throw $exception; |
89 | 89 | } |
90 | 90 | |
91 | - return Name::fromString((string)$name->getValue()); |
|
91 | + return Name::fromString((string) $name->getValue()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | $isType = $value->getType()->typeOf(Type::type()); |
105 | 105 | |
106 | - if (! $isType) { |
|
106 | + if (!$isType) { |
|
107 | 107 | $error = 'Generic argument value must be a valid type, but %s given'; |
108 | 108 | $exception = new TypeConflictException(\sprintf($error, $value)); |
109 | 109 | $exception->throwsIn($ctx->getFile(), $rule->getOffset()); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | switch (true) { |
130 | 130 | case $isConst: |
131 | - return new InvocationPrimitive(Name::fromString((string)$name->getValue())); |
|
131 | + return new InvocationPrimitive(Name::fromString((string) $name->getValue())); |
|
132 | 132 | |
133 | 133 | case $isType: |
134 | 134 | /** @var InvocationPrimitive $value */ |