mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
Add compiler AST dump to debug command
This commit is contained in:
@@ -30,6 +30,12 @@ class QueryParseCommand extends Command
|
||||
InputArgument::REQUIRED,
|
||||
'The query to debug'
|
||||
)
|
||||
->addOption(
|
||||
'compiler-dump',
|
||||
false,
|
||||
InputOption::VALUE_NONE,
|
||||
'Output underlying compiler AST before visitor processing'
|
||||
)
|
||||
->addOption(
|
||||
'raw',
|
||||
false,
|
||||
@@ -49,8 +55,13 @@ class QueryParseCommand extends Command
|
||||
$output->writeln(str_repeat('-', 20));
|
||||
}
|
||||
|
||||
$query = $this->container['query_parser']->parse($string);
|
||||
$parser = $this->container['query_parser'];
|
||||
if ($input->getOption('compiler-dump')) {
|
||||
$dump = $parser->dump($string);
|
||||
} else {
|
||||
$query = $parser->parse($string);
|
||||
$dump = $query->dump();
|
||||
}
|
||||
|
||||
if (!$raw) {
|
||||
$output->writeln($dump);
|
||||
|
Reference in New Issue
Block a user