Skip to content

Commit 4a42b6c

Browse files
committed
Wire up lexers and generates
1 parent feba6be commit 4a42b6c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

blueprint.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
$contents = file_get_contents('sample.yaml');
88

99
$blueprint = new Blueprint();
10-
// $blueprint->registerLexer(new Lexer());
10+
$blueprint->registerLexer(new \Blueprint\Lexers\ModelLexer());
11+
$blueprint->registerGenerator(new \Blueprint\Generators\MigrationGenerator());
12+
$blueprint->registerGenerator(new \Blueprint\Generators\ModelGenerator());
13+
$blueprint->registerGenerator(new \Blueprint\Generators\FactoryGenerator());
1114

1215
$tokens = $blueprint->parse($contents);
1316
$registry = $blueprint->analyze($tokens);
14-
$blueprint->generate($tokens);
17+
$blueprint->generate($registry);
1518

src/Blueprint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function analyze(array $tokens)
3434
public function generate(array $tree)
3535
{
3636
foreach ($this->generators as $generator) {
37-
$generator::generate($tree);
37+
$generator->output($tree);
3838
}
3939
}
4040

tests/Feature/BlueprintTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function generate_uses_register_generators_to_generate_code()
173173
{
174174
$generator = \Mockery::mock();
175175
$tree = ['branch' => ['code', 'attributes']];
176-
$generator->expects('generate')
176+
$generator->expects('output')
177177
->with($tree);
178178

179179
$this->subject->registerGenerator($generator);

0 commit comments

Comments
 (0)