2011-04-07 04:17:05 +02:00
|
|
|
<?php
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class PhabricatorXHPASTViewStreamController
|
2011-04-07 04:17:05 +02:00
|
|
|
extends PhabricatorXHPASTViewPanelController {
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$storage = $this->getStorageTree();
|
|
|
|
$input = $storage->getInput();
|
|
|
|
$stdout = $storage->getStdout();
|
|
|
|
|
|
|
|
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
|
|
|
|
$input,
|
|
|
|
array(0, $stdout, ''));
|
|
|
|
|
|
|
|
$tokens = array();
|
|
|
|
foreach ($tree->getRawTokenStream() as $id => $token) {
|
|
|
|
$seq = $id;
|
|
|
|
$name = $token->getTypeName();
|
|
|
|
$title = "Token {$seq}: {$name}";
|
|
|
|
|
2013-01-18 03:43:35 +01:00
|
|
|
$tokens[] = phutil_tag(
|
2011-04-07 04:17:05 +02:00
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'title' => $title,
|
|
|
|
'class' => 'token',
|
|
|
|
),
|
2013-01-18 03:43:35 +01:00
|
|
|
$token->getValue());
|
2011-04-07 04:17:05 +02:00
|
|
|
}
|
|
|
|
|
2013-02-13 23:50:15 +01:00
|
|
|
return $this->buildXHPASTViewPanelResponse(
|
|
|
|
phutil_implode_html('', $tokens));
|
2011-04-07 04:17:05 +02:00
|
|
|
}
|
|
|
|
}
|