|
@@ 105-117 (lines=13) @@
|
| 102 |
|
return in_array($feature, $this->_input->getOption('debug')); |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
protected function tokenize() |
| 106 |
|
{ |
| 107 |
|
$tokens = $this->benchmark(function () { |
| 108 |
|
return $this->_language->tokenize($this->_source); |
| 109 |
|
}, $this->_times['tokenization']); |
| 110 |
|
|
| 111 |
|
$this->_counts['before'] = count($tokens); |
| 112 |
|
if ($this->wants('tree-before')) { |
| 113 |
|
$this->_tree($tokens, 'before parsing', false); |
| 114 |
|
} |
| 115 |
|
|
| 116 |
|
return $tokens; |
| 117 |
|
} |
| 118 |
|
|
| 119 |
|
protected function benchmark(callable $callable, &$time = null) |
| 120 |
|
{ |
|
@@ 134-146 (lines=13) @@
|
| 131 |
|
$this->_output->writeln($this->_debug->format(clone $tree, $indented)); |
| 132 |
|
} |
| 133 |
|
|
| 134 |
|
protected function parse(Tokens $tokens) |
| 135 |
|
{ |
| 136 |
|
$tokens = $this->benchmark(function () use ($tokens) { |
| 137 |
|
return $this->_language->parse($tokens); |
| 138 |
|
}, $this->_times['parsing']); |
| 139 |
|
|
| 140 |
|
$this->_counts['after'] = count($tokens); |
| 141 |
|
if ($this->wants('tree-after')) { |
| 142 |
|
$this->_tree($tokens, 'after parsing', true); |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
return $tokens; |
| 146 |
|
} |
| 147 |
|
|
| 148 |
|
protected function format(Tokens $tokens) |
| 149 |
|
{ |