protected function parse(Tokens $tokens) { $tokens = $this->benchmark(function () use($tokens) { return $this->_language->parse($tokens); }, $this->_times['parsing']); $this->_counts['after'] = count($tokens); if ($this->wants('tree-after')) { $this->_tree($tokens, 'after parsing', true); } return $tokens; }
public function highlight($source, Language $language, FormatterInterface $formatter = null) { $formatter = $formatter ?: $this->getDefaultFormatter(); return $formatter->format($language->parse($source)); }