Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / phpast / controller / PhabricatorXHPASTViewStreamController.php
blob3846b9cf412105633993563ba925668a4aef195e
1 <?php
3 final class PhabricatorXHPASTViewStreamController
4 extends PhabricatorXHPASTViewPanelController {
6 public function handleRequest(AphrontRequest $request) {
7 $storage = $this->getStorageTree();
8 $input = $storage->getInput();
9 $err = $storage->getReturnCode();
10 $stdout = $storage->getStdout();
11 $stderr = $storage->getStderr();
13 try {
14 $tree = XHPASTTree::newFromDataAndResolvedExecFuture(
15 $input,
16 array($err, $stdout, $stderr));
17 } catch (XHPASTSyntaxErrorException $ex) {
18 return $this->buildXHPASTViewPanelResponse($ex->getMessage());
21 $tokens = array();
22 foreach ($tree->getRawTokenStream() as $id => $token) {
23 $seq = $id;
24 $name = $token->getTypeName();
25 $title = pht('Token %d: %s', $seq, $name);
27 $tokens[] = phutil_tag(
28 'span',
29 array(
30 'title' => $title,
31 'class' => 'token',
33 $token->getValue());
36 return $this->buildXHPASTViewPanelResponse(
37 phutil_implode_html('', $tokens));